Subject: Re: negative user-ids and interoperability.
To: Giles Lean <giles@nemeton.com.au>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 04/26/1999 23:19:16
Giles Lean wrote:

> Then I think I recall that some of the archive formats (cpio?) have
> restrictions on user ids.  The HP-UX manual page claims that user ids
> greater than 60K are restored as the current user id because of this.
> The UNIX 98 cpio(1) manual page doesn't mention user ids.
> 
> While I've never seen a document describing the cpio archive format
> just about everything in cpio is a 16 bit quantity, so I assume that
> "60K" here is 2^16-1.  Of course, cpio is pretty much dead and
> deprecated in UNIX 98.

In "portable archive format" (ASCII data), from Ultrix's <cpio.h>:

	char	c_magic[6],
		c_dev[6],
		c_ino[6],
		c_mode[6],
		c_uid[6],
		...

and these are stored in octal.  So nobody (-2) on an Ultrix cpio archive
is represented as "177776" - (2^16)-2.  "cpio -ivt < foo" on a NetBSD
system shows userid of 65534 - interoperability at it's finest :-)
Same result for a "native" cpio achive on a machine with the same
endianess as the generating machine...

> What a mess.  Maybe "nobody" in /etc/passwd isn't such a bad idea.

I'm starting to think so...

Simon.