Skip to content
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.

chown bug: when only owner or group is set, the other becomes -1 #10

Open
rd235 opened this issue Dec 31, 2021 · 0 comments
Open

chown bug: when only owner or group is set, the other becomes -1 #10

rd235 opened this issue Dec 31, 2021 · 0 comments

Comments

@rd235
Copy link

rd235 commented Dec 31, 2021

Here is a shell session showing the bug:

$ ls -l /tmp/mnt/file
-rw-r--r-- 0 renzo renzo 0 Dec 31 12:06 /tmp/mnt/file
$ chown root /tmp/mnt/file
$ ls -l /tmp/mnt/file
-rw-r--r-- 0 root nogroup 0 Dec 31 12:06 /tmp/mnt/file
$ chgrp root /tmp/mnt/file
$ ls -l /tmp/mnt/file
-rw-r--r-- 0 nobody root 0 Dec 31 12:06 /tmp/mnt/file

Fuse's chown callback uses the same policy of chown(2):
If the owner or group is specified as -1, then that ID is not changed.

My (untested) proposal for the fix is to change archivemount.c lines 2161-2162 as follows:
if (uid != ((uid_t) -1))
archive_entry_set_uid( node->entry, uid );
if (gid != ((gid_t) -1))
archive_entry_set_gid( node->entry, gid );

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant