Bug 231257

Summary: Valgrind omits path when executing script from shebang line.
Product: [Developer tools] valgrind Reporter: Jeffrey Yasskin <jyasskin>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED WORKSFORME    
Severity: normal CC: flo2030
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jeffrey Yasskin 2010-03-18 23:47:17 UTC
Version:           3.6.0.SVN (using Devel)
OS:                Linux
Installed from:    Compiled sources

When executing a script found using the path, Linux 2.6.4 passes the full script path to the command mentioned on the #! line. Valgrind, at least versions 3.3.0, 3.5.0, and a custom-built 3.6.0-SVN, passes the PATH-less script name instead:


jyasskin@enki:~$ cat /tmp/test.sh
#!/bin/echo
jyasskin@enki:~$ test.sh
bash: test.sh: command not found
jyasskin@enki:~$ PATH=/tmp:$PATH test.sh
/tmp/test.sh
jyasskin@enki:~$ PATH=/tmp:$PATH valgrind -q test.sh
test.sh


This makes a difference when the #! line is /bin/sh on recent Debian and Ubuntu versions, where /bin/sh is dash instead of bash. Dash doesn't search for its argument in the path, expecting the kernel to have already resolved the script name.
Comment 1 Florian Krohm 2015-04-01 15:05:37 UTC
This appears to work in 3.10.1 and SVN turnk.
So I'm closing this.