-
-
Notifications
You must be signed in to change notification settings - Fork 678
Closed
Description
Currently, $SAGE_ROOT/sage uses (first among other alternate methods) readlink -n to detect the directory where the script lives (that's $SAGE_ROOT), but that is broken because
- It only works when
$0(the sage executable itself) is a symbolic link - If the sage executable is a symbolic link, then
readlink -nreturns the link itself, not the canonicalized name. Example: if/usr/local/sage-4.7.1/sageis a symbolic link tosagefoo, thenSAGE_ROOTwould becomesagefoowhen'/usr/local/sage-4.7.1/sagefoois intended. - The symlink expansion may not be completely done, and
$SAGE_ROOTcould end up with a non-canonical dirname, which leads to issues with testing. - The code to detect
SAGE_ROOTinsidesage-envdoes not canonicalize the pathname at all. This should be fixed as well. (The only case wheresage-envis run withoutSAGE_ROOTbeing set is when testing Sage from theMakefile, i.e. when runningmake ptestor similar.)
Note that we should do this in a portable way, without using realpath, readlink -f or the likes.
See also #11704, which solves the same problem for DOT_SAGE.
Apply:
- attachment: 5852_sage_root.patch to
SAGE_ROOT - attachment: 5852_scripts.patch to
local/bin - attachment: 5852_doc.patch and attachment: trac_5852-doc-referee.patch to
devel/sage
Depends on #11926
Depends on #11959
Component: scripts
Author: Jeroen Demeyer
Reviewer: John Palmieri, Leif Leonhardy
Merged: sage-4.8.alpha3
Issue created by migration from https://trac.sagemath.org/ticket/5852