coreutils: Disambiguating names and IDs

1 
1 2.6 chown, chgrp, chroot, id: Disambiguating user names and IDs
1 ===============================================================
1 
1 Since the USER and GROUP arguments to these commands may be specified as
1 names or numeric IDs, there is an apparent ambiguity.  What if a user or
1 group _name_ is a string of digits?  (1) Should the command interpret it
1 as a user name or as an ID?  POSIX requires that these commands first
1 attempt to resolve the specified string as a name, and only once that
1 fails, then try to interpret it as an ID.  This is troublesome when you
1 want to specify a numeric ID, say 42, and it must work even in a
1 pathological situation where ‘42’ is a user name that maps to some other
1 user ID, say 1000.  Simply invoking ‘chown 42 F’, will set ‘F’s owner ID
1 to 1000—not what you intended.
1 
1    GNU ‘chown’, ‘chgrp’, ‘chroot’, and ‘id’ provide a way to work around
1 this, that at the same time may result in a significant performance
1 improvement by eliminating a database look-up.  Simply precede each
1 numeric user ID and/or group ID with a ‘+’, in order to force its
1 interpretation as an integer:
1 
1      chown +42 F
1      chgrp +$numeric_group_id another-file
1      chown +0:+0 /
1 
1    The name look-up process is skipped for each ‘+’-prefixed string,
1 because a string containing ‘+’ is never a valid user or group name.
1 This syntax is accepted on most common Unix systems, but not on Solaris
1 10.
1 
1    ---------- Footnotes ----------
1 
1    (1) Using a number as a user name is common in some environments.
1