# HG changeset patch
# User Volker Braun <vbraun@stp.dias.ie>
# Date 1290031800 18000
# Node ID 6142b25d71551c4efa4184d45390d4ff030835cd
# Parent 6f1a75750df41564e077dc801163fe4ce660adff
Trac 10286: sagenativeexecute does not unset path etc.
The sagenativeexecute script unsets the LD_LIBRARY_PATH but not the PATH, and then executes the argument. So it essentially breaks execution of all programs that are shipped with sage since they can't find their libraries any more, unless you are lucky and the system libraries have the same version.
diff r 6f1a75750df4 r 6142b25d7155 sageenv
a

b


22  22  # 
23  23  ########################################################################## 
24  24  
 25  # first, save paths so we can unset them when calling external programs 
 26  if [ z "${SAGE_ORIG_PATH_SET}" ]; then 
 27  SAGE_ORIG_PATH=$PATH && export SAGE_ORIG_PATH 
 28  SAGE_ORIG_PATH_SET=True && export SAGE_ORIG_PATH_SET 
 29  fi 
 30  
 31  if [ z "${SAGE_ORIG_LD_LIBRARY_PATH_SET}" ]; then 
 32  SAGE_ORIG_LD_LIBRARY_PATH=$LD_LIBRARY_PATH && export SAGE_ORIG_LD_LIBRARY_PATH 
 33  SAGE_ORIG_LD_LIBRARY_PATH_SET=True && export SAGE_ORIG_LD_LIBRARY_PATH_SET 
 34  fi 
 35  
 36  if [ `uname` = "Darwin" ]; then 
 37  if [ z "${SAGE_ORIG_DYLD_LIBRARY_PATH_SET}" ]; then 
 38  SAGE_ORIG_DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH && export SAGE_ORIG_DYLD_LIBRARY_PATH 
 39  SAGE_ORIG_DYLD_LIBRARY_PATH_SET=True && export SAGE_ORIG_DYLD_LIBRARY_PATH_SET 
 40  fi 
 41  fi 
 42  
25  43  # GUESS SAGE_ROOT from pwd 
26  44  SAVEDIR="`pwd`" 
27  45  if [ f sage a d spkg ]; then 
… 
… 

173  191  PYTHONHOME="$SAGE_ROOT/local" && export PYTHONHOME 
174  192  fi 
175  193  
176   if [ z "${SAGE_ORIG_LD_LIBRARY_PATH_SET}" ]; then 
177   SAGE_ORIG_LD_LIBRARY_PATH=$LD_LIBRARY_PATH && export SAGE_ORIG_LD_LIBRARY_PATH 
178   SAGE_ORIG_LD_LIBRARY_PATH_SET=True && export SAGE_ORIG_LD_LIBRARY_PATH_SET 
179   fi 
180   
181  194  if [ z "$SAGE_TESTDIR" ]; then 
182  195  SAGE_TESTDIR="$DOT_SAGE"/tmp && export SAGE_TESTDIR 
183  196  fi 
… 
… 

214  227  # The following is needed for OS X (especially for the 
215  228  # Singular install). 
216  229  if [ `uname` = "Darwin" ]; then 
217   if [ z "${SAGE_ORIG_DYLD_LIBRARY_PATH_SET}" ]; then 
218   SAGE_ORIG_DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH && export SAGE_ORIG_DYLD_LIBRARY_PATH 
219   SAGE_ORIG_DYLD_LIBRARY_PATH_SET=True && export SAGE_ORIG_DYLD_LIBRARY_PATH_SET 
220   fi 
221  230  DYLD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH:$SAGE_LOCAL/lib/R/lib" && export DYLD_LIBRARY_PATH 
222  231  fi 
223  232  
diff r 6f1a75750df4 r 6142b25d7155 sagenativeexecute
a

b


1  1  #!/bin/sh 
2  2  
3   LD_LIBRARY_PATH=$SAGE_ORIG_LD_LIBRARY_PATH; export LD_LIBRARY_PATH 
4   if [ `uname` = 'Darwin' ]; then 
5   DYLD_LIBRARY_PATH=$SAGE_ORIG_DYLD_LIBRARY_PATH 
 3  # This script is used to run nonSage programs such as opening an 
 4  # image viewer, magma, matlab, latex, etc. 
 5  
 6  # The PATH and LD_LIBRARY_PATH will be reverted to what they were 
 7  # before Sage was run, allowing external programs to run. You can not 
 8  # use this script to run programs that are shipped with Sage, as they 
 9  # and their libraries will no longer be in the search path. 
 10  
 11  
 12  # revert all relevant paths 
 13  if [ "x$SAGE_ORIG_PATH_SET" = "xTrue" ]; then 
 14  PATH=$SAGE_ORIG_PATH 
 15  export PATH 
6  16  fi 
7  17  
 18  if [ "x$SAGE_ORIG_LD_LIBRARY_PATH_SET" = "xTrue" ]; then 
 19  LD_LIBRARY_PATH=$SAGE_ORIG_LD_LIBRARY_PATH 
 20  export LD_LIBRARY_PATH 
 21  fi 
 22  
 23  if [ "x$SAGE_ORIG_DYLD_LIBRARY_PATH" = "xTrue" ]; then 
 24  DYLD_LIBRARY_PATH=$SAGE_ORIG_DYLD_LIBRARY_PATH 
 25  export DYLD_LIBRARY_PATH 
 26  fi 
 27  
 28  unset PYTHONPATH && export PYTHONPATH 
 29  unset PYTHONHOME && export PYTHONHOME 
 30  
8  31  "$@" 
9  32  