Skip to content

Commit 29a9c27

Browse files
author
Release Manager
committed
Trac #32836: Work around clobbering of PATH on initialization of libsingular from system singular
I'm pretty sure this is a new problem, otherwise I would have hit it with lcalc-2.x before. These tests were done on a clean 9.5.beta5 build. When I start sage, my `PATH` looks correct, in that `SAGE_LOCAL/bin` comes before the usual system paths (in particular `/usr/bin`): {{{ sage: os.environ["PATH"].split(":") ['/home/mjo/src/sage.git/build/bin', '/home/mjo/src/sage.git/src/bin', '/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.9/bin', '/home/mjo/src/sage.git/local/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/opt/bin', '/usr/lib/llvm/12/bin', '/home/mjo/bin', '/home/mjo/bin'] }}} And if I use `shutil.which` to find the "lcalc" program, it finds the right one: {{{ sage: from shutil import which sage: which("lcalc") '/home/mjo/src/sage.git/local/bin/lcalc' sage: os.system(which("lcalc") + " --version") lcalc 1.22 July 14, 2009 0 }}} But... that's not the one that sage itself wants to use: {{{ sage: os.system("lcalc --version") lcalc 2.0.3 0 sage: from sage.lfunctions.lcalc import LCalc sage: lc = LCalc() sage: lc("--version") 'lcalc 2.0.3' }}} This is causing all doctests that run "lcalc" to fail, because they're picking up lcalc-2.x from `/usr/bin` instead of the one in `SAGE_LOCAL/bin` that the SPKG installed. URL: https://trac.sagemath.org/32836 Reported by: mjo Ticket author(s): Michael Orlitzky Reviewer(s): Matthias Koeppe
2 parents b3ce5f4 + f75d33f commit 29a9c27

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sage/libs/singular/singular.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,11 @@ cdef init_libsingular():
803803

804804
error_messages = []
805805

806-
# call the init routine
806+
# Save/restore the PATH because libSingular clobbers it:
807+
# https://github.com/Singular/Singular/issues/1119
808+
saved_PATH = os.environ["PATH"]
807809
init_libsingular()
810+
os.environ["PATH"] = saved_PATH
808811

809812
cdef void libsingular_error_callback(const_char_ptr s):
810813
_s = char_to_str(s)

0 commit comments

Comments
 (0)