Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000905 [1003.1(2013)/Issue7+TC1] Shell and Utilities Editorial Enhancement Request 2014-12-16 12:33 2020-04-03 15:09
Reporter steffen View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied  
Name Steffen Nurpmeso
Organization
User Reference
Section Vol. 3, ps
Page Number 3086, 3087
Line Number 102913, 102958
Interp Status ---
Final Accepted Text Note: 0002591
Summary 0000905: Add -w option for ps(1) command
Description As of today there is no standardized way to specify that the output of ps(1) is extended so that all values ought to be displayed appear, and without truncation.

The -w option as well as its interpretation (see Desired Action) seems to be identical on at least GNU, *BSD, Solaris and AIX and addresses this problem.

However, some implementations define -ww to limit the length to LINE_MAX and interpret -www as an INT_MAX limit, whereas others state for -ww "an arbitrarily wide output".
I propose to neither specify the possible number of occurrences of -w as well as the actual limits exactly, leaving them implementation defined: the result should still be satisfactory.
Desired Action Please standardize the -w option.

On page 3086, change the line 102913 from

  [−u userlist] [−U userlist]

to

  [−u userlist] [−U userlist] [-w]

On page 3087, append, after line 102958

  -w Specifies a wide-column format for output (132 columns rather than 80). If -w is specified more than once, an even wider output may be generated.
Tags issue8
Attached Files

- Relationships

-  Notes
(0002500)
joerg (reporter)
2014-12-16 13:21

-w is not an option that is available in POSIX mode but rather a key letter implemented for the pre-POSIX behavior of "ps".

See on Soliaris:
ps -w
ps: illegal option -- w
usage: ps [ -aAdefHlcjLPyZ ] [ -o format ] [ -t termlist ]
        [ -u userlist ] [ -U userlist ] [ -G grouplist ]
        [ -p proclist ] [ -g pgrplist ] [ -s sidlist ] [ -z zonelist ] [-h lgrplist]
  'format' is one or more of:
        user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid
        pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid
        f s c lwp nlwp psr tty addr wchan fname comm args projid project pset lgrp
(0002502)
steffen (reporter)
2014-12-16 14:20

Ok, but the online manual ([1]; which is all i know since i don't use Solaris) states

  The ps command tries to determine whether it is called natively or using the command syntax expected by ps(1B). In the latter case, the ps command behaves exactly as described in ps(1B).

And (the linked from [1]) ps(1B) then documents that ps(1) works as desired, i.e., with -ww meaning "arbitrarily wide output".
So i have to admit that for Solaris some work will be needed to adhere to the next standard version, yet i presume very little thereof.

  [1] http://docs.oracle.com/cd/E26502_01/html/E29030/ps-1.html#scrolltoc [^]
(0002503)
joerg (reporter)
2014-12-16 14:32

Looks like you found a bug in the Oracle manual.
-w definitely does not work. "w" only works as "key letter" to emulate
the BSD CLI. It was introduced when /usr/bin/ps and /usr/ucb/ps have been merged.
(0002504)
steffen (reporter)
2014-12-16 15:15

I'd rather say that if that is true then you've found a bug in the ps(1) code. :)
Or what other possibility does exist to avoid truncation there, then?
(Only restricting output to a single item isn't a safe variant to accomplish the task, is it?)
(0002505)
joerg (reporter)
2014-12-16 15:53

I was not saying that there might be no reason to think about this.
I am just saying that the proposal is a new invention.
(0002579)
geoffclare (manager)
2015-03-13 10:39

If the use of multiple -w options can cause the output to contain lines longer than LINE_MAX, then this has implications for piping the output into filters such as grep that require their input to be a text file. We should mention this at least in application usage, and probably put something relevant in normative text as well.

For example (app usage):

Portable applications should not specify the -w option more than once if the output will be used as input for a utility that requires a text file as input because lines containing more than {LINE_MAX} bytes may cause undefined behavior in some implementations of the utility.

(normative text):

If the -w option is not specified or is specified exactly once, all output lines shall contain no more than {LINE_MAX} bytes.
(0002580)
joerg (reporter)
2015-03-13 10:46

/usr/ucb/ps wwe on Solaris can in theory result in a line width of 2 MB for a 64 Bit process.
(0002591)
geoffclare (manager)
2015-03-19 16:28

On page 3086, change the line 102911 from

ps [-aA] ...

to

ps [-aAw] ...

On page 3087, append after line 102958:

-w behave as if the COLUMNS environment variable had a value of at least 132. If the -w option is not specified or is specified exactly once, all output lines shall contain no more than the greater of {LINE_MAX} and COLUMNS bytes provided that no format name is specified multiple times.

On page 3090 line 103106 add a new paragraph to APPLICATION USAGE:

Portable applications should not set COLUMNS to a value greater than {LINE_MAX} and should not specify the -w option more than once if the output will be used as input for a utility that requires a text file as input because lines containing more than {LINE_MAX} bytes may cause undefined behavior in some implementations of the utility.

- Issue History
Date Modified Username Field Change
2014-12-16 12:33 steffen New Issue
2014-12-16 12:33 steffen Name => Steffen Nurpmeso
2014-12-16 12:33 steffen Section => Vol. 3, ps
2014-12-16 12:33 steffen Page Number => 3086, 3087
2014-12-16 12:33 steffen Line Number => 102913, 102958
2014-12-16 13:21 joerg Note Added: 0002500
2014-12-16 14:20 steffen Note Added: 0002502
2014-12-16 14:32 joerg Note Added: 0002503
2014-12-16 15:15 steffen Note Added: 0002504
2014-12-16 15:53 joerg Note Added: 0002505
2015-03-13 10:39 geoffclare Note Added: 0002579
2015-03-13 10:46 joerg Note Added: 0002580
2015-03-19 16:28 geoffclare Note Added: 0002591
2015-03-19 16:30 geoffclare Interp Status => ---
2015-03-19 16:30 geoffclare Final Accepted Text => Note: 0002591
2015-03-19 16:30 geoffclare Status New => Resolved
2015-03-19 16:30 geoffclare Resolution Open => Accepted As Marked
2015-03-19 16:30 geoffclare Tag Attached: tc2-2008
2015-03-19 16:33 geoffclare Tag Detached: tc2-2008
2015-03-19 16:33 geoffclare Tag Attached: issue8
2020-04-03 15:09 geoffclare Status Resolved => Applied


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker