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

bugs at busybox.net bugs at busybox.net
Thu Sep 18 02:59:19 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 19:59 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. 

---------------------------------------------------------------------- 
 path0s - 09-17-08 19:59  
---------------------------------------------------------------------- 
Well, I'm on a uclibc/busybox based ARM install (western digital
mybookworld) that used to have many commandline switches to it's old
busybox PS command. I upgraded busybox to 1.12 and now quite a few of the
scripts are broke because PS no longer supports any switch besides 'w' and
throws an error:

[root at MyBookWorld ~]# ps -e
ps: illegal option -- e
BusyBox v1.12.0 (2008-09-01 00:36:05 CDT) multi-call binary

Usage: ps 

Report process status

Options:
        w       Wide output

[root at MyBookWorld ~]# 

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                          
09-17-08 19:59  path0s         Note Added: 0011574                          
======================================================================




More information about the busybox-cvs mailing list