Template Version: @(#)sac_nextcase %I% %G% SMI 1. Introduction 1.1. Project/Component Working Name: id utility option consolidation 1.2. Name of Document Author/Supplier: Author: Garrett D'Amore 1.3 Date of This Document: 01 November, 2006 1.4 Name of Major Document Customer(s)/Consumer(s) 1.4.1. The community this proposal comes from Garrett D'Amore 1.4.2. The ARC(s) you expect to review your project: PSARC 1.5. Email Aliases: 1.5.1. Responsible Manager: tim.sparlin@sun.com 1.5.2. Responsible Engineers: garrett_damore@tadpole.com Carol.Fields@sun.com 1.5.3. Marketing Manager: jeff.mcmeekin@sun.com 2. Project Summary Problem ------- POSIX specifies a number of useful features for the "id" utility which are lacking from the standard Solaris version. The most obvious and common case of this, is the "-u" flag, which prints the numeric uid of the caller on standard output. In order to work around this, many shell script writers wind up having to write scripts involving the use of other utilities, such as sed, cut or grep, to get the numeric user id. This also creates portability problems for 3rd party packages, that would like to just rely on reasonable POSIX behavior. The specific set of arguments that id(1M) lacks in the Sun version, but which POSIX specifies (and hence are in /usr/xpg4/bin/id) are: -u: print just the effective user id -g: print just the effective group id -G: print all different group ids -r: print the real ids instead of effective ids -n: print the names instead of the numeric ids The need for these options is well documented in Sun Bug IDs 4521640 and 4514779. Additionally, it would not be harmful if /usr/xpg4/bin/id inherited the -a flag, from the Sun version, reducing the differences between the Sun and POSIX versions. The -a flag prints all supplemental groups. This is very, very similar to the default POSIX behavior, except that when -a is printed, the current effective group is printed in the groups= list. Some sample output probably serves to illustate this better. In the following output, user garrett is listed in /etc/passwd with primary group 10 (staff), and is listed in the /etc/group membership for group 14 (sysadmin): % /usr/bin/id uid=1001(garrett) gid=10(staff) % /usr/bin/id -a uid=1001(garrett) gid=10(staff) groups=10(staff),14(sysadmin) % /usr/xpg4/bin/id uid=1001(garrett) gid=10(staff) groups=14(sysadmin) As a final note, the current Solaris option parser for id is broken in that it inconsistently allows certain illegal combinations of options. For example, id -p -u is permitted, whereas id -u -p is not. The behavior of either option is not defined by either the manual page or POSIX. Proposed Solution ----------------- We propose to add support for the -u, -g, -G, -n, and -r options to the standard /usr/bin/id utility, making them behave identically to the the POSIX version in /usr/xpg4/bin/id. Additionally, we propose to add the -a option to the version in /usr/xpg4/bin, which will change the default behavior to match precisely the output provided by /usr/bin/id when -a is provided. Finally, we propose to fix the parser, so that -a and -p options are not permitted when any of -u, -g, or -G are also specified, regardless of which one was specified first. The resulting /usr/bin/id and /usr/xpg4/bin/id will be 100% backwards compatible with the documented behavior of the versions we have been shipping for some time, and will add feature parity from POSIX to the standard /usr/bin/id utility. It will also remove one of the inconsistent and undocumented behaviors of the utility by fixing an option parser bug. As a result, the only difference remaining between the POSIX and Sun version will the fact that when none of -u, -g, -G, or -a are specified (i.e. the "default mode"), the POSIX version will list the additional supplemental groups where the legacy Sun version does not. The online manual page for id(1M) will need to be updated to reflect these changes. Binding ------- We are seeking patch binding for this change. Interface Taxonomy ------------------ The id(1M) man page did not list a stability level for /usr/bin/id and listed /usr/xpg4/bin/id as Standard. Both are now marked Committed. Interface Stability Level ---------------- --------------------------------------------------- /usr/bin/id: all options Committed /usr/xpg4/bin/id: -G, -g, -n, -r, Committed: IEEE Std 1003.2-1992 and later standards and -u options (see standards(5)) -a and -p options Committed 5. Reference Documents 1. updated id(1M) man page: materials/id.1M 2. related bug reports: 4514779: *id* /usr/bin/id should at least support '-u' 4521640: *id* /usr/bin/id missing options from /usr/xpg4/bin/id 6. Resources and Schedule 6.4. Steering Committee requested information 6.4.1. Consolidation C-team Name: ON 6.5. ARC review type: FastTrack