Skip chown tests when the target group is not assignable#164
Conversation
In user-namespace environments (e.g. ChromeOS Crostini) getgroups(2) can report supplementary groups such as the overflow GID 65534 (nobody) that a non-root process cannot actually chgrp a file to. TestFileUtils#setup built @groups straight from `[Process.gid] | Process.groups`, so the chown tests tried to chgrp to such a group and failed with EPERM instead of being skipped. Filter @groups with a one-time capability probe down to the groups the process can actually assign, so the affected tests skip via their existing `return unless @groups[1]` guard when there is no usable second group. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Gentle ping on this one 🙏 Just to add some concrete context on the motivation: this isn't a hypothetical edge case — This PR is test-only, has no impact on the library itself, and just filters Happy to adjust the approach if you'd prefer something lighter than the probe-based check. Thanks for taking a look! |
In user-namespace environments (e.g. ChromeOS Crostini)
getgroups(2)canreport supplementary groups such as the overflow GID 65534 (nobody) that a
non-root process cannot actually
chgrpa file to.TestFileUtils#setupbuilds@groupsstraight from[Process.gid] | Process.groups, so the chown tests try to chgrp a file tosuch a group and fail with EPERM instead of being skipped:
This filters
@groupswith a one-time capability probe down to the groups theprocess can actually assign, so the affected tests skip via their existing
return unless @groups[1]guard when there is no usable second group. Onsystems where the group is usable (or as root) the tests run exactly as before.