-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Check duplicate issues.
- Checked for duplicates
Description
Use case is a shell script with shebang #!/bin/sh that executes thisroot.sh prior to running root commands within the script.
If the mac user has chosen bash as the default shell, then thisroot.sh incorrectly identifies the shell as "sh" instead of "bash" and runs the wrong setup commands, resulting in an error.
On macos /bin/sh is a binary that re-execs itself to another shell. See the manpage on macos
sh is a POSIX-compliant command interpreter (shell). It is implemented by re-execing as either bash(1), dash(1), or
zsh(1) as determined by the symbolic link located at /private/var/select/sh.
Reproducer
create file runroot.sh (does nothing except setup root environment inside the script):
#!/bin/sh
source path-to-root/bin/thisroot.sh
execute the shell script:
runroot.sh
produces error message:
...root_v6.32.16/bin/thisroot.sh-orig: line 253: root-config: command not found
ROOT version
%60%60%60%0AROOT v6.32.16%0ABuilt for macosxarm64 on Sep 17 2025, 02:40:39%0AFrom tags%2F6-32-16@6-32-16%0AWith Apple clang version 17.0.0 (clang-1700.3.19.1)%0ABinary directory: %2FUsers%2Fwright20%2Fcern%2Froot_v6.32.16%2Fbin%0A%60%60%60
Installation method
build from source
Operating system
MacOS 15.7
Additional context
I think the error is due to getTrueShellExeName() function which returns "sh" as the SHELLNAME which is then used on line 199 to decide how to find the path to thisroot.sh. Instead of the "bash" method (which works) it assumes "dash or ksh" method using $(lsof ...) which fails.