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.
Fixed with commit 584130f4764843e6a7e7b27a7efe74bca0a938e1 in procps-3.3.11