Skip to content

Skip chown tests when the target group is not assignable#164

Open
takano32 wants to merge 1 commit into
ruby:masterfrom
takano32:skip-unassignable-chown-group
Open

Skip chown tests when the target group is not assignable#164
takano32 wants to merge 1 commit into
ruby:masterfrom
takano32:skip-unassignable-chown-group

Conversation

@takano32

@takano32 takano32 commented Jun 8, 2026

Copy link
Copy Markdown
Member

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 builds @groups straight from
[Process.gid] | Process.groups, so the chown tests try to chgrp a file to
such a group and fail with EPERM instead of being skipped:

File.chown(nil, @groups[1], path)  # => Errno::EPERM

This filters @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. On
systems where the group is usable (or as root) the tests run exactly as before.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant