[Bug 5216] 1.20 ps lacks -w and -l options for DESKTOP case

bugzilla at busybox.net bugzilla at busybox.net
Wed May 23 08:39:39 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=5216

--- Comment #2 from Michael Tokarev <mjt+busybox at tls.msk.ru> 2012-05-23 08:39:38 UTC ---
I see where it goes:

#if ENABLE_SELINUX
# define SELINUX_O_PREFIX "label,"
# define DEFAULT_O_STR    (SELINUX_O_PREFIX "pid,user"
IF_FEATURE_PS_TIME(",time") ",args")
#else
# define DEFAULT_O_STR    ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
#endif

...
#if ENABLE_SELINUX
                if (!(opt & OPT_Z) || !is_selinux_enabled()) {
                        /* no -Z or no SELinux: do not show LABEL */
                        strcpy(default_o, DEFAULT_O_STR +
sizeof(SELINUX_O_PREFIX)-1);
                } else
#endif
                {
                        strcpy(default_o, DEFAULT_O_STR);
                }


This default_o and DEFAULT_O_STR stuff should be rearranged for this to work. 
Something like,

 default_o[0] = '\0';
 if ((opt & OPT_Z) && is_selinux_enabled()) strcat(default_o,"label,");
 strcat(default_o,"pid,user"IF_FEATURE_PS_TIME(",time"));
 if (opt & OPT_L) strcat(default_o,"...");
 if (opt & OPT_W) strcat(default_o,"...");

(with proper values for "...").

But it quickly becomes rather complicated.  Also, -w is cumulative really (-www
is "more w" than -w).  I'll try to cook something when I'll have time.

BTW, current busybox ps does not conform to neither POSIX nor procps in default
output too.  For example, default ps shows pid, tty, time and cmd of all
processes run on current tty (so listing tty column is sort of wrong), while
default bysybox ps shows pid, user and cmd of all processes (user instead of
tty).  Looks like if this should be fixed, it should be fixed together with
-l/-w.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list