Subject: mail/qmail-qfilter is deleting /var/tmp on pkg_delete
To: None <tech-pkg@netbsd.org>
From: Nathan Arthur <truist@truist.com>
List: tech-pkg
Date: 10/22/2006 20:42:43
I have been using pkgsrc's bulk build scripts to do bulk rebuilds of all 
the packages I use on my NetBSD 3.0 machine.  I don't build all packages 
- just the subset that I need.  I do the builds in a chroot sandbox (via 
mk/bulk/mksandbox) and I've discovered a problem where the build of the 
qmail-qfilter package is deleting the sandbox's /var/tmp directory 
(which then causes later package builds the fail).  Per the email thread 
below, it seems to be deleted during pkg_delete because of something to 
do with OWN_DIRS_PERMS.  I've dug as far as I can into the scripts to 
try to understand what's going wrong, and I don't know enough to go 
further.  Amitai (below) suggested that I ask this list.  (Thanks, 
Amitai!)  Any ideas?

This only seems to happen if /var/tmp is empty at the time that 
qmail-qfilter is pkg_delete'd, which explains why this doesn't show up 
for regular package builds.   It also doesn't seem to be affecting the 
regular netbsd bulk rebuilds, presumably because there is something in 
/var/tmp at the time that this happens. 

I can happily give more detail about the process here, but I think all 
the salient details are above and below.  For now, I've worked around 
this by just putting a file in /var/tmp, but it seems like an issue that 
should probably be fixed.

Thanks,

Nathan


-------- Original Message --------
Subject: 	Re: You broke my bulk build!
Date: 	Sun, 22 Oct 2006 19:29:40 -0400 (EDT)
From: 	Amitai Schlair <schmonz@schmonz.com>
To: 	Nathan Arthur <truist@truist.com>
References: 	<453BED63.4090205@truist.com>



Nathan Arthur wrote:

> 1) Create the sandbox (which creates an appropriate /var/tmp)
> 2) chroot into it
> 3) Manually build qmail-qfilter, into a package
> 4) Install the qmail-qfilter package
> 5) At this point, /var/tmp is still there, and has an empty
> qmail-qfilter directory in it.
> 6) pkg_delete qmail-qfilter
> 7) /var/tmp is gone!

Wacky. At a glance, that shouldn't happen. The relevant line of
pkgsrc/mail/qmail-qfilter/Makefile is:

    OWN_DIRS_PERMS+=	${QMAIL_QFILTER_TMPDIR} qmaild ${ROOT_GROUP} 700

And the relevant lines in pkgsrc/mk/defaults/mk.conf are:

    QMAIL_QFILTER_TMPDIR?= ${VARBASE}/tmp/qmail-qfilter
    # The temporary directory for qmail-qfilter.
    # Possible: a directory writable only by qmail-qfilter's UID
    # Default: ${VARBASE}/tmp/qmail-qfilter

OWN_DIRS is handled somewhere in pkgsrc/mk/install or pkgsrc/mk/pkginstall (I
forget which), which are standard shell scripts that get executed by pkg_add
and pkg_delete. What's supposed to happen is, package defines OWN_DIRS, it
gets created at install time, if it's empty at deinstall time it's removed
(there's a related variable that instead instructs the user to remove it). So
it sounds like this logic is pruning empty directories a little too earnestly
up the filesystem.

If you can find where it happens, I bet it gets fixed fast. :-)  Or if you'd
rather not, I'm sure someone on tech-pkg can find it fast.