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

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

📋 Pull Request Information

Original PR: https://github.com/qemu/qemu/pull/88
Author: @bgoglin
Created: 3/30/2020
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • bdbe229 linux-user: keep the name-ending parenthesis in /proc/self/stat

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 linux-user/syscall.c (+4 -1)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/qemu/qemu/pull/88 **Author:** [@bgoglin](https://github.com/bgoglin) **Created:** 3/30/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`bdbe229`](https://github.com/qemu/qemu/commit/bdbe2299ed77460ea4bc5602e90f0be3f232b857) linux-user: keep the name-ending parenthesis in /proc/self/stat ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `linux-user/syscall.c` (+4 -1) </details> ### 📄 Description 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> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 21:30:02 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/qemu#158