On 27/11/2026 17:22, Pádraig Brady wrote:
* configure.ac: Accept and validate --program-prefix
with --enable-single-binary={symlinks,hardlinks}.
* src/coreutils.c: Also match the prefixed name.
Note this is done before the standard name match
so edge cases like --prefix=un are handled wrt "link" and "unlink".
* NEWS: Mention the Build-related change.
In retrospect I'm going to drop this one,
because there are other issues with argv[0] dispatch,
i.e. with --enable-single-binary={symlinks,hardlinks}.

While this patch works fine, it might encourage use
of these non-recommended install modes.

We could plug some of the argv[0] generality issues
with readlink(/proc/self/exe) or getauxval(AT_EXECFN),
but these are either not mounted, non supported,
prone to TOCTOU races, and have added complexity.

For reference, some of the issues with argv[0] dispatch:

  `env -a` etc. can set argv to anything,
  which might bypass path based rules like with apparmor etc.

  You can't copy/link symlinks or hardlinks to other
  non standard names as they'll lose their mapping.

  symlink1 -> symlink2 -> dispatch loses intent of symlink2

For completeness shebangs also has an issue
though it's less of a problem in practice.

  `env -a foo CMD` loses the argv[0] foo.
  E.g. `env -a myjob timeout 10 sleep 10`
  is then not found with e.g. `pgrep -f myjob`

I'll document these in the texi I think.

cheers,
Padraig

Reply via email to