fix(jd): narrow repository sharing hook

This commit is contained in:
冰朔 2026-07-30 00:01:42 +08:00
commit 406e9d8a7d

View file

@ -12,8 +12,11 @@ cd "$repo_dir"
owner_uid=$(id -u) owner_uid=$(id -u)
share_tree() { share_tree() {
find "$1" -user "$owner_uid" -type d -exec chmod g+rwx {} + # RestrictSUIDSGID forbids chmod calls that preserve a setgid directory.
find "$1" -user "$owner_uid" -type f -exec chmod g+rw {} + # Existing shared directories are already traversable, so touch only new
# private directories and use a numeric mode that drops the special bit.
find "$1" -user "$owner_uid" -type d ! -perm -g=x -exec chmod 0770 {} +
find "$1" -user "$owner_uid" -type f ! -perm -g=r -exec chmod g+r {} +
} }
share_tree "$repo_dir/objects" share_tree "$repo_dir/objects"