[BusyBox 0005034]: PS: Commandline options to PS cause major problems from scripts

bugs at busybox.net bugs at busybox.net
Thu Sep 18 01:09:21 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=5034 
====================================================================== 
Reported By:                path0s
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   5034
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             09-17-2008 12:28 PDT
Last Modified:              09-17-2008 18:09 PDT
====================================================================== 
Summary:                    PS: Commandline options to PS cause major problems
from scripts
Description: 
When existing scripts pass commandline options to PS it causes major
problems for those scripts. A lot of scripts use switches such as -e and
-aux to figure out what processes are running by whom in order to check to
see if things are running and to control those processes.

If the real functionality of the standard switches to PS can't be used in
busybox, at least make busybox ignore the switches and just output the
same info it does normally without throwing the illegal option.
====================================================================== 

---------------------------------------------------------------------- 
 vda - 09-17-08 18:09  
---------------------------------------------------------------------- 
Actually, ps has WILDLY different switches in different Unixes, to the
point that POSIX had hard time finding a common subset.

It proved impossible, thus many switches are not documented in POSIX. This
is what _is_ documented according to my POSIX manpage:

PS(P)                      POSIX Programmer's Manual                    
PS(P)
NAME
       ps - report process status
SYNOPSIS
       ps [-aA][-defl][-G grouplist][-o format]...[-p proclist][-t
termlist]
       [-U userlist][-g grouplist][-n namelist][-u userlist]
       -a     Write information for all processes associated  with 
terminals.
              Implementations may omit session leaders from this list.
       -A     Write information for all processes.
       -d     Write information for all processes, except session
leaders.
       -e     Write information for all processes.  (Equivalent to -A.)
       -f     Generate  a  full  listing. (See the STDOUT section for the
con-
              tents of a full listing.)
...
       -u  userlist
              Write  information  for processes whose user ID numbers or
login
              names are given in userlist.
...

As you see, "ps -aux" is not POSIX-compliant, even "ps -au" is not.

But POSIX does have a nice way to output exactly those columnts you want -
it's "-o format" option. That is the way to use ps portably.

If you have cases where busybox ps contradicts POSIX/SUSv3, that is a real
problem. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-17-08 12:28  path0s         New Issue                                    
09-17-08 12:28  path0s         Status                   new => assigned     
09-17-08 12:28  path0s         Assigned To               => BusyBox         
09-17-08 18:09  vda            Note Added: 0011564                          
======================================================================




More information about the busybox-cvs mailing list