kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
527 stars 239 forks source link

--rootdir does not copy xattrs from the root directory #688

Closed DaanDeMeyer closed 8 months ago

DaanDeMeyer commented 9 months ago

After booting into an filesystem generated with btrfs-progs --rootdir:

[root@fedora ~]# getfattr -dm- /usr
getfattr: Removing leading '/' from absolute path names
# file: usr
security.selinux="system_u:object_r:usr_t:s0"

[root@fedora ~]# getfattr -dm- /

It seems as if the traverse_directory() simply does not call add_xattr_item() for the root directory so the root directory does not have any of its xattrs in the generated filesystem.

adam900710 commented 9 months ago

Indeed, the root directory needs one dedicated call for the xattr items.

Would fix it soon.

DaanDeMeyer commented 9 months ago

@adam900710 I haven't checked but is the permissions mode from the source directory applied correctly? I figure if the xattr's aren't handled correctly, the permissions might not be handled correctly either.

adam900710 commented 9 months ago

Right, I'll take a deeper look into what's missing for the rootdir.

DaanDeMeyer commented 8 months ago

@adam900710 Any chance you could take a stab at https://github.com/kdave/btrfs-progs/issues/42 as well? Having a --subvol option to indicate that certain directories in the user provided root directory should become subvolumes in the generated filesystem would make mkfs.btrfs much more useful.

adam900710 commented 8 months ago

Sure, it looks simple enough.

kdave commented 8 months ago

Xattrs for rootdir are fixed in devel. Regarding the --subvol and #42, we'll continue there.