On 17/10/2026 05:12, Collin Funk wrote:
From: Yu Watanabe <[email protected]>

When built with --enable-single-binary=symlinks, the process name
(comm) previously contained the path component. Use prog_name instead of
argv[0] to set the correct process name without the path.

     Before:
     $ src/sleep 10000 &
     [1] 601333
     $ cat /proc/601333/comm
     src/sleep

     After:
     $ src/sleep 10000 &
     [1] 618100
     $ cat /proc/618100/comm
     sleep

* src/coreutils.c (launch_program): Use the program name instead of
argv[0] when calling prctl (PR_SET_NAME, ...).

Link: https://github.com/coreutils/coreutils/pull/382
---
  src/coreutils.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/coreutils.c b/src/coreutils.c
index 180bfd9ce..ab52ba17b 100644
--- a/src/coreutils.c
+++ b/src/coreutils.c
@@ -114,7 +114,7 @@ launch_program (char const *prog_name, int prog_argc, char 
**prog_argv)
#if HAVE_PRCTL && defined PR_SET_NAME
    /* Not being able to set the program name is not a fatal error.  */
-  prctl (PR_SET_NAME, prog_argv[0]);
+  prctl (PR_SET_NAME, prog_name);
  #endif
  #if HAVE_PRCTL && defined PR_SET_MM_ARG_START
    /* Shift the beginning of the command line to prog_argv[0] (if set) so


I think this would use "ginstall" rather than "install".
Also more generally could misattribute comm in the case where you installed
`./configure --enable-single-binary --program-prefix=g` alongside another 
implementation.
In general when copying shebang wrapper scripts to another name,
the basename of that wrapper script should be used.

I.e. it seems better to use this?

  prctl (PR_SET_NAME, last_component (prog_argv[0]));

cheers,
Padraig

Reply via email to