Page MenuHomeFreeBSD

makefs: don't needlessly require directories to exist
ClosedPublic

Authored by brooks on Jan 12 2023, 12:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 6:46 PM
Unknown Object (File)
Sat, Nov 2, 2:04 AM
Unknown Object (File)
Oct 8 2024, 7:06 AM
Unknown Object (File)
Oct 8 2024, 7:06 AM
Unknown Object (File)
Oct 8 2024, 7:06 AM
Unknown Object (File)
Oct 8 2024, 7:06 AM
Unknown Object (File)
Oct 8 2024, 6:41 AM
Unknown Object (File)
Sep 27 2024, 1:10 PM
Subscribers

Details

Summary

If a type=dir entry exists and all contents are directories, files
added with contents=, or symlinks with link= attributes then it doesn't
need to exist. Just let openat fail in that case. It's concivable
this will make debugging some cases weird, but it's sufficent to handle
the way we add /root/.ssh in CheriBSD VM images.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 49069
Build 45958: arc lint + arc unit

Event Timeline

To trigger the problem, a test case might do something like

./root/.ssh type=dir
./root/.ssh/id_ed25519 type=file contents=/path/to/key

where ./root/.ssh doesn't exist?

usr.sbin/makefs/zfs/fs.c
304

Just return (openat(fd, path, flags));

This revision is now accepted and ready to land.Jan 12 2023, 2:30 AM
  • Simplify fs_open_can_fail
This revision now requires review to proceed.Jan 12 2023, 5:48 PM

To trigger the problem, a test case might do something like

./root/.ssh type=dir
./root/.ssh/id_ed25519 type=file contents=/path/to/key

where ./root/.ssh doesn't exist?

Yeah, that's the basic issue I ran into (in this case it was actually the authorized_keys file).

This revision was not accepted when it landed; it landed in state Needs Review.Jan 12 2023, 6:21 PM
This revision was automatically updated to reflect the committed changes.