Page MenuHomeFreeBSD

tarfs: Support tar files which include file modes with permissions.
ClosedPublic

Authored by des on Mar 10 2023, 5:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 10:24 PM
Unknown Object (File)
Oct 2 2024, 4:19 PM
Unknown Object (File)
Oct 2 2024, 12:59 PM
Unknown Object (File)
Oct 2 2024, 8:30 AM
Unknown Object (File)
Sep 28 2024, 2:57 AM
Unknown Object (File)
Sep 26 2024, 12:12 AM
Unknown Object (File)
Sep 18 2024, 2:22 AM
Unknown Object (File)
Sep 8 2024, 11:48 PM
Subscribers

Details

Summary

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.

Diff Detail

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

Event Timeline

des requested review of this revision.Mar 10 2023, 5:50 PM
kib added inline comments.
sys/fs/tarfs/tarfs_vfsops.c
518
This revision is now accepted and ready to land.Mar 11 2023, 11:03 PM
sys/fs/tarfs/tarfs_vfsops.c
521

I'm still not sure what the intention is to just make it user-readable.
It has long been the behavior of tar to just ignore the flags it doesn't recognize. If the permission bits are valid, then why not use them? Additional flags would be augmentations outside of the permissions.

I think you should just be able to do:

        if (num & ~ALLPERMS != 0) {
		TARFS_DPF(ALLOC, "%s: invalid file mode at %zu\n",
		    __func__, TARFS_BLOCKSIZE * (blknum - 1));
        }
        mode = num & ALLPERMS;
sys/fs/tarfs/tarfs_vfsops.c
521

Also, it would be good in the log message to print the mode value that you did get.

sys/fs/tarfs/tarfs_vfsops.c
521

It is extra annoying when untarring results in weird permissions. Having it auto-corrected at least for tarfs so that root is not needed to read weird archives is only good IMO.

sys/fs/tarfs/tarfs_vfsops.c
521

I'd argue that you shouldn't be mounting “weird archives” and if you do (which requires root privileges) and get unexpected results you can simply inspect the tar file using... tar.

sys/fs/tarfs/tarfs_vfsops.c
521

I agree; forcing just S_IRUSR is useless.
masking perms makes far more sense.