facebookexperimental / ExtendedAndroidTools

Extended Android Tools is a place to host and maintain a build environment and makefiles cross compiling Linux tools we all love for Android.
Apache License 2.0
189 stars 63 forks source link

Use $0 instead of $_ for sysroot inference #19

Closed danielocfb closed 2 years ago

danielocfb commented 2 years ago

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.

michalgr commented 2 years ago

Thanks !

danielocfb commented 2 years ago

Thanks for merging so quickly.