archivemount icon indicating copy to clipboard operation
archivemount copied to clipboard

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

Open rd235 opened this issue 3 years ago • 0 comments

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 );

rd235 avatar Dec 31 '21 11:12 rd235