[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request: process title with exec -a "" for oneself
From: |
Martin D Kealey |
Subject: |
Re: Feature request: process title with exec -a "" for oneself |
Date: |
Tue, 3 Sep 2024 14:53:57 +1000 |
On Sun, 1 Sept 2024 at 12:43, Lockywolf <
for_bug-bash_gnu.org_2024-09-01@lockywolf.net> wrote:
> Dear Bash developers,
>
> May I ask for a small feature to be added to bash?
>
> At the moment exec changes IO redirections for the newly started
> processes, but if there is no command for exec'ing, it changes those
> redirections for the bash process itself.
>
> The exec -a, however, allows setting the current process title (argv0)
> only for the newly exec'ed processes, and "exec -a whatever" (without a
> command) does nothing.
>
Whilst I hesitate to justify choices on the basis of "consistency", i would
argue that doing *nothing* is more consistent with what happens when exec
is used to invoke a *script*, because in that case the execve kernel call
will discard any supplied argv[0] and substitute either the given command
pathname or (to safely support setuid scripts on some non-Linux systems) a
magic path to a pre-opened filedescriptor.
That said, there's virtually no downside to this, and it *might* be useful
in some corner cases, as long as the script can tolerate the "do nothing"
fallback on systems where this is less feasible to implement.
-Martin