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)
Jan 27 2024, 1:50 PM
Unknown Object (File)
Jan 14 2024, 7:23 AM
Unknown Object (File)
Dec 6 2023, 12:10 AM
Unknown Object (File)
Nov 16 2023, 7:02 PM
Unknown Object (File)
Oct 8 2023, 7:21 AM
Unknown Object (File)
Sep 13 2023, 3:05 PM
Unknown Object (File)
Jul 9 2023, 8:08 AM
Unknown Object (File)
Jul 1 2023, 8:12 AM
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.