Subject: problems rebuilding current
To: current-users@netbsd.org <current-users@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 01/11/2002 13:36:06
When I rebuild current as an unpriveleged user (with UNPRIVED defined)
the build fails:

install ===> sys/ufs/ext2fs
install ===> sys/uvm
(cd /usr/bsd-current/src/share/man && \
	/usr/bsd-current/obj/tools/tools.NetBSD-1.5.2-i386/bin/nbmake makedb)
/usr/bsd-current/obj/tools/tools.NetBSD-1.5.2-i386/bin/nbmakewhatis \
	/usr/bsd-current/dest/usr/share/man
nbmakewhatis: whatis.db: Permission denied
*** Error code 1  

Stop.
nbmake: stopped in /usr/bsd-current/src/share/man

The problem seems to be in src/libexec/makewhatis.c which creates
whaitis.db
using:

        if ((out = fopen(whatisdb, "w")) == NULL)
                errx(EXIT_FAILURE, "%s: %s", whatisdb, strerror(errno));

        if (!(dumpwhatis(out, dest) ||
            (fclose(out) < 0)) ||
            (chmod(whatisdb, S_IRUSR|S_IRGRP|S_IROTH) < 0))
                errx(EXIT_FAILURE, "%s: %s", whatisdb, strerror(errno));

Which isn't re-executable for non-root users.
Dunno the best fix, obvious options are:

1) change makewhatis to leave the file with owner write access

2) change makewhatis to explicetely delete (maybe chmod) the old file
   before trying to open it.

3) change the makefile to chmod u+w the file before running makewhatis

Any idea the on best fix?

	David