tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

OWN_DIRS prunes /var/tmp (PR 35340)



Reposting to tech-pkg in the hopes of attracting attention from people
who know about this stuff.

(The original problem was that one of the qmail packages created an
OWN_DIRS under /var/tmp, and then removing the package caused /var/tmp
to disappear.)

   ------

From: David Holland <dholland-pbugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/35340 (pkgsrc OWN_DIRS bug where empty directories are
 pruned too earnestly)
Date: Sun, 9 Aug 2015 23:14:57 +0000

On Sun, Aug 09, 2015 at 10:55:56PM +0000, dholland%NetBSD.org@localhost wrote:
 > I can replicate this with a simple test package.

The problem is not that the wrong things are listed at the end of
+DIRS; the problem is that +DIRS uses rmdir -p to remove dirs, so that
any empty ancestor directories are pruned regardless of whether pkgsrc
owns them or not.

This could be changed; however, because +DIRS also uses mkdir -p, this
may cause intermediate dirs created by pkgsrc to get left around.

I note that +DIRS sets MKDIR to mkdir -p, and then uses ${MKDIR} -p in
places, suggesting that this may not have been originally intended.

It seems to me that the right fix is to not use either rmdir -p or
mkdir -p, and to fix packages that don't explicitly create ancestor
directories. (That is, if you have
   OWN_DIRS_PERMS+=	/var/thingy/boojum root wheel 755
   OWN_DIRS_PERMS+=	/var/thingy/snark  root wheel 755
without an explicit entry for /var/thingy, nothing will create
/var/thingy and installation of the binary package will fail.)
This is probably a good thing, at least for OWN_DIRS, as the
permissions on directories created by mkdir -p depend on the umask and
maybe other things and aren't necessarily as repeatable as we'd like.

However, this introduces two other issues: (a) where do we stop (do we
need OWN_DIRS for /var? surely not; but what about e.g. /var/db, which
probably doesn't exist on say Linux?) and (b) does mucking with the
+DIRS script affect other directory creation that we aren't prepared
to deal with or where using mkdir -p is necessary and appropriate? I
don't know...

btw, the replication example is to just add e.g.
   OWN_DIRS+=	/var/thingy/boojum root wheel 755
to something simple and install/deinstall. Currently creating
/var/thingy beforehand is not necessary, because it will be created by
mkdir -p.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index