View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000424 | 1003.1(2008)/Issue 7 | Shell and Utilities | public | 2011-05-08 18:00 | 2013-04-16 13:06 |
Reporter | Don Cragun | Assigned To | ajosey | ||
Priority | normal | Severity | Editorial | Type | Omission |
Status | Closed | Resolution | Accepted As Marked | ||
Name | Don | ||||
Organization | Self | ||||
User Reference | ls mutually exclusive options list | ||||
Section | ls | ||||
Page Number | 2866 | ||||
Line Number | 93814 | ||||
Interp Status | Approved | ||||
Final Accepted Text | 0000424:0000805 | ||||
Summary | 0000424: The list of mutually exclusive ls utility options is missing some entries. | ||||
Description | The -C option sorts output down columns; the -x option sorts output across rows. Since ls can't do both at the same time, these are mutually exclusive options. And since -C and -1 are mutually exclusive options, by transitivity, -x and -1, and -m and -1 are also mutually exclusive options. | ||||
Desired Action | Change the list of mutually exclusive options on P2866, L93814-93815 from: −C and −l (ell), −m and −l (ell), −x and −l (ell), −C and −1 (one), −H and −L, −c and −u, −t and −S to: −C and −l (ell), −C and −1 (one), −C and −x, −H and −L, −S and −t, −c and −u, −m and −l (ell), −m and −1 (one), −x and −l (ell), −x and −1 (one) Note that this also sorts the list such that they are listed in the order used in the OPTIONS section. | ||||
Tags | tc1-2008 |
|
This is the second version of this note. It includes changes suggested by public and private e-mail sent to the author... Upon further investigation, the original problem reported above barely touches on the underlying problem. All of the options except -i, -k, -q, and -s are mutually exclusive with at least one of the other options. Furthermore, there is a strong interaction between the -l (ell), -g, -n, and -o options with the -C, -m, and -1 (one) options that is not clearly specified in the DESCRIPTION and OPTIONS sections of ls and is only partly described in the STDOUT section. Almost none of these mutually exclusive sets are shown in the SYNOPSIS section. Some of the mutually exclusive sets are indirectly described in the STDOUT section. A few of the mutual exclusion details are mentioned in the OPTIONS section; most are not. To make matters even worse, the descriptions of -g, -l (ell), -o, and -n don't accurately document existing practice (including that -g and -o are not mutually exclusive). Except for the -R, -d, and -f options which need to specify exceptions, giving mutually-exclusive options should behave as specified by the last option given. The fact that this is important because ls is so frequently aliased is noted in the rationale, but it incorrectly states that this is when options are repeated instead of when mutually-exclusive options are specified. The description of the -f option lists a seemingly non-sensical set of options that are turned off when -f is specified. (Historically, it made perfect sense. In UNIX Version 7, there was only one file system type and ls -f could read any file and interpret it as a directory in that format. This meant that it couldn't do a stat() on a file to get information like time stamps and file sizes since all it had was an inode number and a file name without knowing the file system that contained the inodes.) This strange behavior needs to be allowed for backwards compatibility, but, given the wide variety of file systems in use today, it no longer makes sense to require implementations to disallow long format output. It should be possible for implementations to just treat -f as a sorting option specifying that filenames are listed in the order in which they appear in the directory. At least one implementation (Mac OS X version 10.6.7) incorrectly handles the interaction between the -1 (one) option and the -g, -l (ell), -n, and -o options. The description of the -l (ell) option ends by saying "When -l (ell) is specified, -1 (one) shall be assumed." This should be interpreted to mean that -1 (one) forces one file per line of output (disabling -C, -m, and -x), not that if -1 (one) is given after -g, -l (ell), -n, or -o that long format output (including the mode, number of links, owner [unless -g is given], group [unless -o is given], size, and date) should not be written. To fix these issues, make the following changes (this is a replacement for the change listed in the Desired Action section above). Editor's note: In the rest of this discussion <X> starts XSI shading and </X> stops XSI shading. Change the SYNOPSIS on P2864, L93719 from: XSI ls [−ACFRSacdfiklmnpqrstux1] [−H|−L] <X>[−go]</X> [file...] to: XSI ls [−ikqrs] [−<X>g</X>ln<X>o</X>] [-A|-a] [-C|-m|-x|-1] \ [-F|-p] [−H|−L] [-R|-d] [-S|-f|-t] [-c|-u] [file...] Add to the end of the description of the -C option on P2864, L93751: This option disables long format output. Add to the end of the description of the -R option on P2865, L93768: The use of −R with −d or -f produces unspecified results. Change: with -R produces unspecified results in the description of -d on P2865, L93778 to: with -R or -f produces unspecified results Change the last sentence of the -f option description on P2865, L93780-93781: This option shall turn off −l, −t, −S, −s, and −r, and shall turn on −a. to: This option shall turn on -a. When -f is specified, any occurrences of the -r, -S, and -t options shall be ignored and any occurrences of the -A, <X>-g</X>, -l, -n, <X>-o</X> and -s options may be ignored. The use of -f with -R or -d produces unspecified results. Change the -g option description on P2865, L93782 from: The same as -l, except that the owner shall not be written. to: Turn on the -l (ell) option, but disable writing the file's owner name or number. Disable the -C, -m, and -x options. keeping XSI shading on the entire description of this option. Change the last sentence of the -l (ell) option description on P2865, L93788-93789 from: When −l (ell) is specified, −1 (one) shall be assumed. to: Disable the -C, -m, and -x options. Add to the end of the description of the -m option on P2865, L93790: This option disables long format output. Change -n option description on P2865, L93791-93792 from: The same as −l, except that the owner’s UID and GID numbers shall be written, rather than the associated character strings. to: Turn on the -l (ell) option, but when writing the file's owner or group, write the file's numeric UID or GID rather than the user or group name, respectively. Disable the -C, -m, and -x options. Change -o option description on P2865, L93793 from: The same as -l, except that the group shall not be written. to: Turn on the -l (ell) option, but disable writing the file's group name or number. Disable the -C, -m, and -x options. keeping XSI shading on the entire description of this option. Add to the end of the -1 (one) option description on P2866, L93812: This option does not disable long format output. (Long format output is enabled by <X>-g</X>, -l (ell), -n, and <X>-o</X>; and disabled by -C, -m, and -x.) Add to the end of the description of the -x option on P2866, L93811: This option disables long format output. Change the text on P2866, L93813-93815 from: Specifying more than one of the options in the following mutually-exclusive pairs shall not be considered an error: −C and −l (ell), −m and −l (ell), −x and −l (ell), −C and −1 (one), −H and −L, −c and −u, −t and −S. The last option specified in each pair shall determine the output format. to: If an option that enables long format output (<X>-g</X>, -l (ell), -n, and <X>-o</X>) is given with an option that disables long format output (-C, -m, and -x), this shall not be considered an error. The last of these options specified shall determine whether long format output is written. If -R, -d, or -f are specified, the results of specifying these mutually-exclusive options are specified by the descriptions of these options above. If more than one of any of the other options shown in the SYNOPSIS section in mutually-exclusive sets are given, this shall not be considered an error; the last option specified in each set shall determine the output. Note that if -t is specified, -c and -u are not only mutually-exclusive with each other, they are also mutually-exclusive with -S when determining sort order. But even if -S is specified after all occurrences of -c, -t, and -u, the last use of -c or -u determines the timestamp printed when producing long format output. Change the rationale on P2871, L94022-94027 from: Generally, this volume of POSIX.1-2008 is silent about what Generally, this volume of POSIX.1-2008 is silent about what happens when options are given multiple times. In the cases of −C, −l, and −1, however, it does specify the results of these overlapping options. Since ls is one of the most aliased commands, it is important that the implementation perform intuitively. For example, if the alias were: alias ls="ls −C" and the user typed ls −1 (one), single-text-column output should result, not an error. to: This volume of POSIX.1-201x is frequently silent about what happens when mutually-exclusive options are specified. Except for -R, -d, and -f, the ls utility is required to accept multiple options from each mutually-exclusive option set without treating them as errors and to use the behavior specified by the last option given in each mutually-exclusive set. Since ls is one of the most aliased commands, it is important that the implementation perform intuitively. For example, if the alias were: alias ls="ls −C" and the user typed ls −1 (one), single-text-column output should result, not an error. The -g, -l (ell), -n and -o options are not mutually-exclusive options. They all enable long format output. They work together to determine whether the file's owner is written (no if -g is present), file's group is written (no if -o is present), and if the file's group or owner is written whether it is written as the name (default) or a string representation of the UID or GID number (if -n is present). The -C, -m, -x, and -1 (one) are mutually-exclusive options and the first three of these disable long format output. The -1 (one) option does not directly change whether or not long format output is enabled, but by overriding -C, -m, and -x, it can re-enable long format output that had been disabled by one of these options. Change the FUTURE DIRECTIONS section on P2872, L94057 from: None. to: Allowing -f to ignore the -A, -g, -l, -n, -o, and -s options may be removed in a future version. |
|
Interpretation response ------------------------ The standard is unclear on this issue, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor. Rationale: ------------- "When -l (ell) is specified, -1 (one) shall be assumed." is unclear Notes to the Editor (not part of this interpretation): ------------------------------------------------------- Please refer to 0000424:0000783 for suggested corrective text. |
|
Interpretation proposed 10 August 2011 for final 30 day review |
|
Interpretation approved 12 Sept 2011 |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-05-08 18:00 | Don Cragun | New Issue | |
2011-05-08 18:00 | Don Cragun | Status | New => Under Review |
2011-05-08 18:00 | Don Cragun | Assigned To | => ajosey |
2011-05-08 18:00 | Don Cragun | Name | => Don |
2011-05-08 18:00 | Don Cragun | Organization | => Self |
2011-05-08 18:00 | Don Cragun | User Reference | => ls mutually exclusive options list |
2011-05-08 18:00 | Don Cragun | Section | => ls |
2011-05-08 18:00 | Don Cragun | Page Number | => 2866 |
2011-05-08 18:00 | Don Cragun | Line Number | => 93814 |
2011-05-08 18:00 | Don Cragun | Interp Status | => --- |
2011-05-14 16:05 | Don Cragun | Note Added: 0000783 | |
2011-05-14 16:07 | Don Cragun | Note Edited: 0000783 | |
2011-05-19 18:19 | Don Cragun | Note Edited: 0000783 | |
2011-05-19 18:21 | Don Cragun | Note Edited: 0000783 | |
2011-05-19 18:22 | Don Cragun | Note Edited: 0000783 | |
2011-06-09 15:24 | msbrown | Tag Attached: issue8 | |
2011-06-09 15:25 | msbrown | Note Added: 0000805 | |
2011-06-09 15:25 | msbrown | Resolution | Open => Future Enhancement |
2011-06-23 15:54 | msbrown | Note Edited: 0000805 | |
2011-06-23 15:55 | msbrown | Tag Attached: tc1-2008 | |
2011-06-23 15:55 | msbrown | Tag Detached: issue8 | |
2011-06-23 15:56 | msbrown | Interp Status | --- => Pending |
2011-06-23 15:56 | msbrown | Final Accepted Text | => 0000424:0000805 |
2011-06-23 15:56 | msbrown | Status | Under Review => Interpretation Required |
2011-06-23 15:56 | msbrown | Resolution | Future Enhancement => Accepted As Marked |
2011-07-15 11:14 | geoffclare | Relationship added | related to 0000476 |
2011-08-10 15:24 | ajosey | Interp Status | Pending => Proposed |
2011-08-10 15:24 | ajosey | Note Added: 0000932 | |
2011-09-12 15:23 | ajosey | Interp Status | Proposed => Approved |
2011-09-12 15:23 | ajosey | Note Added: 0000964 | |
2013-04-16 13:06 | ajosey | Status | Interpretation Required => Closed |