]> git.ipfire.org Git - thirdparty/git.git/commit - path.c
adjust_shared_perm(): leave g+s alone when the group does not matter
authorJunio C Hamano <gitster@pobox.com>
Fri, 28 Oct 2022 21:16:09 +0000 (14:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Oct 2022 21:55:27 +0000 (14:55 -0700)
commit671bbf7b9da70bad0307d616e7f6717a28300ffc
tree25cfe0afba2a23a7a8848b09d9ba041444bcef87
parent63bba4fdd86d80ef061c449daa97a981a9be0792
adjust_shared_perm(): leave g+s alone when the group does not matter

Julien Moutinho reports that in an environment where directory does
not have BSD group semantics and requires the g+s to be set (aka
FORCE_DIR_SET_GID), but the system forbids chmod() to touch the g+s
bit, adjust_shared_perm() fails even when the repository is for
private use with perm = 0600, because we unconditionally try to set
the g+s bit.

When we grant extra access based on group membership (i.e. the
directory has either g+r or g+w bit set), which group the directory
and its contents are owned by matters.  But otherwise (e.g. perm is
set to 0600, in Julien's case), flipping g+s bit is not necessary.

Reported-by: Julien Moutinho <julm+git@sourcephile.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path.c