From b0e9db65c3f05e1443c2d8f4ca139182a771500c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 9 Jan 2020 15:57:10 +0900 Subject: [PATCH] Include the standard `id` command output On macOS, GNU coreutils `id` is limited to NGROUPS_MAX groups, because of the backward compatibility of getgroups(2). --- spec/ruby/core/process/groups_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/ruby/core/process/groups_spec.rb b/spec/ruby/core/process/groups_spec.rb index cbbe4fed25..33e0f9d7b3 100644 --- a/spec/ruby/core/process/groups_spec.rb +++ b/spec/ruby/core/process/groups_spec.rb @@ -4,6 +4,10 @@ describe "Process.groups" do platform_is_not :windows do it "gets an Array of the gids of groups in the supplemental group access list" do groups = `id -G`.scan(/\d+/).map { |i| i.to_i } + # Include the standard `id` command output. On macOS, GNU + # coreutils `id` is limited to NGROUPS_MAX groups, because of + # the backward compatibility of getgroups(2). + (groups |= `/usr/bin/id -G`.scan(/\d+/).map { |i| i.to_i }) rescue nil gid = Process.gid expected = (groups.sort - [gid]).uniq.sort