Page MenuHomeFreeBSD

packages: fix ownership of /tmp and /dev
ClosedPublic

Authored by ivy on Jun 1 2025, 4:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 3, 4:59 PM
Unknown Object (File)
Sep 15 2025, 2:04 AM
Unknown Object (File)
Sep 10 2025, 4:27 PM
Unknown Object (File)
Sep 3 2025, 7:23 PM
Unknown Object (File)
Sep 2 2025, 2:40 AM
Unknown Object (File)
Sep 1 2025, 9:55 PM
Unknown Object (File)
Sep 1 2025, 6:34 AM
Unknown Object (File)
Aug 31 2025, 7:56 AM

Details

Summary

release/packages/runtime.ucl manually adds "/tmp" and "/dev" to the
"directories" key, which causes them to be included in the manifest
with the user/group owner of whoever built the package repository:

drwxr-xr-x 7 ivy wheel 512 Jun 1 17:24 /dev/
drwxrwxrwt 10 ivy wheel 10 Jun 1 17:42 /tmp/

Remove the manual entries and instead put an explicit package tag
in etc/mtree/BSD.root.dist. This also means /tmp gets the right
mode by default and we can remove the chmod from the post-install
script.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ivy requested review of this revision.Jun 1 2025, 4:53 PM
manu added inline comments.
etc/mtree/BSD.root.dist
7

Should it be set here ? Doesn't that affect other path that weren't in runtime ?

I think this is the only use of directories in pkgbase and as a side effect could address the last instance of pkgbase nonreproducibility - see https://github.com/freebsd/pkg/issues/2427 and https://tests.reproducible-builds.org/freebsd/dbd/repo/FreeBSD:15:amd64/current/FreeBSD-runtime-current.pkg.html

etc/mtree/BSD.root.dist
7

it does, but i think this is right, in that everything which is in mtree should be in a package. perhaps some of the other directories need explicit package= tags though.

etc/mtree/BSD.root.dist
7

This doesn't look right to me. Do you really want all the various bits of /boot being runtime, for example? I doubt you want /boot/kernel to even exist if you don't install a kernel (isn't that meant to be a symlink in pkgbase anyway?).

let's just do this for /tmp and /dev instead of everything

etc/mtree/BSD.root.dist
7

yes, that's true; i've changed it to only include /tmp and /dev, which should be in runtime, and this still fixes the original issue.

manu added inline comments.
etc/mtree/BSD.root.dist
7

Thanks, this looks safer to me ;)

This revision is now accepted and ready to land.Jun 3 2025, 5:38 AM

This should address the remaining pkgbase nonreproducibility issue as a side effect https://github.com/freebsd/pkg/issues/2427

This revision was automatically updated to reflect the committed changes.