tytso / e2fsprogs

Ext2/3/4 file system utilities
http://ext4.wiki.kernel.org
373 stars 219 forks source link

Add root_perms extended mke2fs option. #171

Closed chestnykh closed 4 months ago

chestnykh commented 9 months ago

This options allows user to specify custom root dir permissions at FS creation time. If no perms are specified then the root dir permissions would be set to default.

This is related to https://github.com/tytso/e2fsprogs/issues/168

@tytso could you review this please?

haarp commented 9 months ago

Hey, thanks for the PR! I'm not that good at C, so this isn't a review, but I did give it a test.

With this PR applied on top of e2fsprogs-1.47.0, I'm getting wrong permissions. The permission bits seem to be mangled.

# dd if=/dev/zero of=big bs=8M count=100
...
# mkfs.ext4 -E root_owner=1000:1000,root_perms=1777 big
...
# mount big /tmp/e/
# stat /tmp/e
...
Access: (0361/d-wxrw---x)  Uid: ( 1000/   haarp)   Gid: ( 1000/   haarp)
...
chestnykh commented 9 months ago

Hey, thanks for the PR! I'm not that good at C, so this isn't a review, but I did give it a test.

With this PR applied on top of e2fsprogs-1.47.0, I'm getting wrong permissions. The permission bits seem to be mangled.

# dd if=/dev/zero of=big bs=8M count=100
...
# mkfs.ext4 -E root_owner=1000:1000,root_perms=1777 big
...
# mount big /tmp/e/
# stat /tmp/e
...
Access: (0361/d-wxrw---x)  Uid: ( 1000/   haarp)   Gid: ( 1000/   haarp)
...

I've corrected the patch, could u please test again?

haarp commented 9 months ago

Now it's creating the correct permissions. Thanks!