Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 555200 - sys-process/procps - "ps -p <pid> -o pid=,..." misbehavior
Summary: sys-process/procps - "ps -p <pid> -o pid=,..." misbehavior
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://gitlab.com/procps-ng/procps/i...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-17 14:13 UTC by Lars Wendler (Polynomial-C) (RETIRED)
Modified: 2015-10-29 14:15 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2015-07-17 14:13:42 UTC
Observe the following three variants of the same command. They should have the same output but they don't:


polynomial-c@notebook:~ $ ps p $$ -o pid=,comm=,args=
 7899 zsh             -zsh
polynomial-c@notebook:~ $ ps -p $$ -o pid=,comm=,args=
,comm=,args=
        7899
polynomial-c@notebook:~ $ ps --pid $$ -o pid=,comm=,args=
 7899 zsh             -zsh
polynomial-c@notebook:~ $


Yes, the commands seem to be odd as I already submit ps a pid and then request the pid in the output again. But I had a case where this sort of command came in handy and thus stumbled upon this bug.
On the other hand similar "odd" commands behave as expected:


polynomial-c@notebook:~ $ ps -C X -o comm=,args=,pid=
X               /usr/bin/X -br -novtswitch   2163
polynomial-c@notebook:~ $


This "bug" seems to be available for quite a long time. I could even reproduce it on a SLES11SP3 system with ps from procps-3.2.7

Additional observations:

The problem can only be triggered by the following circumstances:

- pid must be submitted using "-p". Neither "p" nor "--pid" can trigger it.
- the output format string must begin with "pid=". Everything else doesn't trigger the bug. So neither "-o comm=,pid=,uid=" nor "-o pid,comm" do trigger it but only "-o pid=,..." notations.
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2015-10-29 14:15:23 UTC
Fixed with commit 584130f4764843e6a7e7b27a7efe74bca0a938e1 in procps-3.3.11