tech-pkg archive

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

Re: install and metalog



> Date: Mon, 23 Nov 2026 10:59:54 -0500
> From: Greg Troxel <gdt%lexort.com@localhost>
> 
> I have known for a long time -- perhaps incorrectly -- that during the
> install stage, the install program is called with -M and a metalog and
> that pkg_create then reads that, so that an unpriv package build that
> e.g. installs a mode 4755 user=root file ends up with that in the
> package.  Just like in NetBSD base.
> 
> I have just looked in pkgsrc mk/ and pkgtools/cwrappers, perhaps not
> well enough, and I can't find this.
> 
> So:
> 
>   Am I right that the package install phase uses metalog, in a way that
>   works with random upstream install invocations?
> 
>   Where is the code that make this work?

What you described generally applies to the NetBSD base system build
process, but I don't think it has ever applied to pkgsrc.  I don't
think there's any logic in pkg_create to handle metalog/mtree.

There is logic in pkg_create to set:

- the default user/group of all nfiles via -u/-g options,
- user/group of specific files with plist @owner/@group directives,
- modes of specific files with plist @mode directives.

>   If I'm wrong, how does 'make package' as non-root end up with a
>   correct package?  Do we really have to set SPECIAL_PERMS on every
>   file that isn't supposed to be root/wheel, or is supposed to have any
>   mode bits other than ugo?

I think that is correct.  There is also NOT_FOR_UNPRIVILEGED for
builds that simply don't work unprivileged.  (It is a boolean yes/no
but I think maybe it should be a string instead to explain why, so
it's easier for the next person to come along and fix it.)

Is there a particular package or issue you are trying to make work
that prompted this question?


Home | Main Index | Thread Index | Old Index