Page MenuHomeFreeBSD

nanobsd: Change the mode in tgt_dir2symlink()
Needs ReviewPublic

Authored by jlduran on Feb 7 2026, 7:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 4, 2:54 PM
Unknown Object (File)
Thu, Jun 4, 2:54 PM
Unknown Object (File)
Thu, May 28, 9:33 PM
Unknown Object (File)
Thu, May 28, 7:53 AM
Unknown Object (File)
Wed, May 27, 3:14 AM
Unknown Object (File)
May 14 2026, 1:28 AM
Unknown Object (File)
May 14 2026, 1:27 AM
Unknown Object (File)
May 13 2026, 5:27 PM
Subscribers
None

Details

Summary

Actually change the directory's mode. While it is enforced in the final
image via the METALOG, the directory under $NANO_WORLDDIR should also be
updated.

This is especially important when using $NANO_WORLDDIR as the mountpoint
for a null-mounted poudriere jail, since var/tmp must be world-writable
for poudriere bulk to succeed.

Fixes: 6eccd84bee75 ("nanobsd: Make tgt_dir2symlink() take a mode")

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jlduran created this revision.

I had more time to test this change. I might change it to:

chmod "$mode" "$dir" && chmod -h "$mode" "$dir"

because it produces the "right" mtree, so that when it is a symbolic link, it takes the mode of the symbolic link itself and not the target (that is why I'm inclined to also add chmod -h so both, the target directory and the symlink have the desired mode).

This seems to be necessary as chmod on symlink directory updates the source directory not the symlink one.
But do we need to do chmod "$mode" "$dir"?
The goal of tgt_dir2symlink is to set up the mode of the symlink directory and if we just do chmod -h "$mode" "$dir" will change the mode of the symlink.