Subject: Re: pkg_add bugs & a missing feature
To: None <>
From: Alan Barrett <>
List: tech-pkg
Date: 12/11/2003 17:57:51
On Wed, 10 Dec 2003, David Young wrote:
> Alan mentions a bug #2 in a private e-mail: pkg_add does not put
> the right ownership & permissions on the directories it installs.
> I'm trying to get more information about that.

I sent details in private mail.  Essentially, empty directories that
exist in the *.tgz file, and that are mentioned in @dirrm lines in
the +CONTENTS file embedded in the tgz, are not created by pkg_add.
Non-empty directories are created almost by accident, as a side-effect
of creating files, with no attention being paid to their ownership or

To fix this, I think pkg_add should parse @dirrm lines, and create each
listed directory with the ownership and permissions described in the
ustar headers in the *.tgz file.  Alternatively, we could pass "@option
extract-in-place" to pkg_add, in which case the tar process should
just DTRT with empty directories that exist in the *.tgz file.  As yet
another alternative, I suppose we could decree that pkg_add's existing
behaviour is correct, but pkg_create needs to put lines like "@exec
mkdir foo ; chown user:group foo ; chmod 666 foo" into the +CONTENTS

> Call the missing feature bug #3: you cannot do an unprivileged pkg_add
> which writes a metalog, a la install -M.

Similarly, pkg_create does not take a -M arg to read a metalog.  If it
did, then my patches in PR 22514 could have been simpler.

If somebody taught the pkg_* tools to use pax instead of tar, it would
then become easier to make them read/write a metalog file, and easier
to make them usable as part of a cross build.  Oh, we'd probably also
have to teach pax to *write* a metalog file; I think it can only read
metalogs at present.

--apb (Alan Barrett)