[PR #88] linux-user: keep the name-ending parenthesis in /proc/self/stat #163

Open
opened 2026-01-31 21:30:03 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/qemu/qemu/pull/88

State: closed
Merged: No


When the program name is very long, qemu-user may truncate it in
/proc/self/stat. However the truncation must keep the ending ") "
to conform to the proc manpage which says:
(2) comm %s
The filename of the executable, in parentheses. This
is visible whether or not the executable is swapped
out.

To reproduce:

$ ln -s /bin/cat <filenamewithmorethan128chars>
$ qemu-x86_64 ./<filenamewithmorethan128chars> /proc/self/stat

Before the patch, you get:
1134631 (<filenametruncated>0 0 0 0 0 0 0 0 ...
After the patch:
1134631 (<filenametruncat>) 0 0 0 0 0 0 0 0 ...

This fixes an issue with hwloc failing to parse /proc/self/stat
when Ludovic Courtes was testing it in guix over qemu-aarch64.

Signed-off-by: Brice Goglin Brice.Goglin@inria.fr

**Original Pull Request:** https://github.com/qemu/qemu/pull/88 **State:** closed **Merged:** No --- When the program name is very long, qemu-user may truncate it in /proc/self/stat. However the truncation must keep the ending ") " to conform to the proc manpage which says: (2) comm %s The filename of the executable, in parentheses. This is visible whether or not the executable is swapped out. To reproduce: ``` $ ln -s /bin/cat <filenamewithmorethan128chars> $ qemu-x86_64 ./<filenamewithmorethan128chars> /proc/self/stat ``` Before the patch, you get: `1134631 (<filenametruncated>0 0 0 0 0 0 0 0 ...` After the patch: `1134631 (<filenametruncat>) 0 0 0 0 0 0 0 0 ...` This fixes an issue with hwloc failing to parse /proc/self/stat when Ludovic Courtes was testing it in guix over qemu-aarch64. Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
claunia added the pull-request label 2026-01-31 21:30:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/qemu#163