1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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).
This commit is contained in:
Nobuyoshi Nakada 2020-01-09 15:57:10 +09:00
parent b369f5e8a2
commit b0e9db65c3
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -4,6 +4,10 @@ describe "Process.groups" do
platform_is_not :windows do platform_is_not :windows do
it "gets an Array of the gids of groups in the supplemental group access list" 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 } 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 gid = Process.gid
expected = (groups.sort - [gid]).uniq.sort expected = (groups.sort - [gid]).uniq.sort