*BSD News Article 88431


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!lucy.swin.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!howland.erols.net!math.ohio-state.edu!news.cis.ohio-state.edu!nntp.sei.cmu.edu!fs7.ece.cmu.edu!cantaloupe.srv.cs.cmu.edu!moore.fac.cs.cmu.edu!moore
From: moore+@moore.fac.cs.cmu.edu (Dale Moore)
Newsgroups: comp.unix.bsd.netbsd.misc
Subject: NetBSD 1.2 /usr/bin/ar and large uid's
Date: 6 Feb 1997 18:29:10 GMT
Organization: Carnegie Mellon University
Lines: 39
Message-ID: <5dd7tm$8c9@cantaloupe.srv.cs.cmu.edu>
NNTP-Posting-Host: moore.fac.cs.cmu.edu
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.netbsd.misc:5310


Short Version:

	/usr/bin/ar barfs on UID's > 999,999

Long Version:

The format for archive files on Digital Unix is described in
the include file
	/usr/include/ar.h

Inside the archive file are a collection of ".o" files.
The archive format allows for storing the name, owner,
and group of the original ".o" file.  It stores the uid 
as a 6 character ascii decimal representation.  The
gid is handled in a similar fashion.

I suspect that the program "/usr/bin/ar" writes the file by
doing something like
	printf("%-6u", uid);
Unfortunately, the control characters "%-6u" specifies that
the resulting string must be at least 6 characters long, perhaps
longer.  It is this perhaps longer that I suspect tends to screw
things up.  When the UID is greater than 999,999 we overflow
the 6 character array allocated to hold the uid field.  This causes
subsequent output data to be offset by one or more bytes.

I would send this directly to a NetBSD software bug reporting
center, or software quality assurance center, but
I don't have a net address. If you could supply one
I would appreciate it.

As a workaround, I've built a private version based on the
NetBSD1.2 sources.

Dale Moore
Senior Research Systems Programmer
School of Computer Science
Carnegie Mellon University