Skip to content

fix(occ): set GID before UID to ensure success - #60331

Merged
AndyScherzinger merged 1 commit into
masterfrom
jtr/fix-occ-gid-before-uid
Jun 11, 2026
Merged

fix(occ): set GID before UID to ensure success#60331
AndyScherzinger merged 1 commit into
masterfrom
jtr/fix-occ-gid-before-uid

Conversation

@joshtrichards

@joshtrichardsjoshtrichards commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

The previous implementation attempted to set GID after dropping root UID, which would fail (silently) and made the posix_setgid() call effectively a no-op. This swaps the order to set the target GID first.

Also refactored for clarity:

  • Renamed dropPrivileges to switchToConfigFileOwner for clearer intent
  • Update docblock to explicitly state best-effort limitations
  • Use more descriptive variable names
  • Re-organized for readability

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The previous implementation attempted to set GID after dropping root UID, which would fail (silently) and made the posix_setgid() call effectively a no-op. This swaps the order to set the target GID first.
Also refactored for clarity:
- Renamed dropPrivileges to switchToConfigFileOwner for clearer intent
- Update docblock to explicitly state best-effort limitations
- Use more descriptive variable names
- Re-organized for readability
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichardsjoshtrichards added this to the Nextcloud 34 milestone May 12, 2026
@joshtrichards
joshtrichards requested a review from a team as a code ownerMay 12, 2026 13:37
@joshtrichards
joshtrichards requested review from Altahrim, ArtificialOwl and icewind1991 and removed request for a teamMay 12, 2026 13:37
Comment threadocc
@nextcloud-botnextcloud-bot mentioned this pull request May 27, 2026
@nextcloud-botnextcloud-bot mentioned this pull request Jun 4, 2026
This was referenced Jun 5, 2026
@susnuxsusnux added the community pull requests from community label Jun 9, 2026
@come-nccome-nc added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jun 11, 2026
@AndyScherzinger
AndyScherzinger merged commit 19e90da into masterJun 11, 2026
160 of 183 checks passed
@AndyScherzinger
AndyScherzinger deleted the jtr/fix-occ-gid-before-uid branch June 11, 2026 09:12
@nextcloud-botnextcloud-bot mentioned this pull request Aug 11, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishbugcommunitypull requests from communityfeature: occ

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@joshtrichards@provokateurin@come-nc@AndyScherzinger@susnux@nextcloud-bot