cpio - segmentation violation

Patrick Place prp at sei.cmu.edu
Mon Jun 19 08:02:29 AEST 1989


In article <10406 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
> In article <1120 at servax0.essex.ac.uk> peter at essex.ac.uk	 (Allott P) writes:
> >The problem is that some users have files on their areas with a uid of -2.
> 
> That NFS-induced modification to the concept of UID has caused numerous
> problems.  AT&T UIDs are unsigned (i.e. nonnegative) integers, and AT&T
> UNIX software relies on this.  (So did some BSD software.)  The whole
> issue of NFS ID mapping has been a real mess.


It is not so much a matter of having negative uids (which I admit is
unusual) as that on Suns for example,
	printf("%.6ho", -2)
will print a 10 character wide representation of -2, rather than
the requested 6 character representation.  I had exactly this problem
and fixed it by casting the offending value to a halfword, having
masked off all but the last 16 bits.  It seemed to work and allowed
me once again to read (and write) cpio archives.  I will grant that
the fix is not pretty, but I could not come up with any other way to
make printf print out a 6 character wide value.  To be fair, if I
recall my reading of the Sun manual page for printf, it doesn't
guarantee that it will limit the output to 6 characters, merely that
it will use 6 characters (ie pad if necessary).

Pat Place



More information about the Comp.bugs.4bsd.ucb-fixes mailing list