#6146: the detection of SAGE_ROOT in $SAGE_ROOT/sage script should expand 
symlinks
recursively (fix this on systems that do *NOT* support readlink -f)
--------------------+-------------------------------------------------------
 Reporter:  was     |       Owner:  cwitty  
     Type:  defect  |      Status:  new     
 Priority:  major   |   Milestone:  sage-4.1
Component:  misc    |    Keywords:          
 Reviewer:          |      Author:          
   Merged:          |  
--------------------+-------------------------------------------------------

Comment(by tornaria):

 I've attached a proof-of-concept of a bash script which correctly computes
 the SAGE_ROOT as a fully canonicalized path. This is a tarball which
 includes the script itself, and a bunch of symlinks to the same script in
 different configurations, plus a test script which shows the result of the
 computation of SAGE_ROOT in the different cases.

 To test, untar, {{{cd sage-realpath-test}}} and run {{{./test}}}. Sample
 output:
 {{{
 ==========================================================
 The following lines of output should all be identical, and
 point to the canonicalized path of directory sage_root
 ==========================================================

 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 SAGE_ROOT:/home/tornaria/sage-realpath-test/sage_root:
 }}}
 This is a correct run, because all the runs gave the same canonical path
 (which is the correct canonical path).

 The script uses {{{realpath}}}, then {{{readlink -f}}}, and fall back to a
 bash function; but for testing purposes, the fallback to bash function is
 always tried.

 I've successfully tested this on:
  - linux with no realpath, but readlink -f works (my laptop)
  - linux with realpath (sage.math)
  - mac with fink (which supports readlink -f)
  - mac with fink disabled (remove it from path)
  - t2 (trying this found out some gnuisms or non-sunisms which I had to
 fix)

 Maybe somebody can try this on the build farm to check that it is safe...
 Assuming what we really want is for SAGE_ROOT to be the fully
 canonicalized path (see the last comments in #5852).

 BTW, this already gives an absolute path, so there would be no need to
 {{{cd $SAGE_ROOT}}} here and {{{cd $CUR}}} back in sage-sage (ugly hack).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6146#comment:2>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to