The thisroot.sh misbahes in ROOT 6.34+

While playing with some reported problem, I now (accidentally) noticed that the “thisroot.sh” is terribly screwed starting from ROOT 6.34 (ROOT 6.32 and older are fine).

The “LD_LIBRARY_PATH”, “DYLD_LIBRARY_PATH”, “SHLIB_PATH”, “LIBPATH”, and “PYTHONPATH” are not properly managed:

[...]$ diff /.../root_v6.34.10/bin/thisroot.sh /.../root_v6.32.20/bin/thisroot.sh
42d41
<          drop_from_path "$LD_LIBRARY_PATH" "${old_rootsys}/lib/root"
47d45
<          drop_from_path "$DYLD_LIBRARY_PATH" "${old_rootsys}/lib/root"
52d49
<          drop_from_path "$SHLIB_PATH" "${old_rootsys}/lib/root"
57d53
<          drop_from_path "$LIBPATH" "${old_rootsys}/lib/root"
62d57
<          drop_from_path "$PYTHONPATH" "${old_rootsys}/lib/root"

is terribly screwed starting from ROOT 6.34 (ROOT 6.32 and older are fine).

In what sense?

42d41
<          drop_from_path "$LD_LIBRARY_PATH" "${old_rootsys}/lib/root"

those new lines are meant to handle the case where ROOT was build/installed with the gnuinstall=ON See commit 8e196e4993efcc3fedc84125da4816e94f953a41.

They should be (they are as far as I can tell) in addition to the pre-existing drop_from_path calls.

Example:

[...]$ echo $PYTHONPATH

[...]$ source /.../root_v6.34.10/bin/thisroot.sh
[...]$ source /.../root_v6.34.10/bin/thisroot.sh
[...]$ source /.../root_v6.34.10/bin/thisroot.sh
[...]$ echo $PYTHONPATH
/.../root_v6.34.10/lib:/.../root_v6.34.10/lib:/.../root_v6.34.10/lib

My guess is that all these offending lines should be changed into (just test it this time, before you push it):
drop_from_path "$newpath" "${old_rootsys}/lib/root"

Indeed you are right.

See thisroot.sh no longer remove previous version from the paths · Issue #20643 · root-project/root · GitHub and Fix thisroot.sh to properly remove previous ROOT version from paths by Copilot · Pull Request #20645 · root-project/root · GitHub

There is another problem related to Jupyter.

Up to (and including) ROOT 6.34, you define “JUPYTER_CONFIG_DIR”, but you do not care about “JUPYTER_CONFIG_PATH” (which may come from a newer ROOT version).

From ROOT 6.36, you define “JUPYTER_CONFIG_PATH”, but you do not care about “JUPYTER_CONFIG_DIR” (which may come from an older ROOT version).

This creates a problem when one switches between versions, e.g.:
source /.../root_v6.34.10/bin/thisroot.sh
source /.../root_v6.36.06/bin/thisroot.sh
One then has:
JUPYTER_CONFIG_DIR="/.../root_v6.34.10/etc/notebook"
JUPYTER_CONFIG_PATH="/.../root_v6.36.06/etc/notebook"

It seems to me that you should fix it in ROOT 6.34+, so that, even if you do not define some variable, it should try to “drop_from_path” any possible “old_rootsys” entries from another version (older or newer).

2 Likes