On Fri, Jul 03, 2009 at 05:54:33PM +0000, Tim Kientzle wrote:
> Modified: head/usr.bin/cpio/cmdline.c
> --- head/usr.bin/cpio/cmdline.c Fri Jul 3 16:33:42 2009 (r195317)
> +++ head/usr.bin/cpio/cmdline.c Fri Jul 3 17:54:33 2009 (r195318)
> @@ -268,16 +268,36 @@ cpio_getopt(struct cpio *cpio)
> * Parse the argument to the -R or --owner flag.
> * The format is one of the following:
> - * <user> - Override user but not group
> - * <user>: - Override both, group is user's default group
> - * <user>:<group> - Override both
> - * :<group> - Override group but not user
> + * <username|uid> - Override user but not group
> + * <username>: - Override both, group is user's default group
> + * <uid>: - Override user but not group
> + * <username|uid>:<groupname|gid> - Override both
> + * :<groupname|gid> - Override group but not user
> + *
> + * Where uid/gid are decimal representations and groupname/username
> + * are names to be looked up in system database. Note that
> + * uid/gid parsing takes priority over username/groupname lookup,
> + * so this won't do a lookup for usernames or group names that
> + * consist entirely of digits.
Is this behavior specified somewhere? It is counter to the usual rule
that the system should attempt to resolve all strings as a name first.
For example, the following is from the chown manpage in POSIX.1-2008
If a numeric owner operand exists in the user database as a user
name, the user ID number associated with that user name shall be
used as the user ID.
Numeric usernames are a disaster, especially if they can't match the uid
for some reason, but following this rule consistently at least makes
things more sane if you're stuck with them.