Bug #11156
Conversion fails if source folder is a symlink
100%
History
#1 Updated by Alexandru Lungu 6 months ago
If I attempt to convert a project (e.g. Hotel), but the ./abl folder is a symlink, then the conversion fails with:
[java] EXPRESSION EXECUTION ERROR:
[java] ---------------------------
[java] throwException(err)
[java] ^ { Invalid basepath! basepath = ./abl; pkg = abl; [BLOCK id <360777252865> 0:0] }
[java] ---------------------------
[java] EXPRESSION EXECUTION ERROR:
[java] ---------------------------
[java] relpkg = execLib("rel_pkg_path")
[java] ^ { Expression execution error @1:1 }
I had another customer project fail exactly the same, but with different error feedback (#10981).
#3 Updated by Dănuț Filimon 6 months ago
- Assignee set to Dănuț Filimon
- Status changed from New to WIP
I'll pick this one up.
#4 Updated by Dănuț Filimon 6 months ago
There are no issues when the symlink points to a folder in the ~/gcd/hotel_gui directory, but the problem appears when it is part of another folder that is outside ~/gcd/hotel_gui.
This is how normalizeFilename() works right now when the symlink is../abl:
- home = /home/ddf/gcd/hotel_gui and filename = abl/activate-rooms-dialog.w
- abnormal.getCanonicalPath() = /home/ddf/gcd/abl/activate-rooms-dialog.w
- new File(home).getCanonicalPath() = /home/ddf/gcd/hotel_gui
- absolute.startsWith(home) = false
- filename is returned
The issue? abnormal.getCanonicalPath() = /home/ddf/gcd/abl/activate-rooms-dialog.w follows the symlink target instead of preserving it.
- home = /home/ddf/gcd/hotel_gui and filename = abl/activate-rooms-dialog.w
- Path homeRoot = Paths.get(home).toAbsolutePath().normalize();
- Path inputFilename = Path input = Paths.get(filename);
- normalize the inputFilename
- inputFilename.startsWith(homeRoot) => relativize(inputFilename) and return "." + File.separator + inputFilename
- return the filename if nothing happened
I ran a Hotel_GUI conversion and it worked properly, I will commit the changes soon.
#5 Updated by Dănuț Filimon 6 months ago
- % Done changed from 0 to 100
- Status changed from WIP to Review
- reviewer Alexandru Lungu added
Committed 11156a/16373. When using a symlink, make sure the target is preserved instead of followed. (refs: #11156)
Alexandru, please review.