rizsotto / scan-build

Clang's scan-build re-implementation in python
Other
362 stars 34 forks source link

Potential issue with Termux #98

Open easyaspi314 opened 6 years ago

easyaspi314 commented 6 years ago

Termux uses LD_PRELOAD and LD_LIBRARY_PATH to redirect /usr/bin and /bin calls to call /data/data/com.termux/files/usr/bin, as Android doesn't have /usr or /bin, and pretty much all shebang scripts assume that at least /bin/sh and /usr/bin/env exist. For example,

$ /usr/bin/zsh --version
zsh 5.4.2 (arm-unknown-linux-androideabi)
$ ls /usr
ls: cannot access '/usr': No such file or directory
$ export LD_PRELOAD=""
$ /usr/bin/zsh --version
CANNOT LINK EXECUTABLE "/usr/bin/zsh": can't read file "/data/data/com.termux/files/usr/lib": Is a directory
[1]    16502 abort      /usr/bin/zsh
$

While I haven't directly found an instance of this happening in my quick tests, I just want to warn you that this may occur if you overwrite the environment variable.

rizsotto commented 6 years ago

Thanks Devin for this. scan-build and intercept-build will be removed from this package soon. So probably the LD_PRELOAD won't be an issue anymore. (Creation of a compilation database will be done elsewhere. Like my other project Bear. But this will be an important thing to know when I test that tool.)

QGB commented 1 year ago

CANNOT LINK EXECUTABLE "./ttyd": can't read file "/data/data/qgb.ble/files/app/lib": Is a directory

QGB commented 1 year ago

('', 'CANNOT LINK EXECUTABLE "/data/data/qgb.ble/files/app/bin/ttyd0": "/data/data/qgb.ble/files/app/lib/libz.so.1" is too small to be an ELF executable: only found 14 bytes\n')