The reliance on $_ seems wrong, as it leads to wrong sysroot inference
when one of the wrapper scripts is invoked in the context of another
program. E.g.,
$ timeout 10s bpftrace -e 'uprobe:/system/lib64/libc.so:malloc { @ = hist(arg0); }'
/vendor/bin/bpftrace[5]: /system/bin/run.sh: inaccessible or not found
As can be seen, the sysroot is inferred to be /system/ in this case (the directory
in which timeout resides), which is not correct (everything bpf is located below
/vendor).
With this change we use $0 instead of $_ to fix this problem.
The reliance on
$_
seems wrong, as it leads to wrong sysroot inference when one of the wrapper scripts is invoked in the context of another program. E.g.,As can be seen, the sysroot is inferred to be
/system/
in this case (the directory in whichtimeout
resides), which is not correct (everything bpf is located below/vendor
).With this change we use
$0
instead of$_
to fix this problem.