termux-exec icon indicating copy to clipboard operation
termux-exec copied to clipboard

The need for `execvp` wrapper

Open kyufie opened this issue 1 year ago • 1 comments

What it's all about

Right now, termux-exec only wraps execve. env however, uses execvp to execute external programs. https://github.com/coreutils/coreutils/blob/a94a551ee031e0ff07d707f867cb08a8be83e78c/src/env.c#L921

The man for exec(3) does say that:

The exec() family of functions replaces the current process image with a new process image. The functions described in this manual page are layered on top of execve(2).

However, it refers to execve as a system call, not as a library function.

What's broken

Here's a simple test to show inconsistency between ./test.sh and env ./test.sh Screenshot_2024-10-04-13-28-24-717_com termux-edit That should not happen. On my system, /bin/sh leads to /system/bin/sh. It shows that the parameters passed to execvp are not altered.

kyufie avatar Oct 04 '24 07:10 kyufie

There is a pull already to fix this and debs are attached. I'll get back to it after plugin app updates, some stuff remains to be completed.

https://github.com/termux/termux-exec/pull/24#issuecomment-1873059748

agnostic-apollo avatar Oct 04 '24 08:10 agnostic-apollo