Open marcoismobile opened 3 days ago
This "ELF magic" looks like a start of a shell script shebang. Looks like shebangs might be unsupported yet?
It seems that termux-exec only supports the shebang pointing directly to an ELF file. Linux actually supports nested shebangs, where an interpreter of a script is a shebanged script itself.
gitstatus
is probably a statically-linked executable, see here.
Thanks for reporting @marcoismobile, and thanks for looking into this @sleirsgoevy !
It seems that termux-exec only supports the shebang pointing directly to an ELF file. Linux actually supports nested shebangs, where an interpreter of a script is a shebanged script itself.
Good find, seems to be the case (needs to be fixed)!
gitstatus is probably a statically-linked executable, see here.
One way around that would be to provide a Termux gitstatus
package, which would be dynamically linked. Don't know how straightforward it would be to make Powerlevel10k use a system-provided gitstatus
binary, instead of downloading the statically linked one?
Actually I rememberwd I was able to get a statically-linked executable to run withchmod /
(Which would returnhas unexpected e_type: 2
if executed directly), but it would require a rooted device. Not sure whether proot would do the same on non-rooted devices?
Thanks both for the quick replies! This indeed make sense (that it is related to the shebangs). Do I understand correctly that this 'shebangs' (or the termux-exec package) is not used for the Fdroid version of Termux? Or is it used in another way? Because the downloaded version of gitstatus is working 'out-of-the-box' on the Fdroid version (same for the chezmoi scripts).
Is there a way to test above in some way by manually change things? I tested a normal shell script.sh:
#!/bin/bash
echo Test123
Which is working fine, so I assume this is triggering 'shebangs' in some other way?
Problem description
Not sure how to describe the problem, but it seems after switching to the Play Store version of Termux, certain executables are not working anymore. I am not sure if they have the same root cause, so I am creating this issue to get some pointers on how to investigate/troubleshoot or possibly fix these problems ;)
Chezmoi: https://www.chezmoi.io/user-guide/use-scripts-to-perform-actions/ When trying to apply Chezmoi it is going to run some 'generated' install shell scripts, this is working without problems on the Fdroid version of Termux, but it will gives the following error on the Play Store version:
xxx.install.sh has bad ELF magic: 23212f64
Powerlevel10k: https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#why-does-powerlevel10k-spawn-extra-processes When installing Powerlevel10k zsh extention, it downloads a 'gitstatus' executable, which works fine on the Fdroid version of Termux, but gives the following error on the Play Store version:
Could not find a PHDR: broken executable?
I am not sure where to look or how to troubleshoot this? Can it possible be related to 'External, non-Termux app can not yet run Termux commands (the RUN_COMMAND permission).' or is that a compleet wrong direction?
Please let me know if you want me to troubleshoot more or need more debug logs etc.. Thanks in advance!
Steps to reproduce the behavior.
What is the expected behavior?
Normal working functionality as in the Fdroid version of Termux
System information