Subject: Re: the first "big" near show-stopper for pkgsrc support on older systems...
To: Alistair Crooks <agc@wasabisystems.com>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 05/04/2002 13:02:08
[ On Saturday, May 4, 2002 at 07:57:46 (+0200), Alistair Crooks wrote: ]
> Subject: Re: the first "big" near show-stopper for pkgsrc support on older systems...
>
> What is the problem, exactly?

Well, there are many....  :-)

Let's start with the first mundane thing that struck me:  Its release is
created without the version-ID in the directory.  Better instructions
for creating releases would be to use the following commands:

	ds=$(date '+%Y%m%d')
	pax -wz -s "|^user|user-$ds|" -f /distdir/user-$ds.tar.gz user

The release should probably also be tagged in the NetBSD repo, though I
suppose it doesn't get daily changes very often.  However having the
history of the tags might be, making it easier to do diffs, etc....

There's also a less mundane problem with the way it's used in pkgsrc.
In theory it should be done exactly as pkgtools/pkg_install.  There's
likely going to be a day when a base release version needs to be updated
to support pkgsrc for one reason or another.  However there are
complications if full compatability is intended with foreign
implementations on non-NetBSD systems.

> user(8) is based on the addnerd package, which has been around in
> pkgsrc since we found we had to add users.  The interface to user(8)
> is based on the SVR4 useradd(1m) commands.

Yes, this I know....

> If it's not portable to
> other systems, I'd like to use a compatible piece of machinery to
> use the native user management programs (this is being done on
> Darwin, for example).

The fact there are compatible tools in SVR4 and similar mitigates the
portability requirements somewhat for the pkgsrc code....

>  If it's not portable to older systems, I'd
> like to know why not, so that we can fix it, rather than ignoring
> the problem.

A full autoconf/automake wrapping to make it portable to many systems
old and new would entail significant work.  The code uses lots of
4.4BSD-only APIs.  Re-writing to be strictly P1003.1 compatible would
help a lot.

Minimal changes to support older NetBSD systems will require avoiding
all recent features in the NetBSD libc:

$ uname -srm
NetBSD 1.3.2 sparc
$ make
===> Building for user-20000509
cc -O -pipe  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith  -DEXTENSIONS -c user.c
cc1: warnings being treated as errors
user.c: In function `modify_gid':
user.c:385: warning: implicit declaration of function `strlcpy'
user.c: In function `read_defaults':
user.c:552: warning: implicit declaration of function `fparseln'
user.c:552: warning: assignment makes pointer from integer without a cast
user.c: In function `moduser':
user.c:783: warning: `expire' might be used uninitialized in this function
user.c:794: warning: `gid' might be used uninitialized in this function
*** Error code 1

Stop.


I can go deeper and file a full PR if you'd like....  I didn't want to
go any further initially before I'd found out what the goals were and
how pkgsrc was expected to integrate it.

-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>