[Bug 11826] New: ps pid/ppid/pgid fields truncated when kernel.pid_max > 99999
bugzilla at busybox.net
bugzilla at busybox.net
Thu May 2 19:25:20 UTC 2019
https://bugs.busybox.net/show_bug.cgi?id=11826
Bug ID: 11826
Summary: ps pid/ppid/pgid fields truncated when kernel.pid_max
> 99999
Product: Busybox
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: critical
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: josh at hoblitt.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
`ps` from all versions checked and the current `master` uses a hard-coded width
per field for output formatting.
>From `procps/ps.c`
```
static const ps_out_t out_spec[] = {
/* Mandated by
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.ht ml: */
{ 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID },
{ 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID },
{ 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM },
{ MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM },
{ 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID },
{ 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID },
{ 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID },
```
This works when the linux sysctl `kernel.pid_max` is at its default of 32768.
However, if the value set to > 99999, it creates the potential for the `pid`,
`ppid`, and `pgid` fields to be not only truncated upon output but with no
delimiting space between it and the right hand side adjacent field. Eg.,
```
/ # ps -efo pid,comm
PID COMMAND
1 dockerd
31 containerd
408249containerd-shim
408266cat
408786containerd-shim
408803cat
413819sh
414865ps
```
This is a bit of a disaster for programs that try to parse the output of `ps`
and I've recently run into this with `docker`. Eg.,
https://github.com/moby/moby/issues/34282
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list