Hello sage-devel,

Can somebody explain the rationale for the following lines in
$SAGE_ROOT/sage:
if [ "$SAGE_ROOT" = "....." ];  then
    SAGE_ROOT=`readlink -n "$0" 2> /dev/null` || \
    SAGE_ROOT=`realpath    "$0" 2> /dev/null` || \
    SAGE_ROOT="$0"

I think the following would work equally well:
if [ "$SAGE_ROOT" = "....." ];  then
    SAGE_ROOT="$0"


Note that this is not needed to get an absolute (rather than relative)
path, since below there is
# Make root absolute:
cd "$SAGE_ROOT"
SAGE_ROOT=`pwd`

If we really want to resolve symbolic links, we could replace `pwd` by
`pwd -P` (physical path).


In any case, "readlink -n" certainly does NOT do what is intended and
should be removed (#11707):
 - It only works when `$0` (the sage executable itself) is a symbolic
link, it does not work when some other component in the path is a
symbolic link.
 - If the sage executable is a symbolic link, then `readlink -n` returns
the link itself, not the canonicalized name.  Example: if
`/usr/local/sage-4.7.1/sage` is a symbolic link to `sagefoo`, then
`SAGE_ROOT` would become `sagefoo` when `'/usr/local/sage-4.7.1/sagefoo`
is intended.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to