ext:run-program launches subprocess with PGID != PID

Using run-program launches the subprocess with the PGID (process group ID) != PID.

On Unix it is customary for the process leader to have PGID=PID, which facilitates sending signals not only to that process but also to any of its children that share the same PGID.

Here's an example of what I see with ECL though:

(ext:run-program "sleep" '("1000"))

If I now run ps I see:

ps xao pid,ppid,pgid,args | grep sleep | grep -v grep
  69638   69620   69620 sleep 1000

which is a problem. I can't send commands like kill -15 -- -69638 where 69638 is the PID, as the PGID is not 69638 like the PID, but a new arbitrary number (in this case 69620). When your subprocess has children with which you want to communicate then this becomes an issue.

I'm using Ubuntu 20.04 with a recent ECL installed through GUIX:

     VERSION "21.2.1"
      VCS-ID "UNKNOWN"
          OS "Linux"
  OS-VERSION "5.4.0-88-generic"
MACHINE-TYPE "x86_64"
    FEATURES (:WALKER :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :COMPLEX-FLOAT :LONG-FLOAT :UNICODE ...)

Do you think this can be fixed? I was extending support in UIOP's subprocess management and I had to drop new uiop:launch-program features like kill-children for ECL because of this (for more context see https://gitlab.common-lisp.net/asdf/asdf/-/issues/92 + https://gitlab.common-lisp.net/asdf/asdf/-/merge_requests/192).

Thank you!

Edited by Alberto Artilheiro