2014/12/19: @owner and @group in plist

The package list of a FreeBSD port can, among other things, contain the keyword @owner and @group. They specify the (default) owner or group, respectively, for the following files (without argument they reset the default to root or wheel, respectively).

This is flexible and has various advantages. However, if the specification is wrong, things get installed with the wrong owner thus making setuid bits not working as intended. Moreover, this cannot be easily fixed without touching the port itself—quite opposed to my habit of locally anticipating fixes to be committed without decoupling myself from the upstream port (EXTRA_PATCHES are a great way to do so).

To continue with my usual habit, I extended my port upgrade scripts (background) to allow a port to request that ownerships be taken from the stage directory rather than from the package list. This simply means that after installing (before cleaning) we walk through the stage directory and compare owner/group of every file with the corresponding installed one, fixing if necessary. To ask for such a (hopefully temporary) work around, a port just sets PU_FIX_OWNERS to a non-empty value. This is done, as usual, by a conditional statement in the Makefile in my local patches, which, in turn, is included via /etc/make.conf.