ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:50603] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある
       [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
@ 2018-08-06  7:53 ` muraken
  2018-08-06  8:03 ` [ruby-dev:50604] " mame
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: muraken @ 2018-08-06  7:53 UTC (permalink / raw)
  To: ruby-dev

Issue #14969 has been reported by mrkn (Kenta Murata).

----------------------------------------
Bug #14969: Process.groups が返す GID が重複している場合がある
https://bugs.ruby-lang.org/issues/14969

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-08-06 arith_seq 64201) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Ubuntu 16.04 から 18.04 にアップグレードした環境で以下の ruby spec が失敗することに気づきました。

```
1)
Process.groups gets an Array of the gids of groups in the supplemental group access list FAILED
Expected [4, 24, 27, 30, 46, 110, 114, 120, 120, 121]
to equal [4, 24, 27, 30, 46, 110, 114, 120, 121]

/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:11:in `block (3 levels) in <top (required)>'
/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:3:in `<top (required)>'
```

根本原因は、この環境に GID=120 のグループが2つ存在するからでした。

```
$ grep 120 /etc/group
libvirtd:x:120:mrkn
libvirt:x:120:mrkn
```

Ubuntu の Yakkety を堺にグループ名が libvirtd から libvirt に変わったらしく、私が 16.04 → 18.04 というアップグレードをしたことでこのような状態を作ってしまったようです。

https://help.ubuntu.com/lts/serverguide/libvirt.html.en
> In more recent releases (>= Yakkety) the group was renamed to libvirt. Upgraded systems get a new libvirt group with the same gid as the libvirtd group to match that.

失敗したテストは、`Process.groups` と `id -G` の結果をソートして比較するものです。`Process.groups` が中で使っている getgroups(2) は重複した gid があっても重複したまま返すけど、`id -G` コマンドは結果を uniq して返すので、両者の内容が異なっていてテストが失敗しています。

私は getgroups(2) や Process.groups の用途を正確に理解していないので、Process.groups の方を弄るべきか、失敗したテストを修正すべきか判断できません。
どなたかこの件に詳しい方、どのように修正すべきか教えて頂けますか。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-dev:50604] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある
       [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
  2018-08-06  7:53 ` [ruby-dev:50603] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある muraken
@ 2018-08-06  8:03 ` mame
  2018-08-06  8:08 ` [ruby-dev:50605] " kosaki.motohiro
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: mame @ 2018-08-06  8:03 UTC (permalink / raw)
  To: ruby-dev

Issue #14969 has been updated by mame (Yusuke Endoh).


Process.groupsはgetgroups(2)のラッパってことで、重複を省くなどの余計なことはしない、に一票です。
idコマンドの結果を期待値にしているspecの方にそもそも無理を感じます。なので、specの方をいじる、でよいのではないでしょうか。

----------------------------------------
Bug #14969: Process.groups が返す GID が重複している場合がある
https://bugs.ruby-lang.org/issues/14969#change-73335

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-08-06 arith_seq 64201) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Ubuntu 16.04 から 18.04 にアップグレードした環境で以下の ruby spec が失敗することに気づきました。

```
1)
Process.groups gets an Array of the gids of groups in the supplemental group access list FAILED
Expected [4, 24, 27, 30, 46, 110, 114, 120, 120, 121]
to equal [4, 24, 27, 30, 46, 110, 114, 120, 121]

/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:11:in `block (3 levels) in <top (required)>'
/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:3:in `<top (required)>'
```

根本原因は、この環境に GID=120 のグループが2つ存在するからでした。

```
$ grep 120 /etc/group
libvirtd:x:120:mrkn
libvirt:x:120:mrkn
```

Ubuntu の Yakkety を堺にグループ名が libvirtd から libvirt に変わったらしく、私が 16.04 → 18.04 というアップグレードをしたことでこのような状態を作ってしまったようです。

https://help.ubuntu.com/lts/serverguide/libvirt.html.en
> In more recent releases (>= Yakkety) the group was renamed to libvirt. Upgraded systems get a new libvirt group with the same gid as the libvirtd group to match that.

失敗したテストは、`Process.groups` と `id -G` の結果をソートして比較するものです。`Process.groups` が中で使っている getgroups(2) は重複した gid があっても重複したまま返すけど、`id -G` コマンドは結果を uniq して返すので、両者の内容が異なっていてテストが失敗しています。

私は getgroups(2) や Process.groups の用途を正確に理解していないので、Process.groups の方を弄るべきか、失敗したテストを修正すべきか判断できません。
どなたかこの件に詳しい方、どのように修正すべきか教えて頂けますか。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-dev:50605] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある
       [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
  2018-08-06  7:53 ` [ruby-dev:50603] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある muraken
  2018-08-06  8:03 ` [ruby-dev:50604] " mame
@ 2018-08-06  8:08 ` kosaki.motohiro
  2018-08-06  8:11 ` [ruby-dev:50606] " kosaki.motohiro
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: kosaki.motohiro @ 2018-08-06  8:08 UTC (permalink / raw)
  To: ruby-dev

Issue #14969 has been updated by kosaki (Motohiro KOSAKI).


Process.groupsが
・結果が昇順にソートされている保証はない(OS依存)
・Effective gidが入っているかどうかはOS依存
・重複するIDはそのままarrayに入っていることもあれば、重複が取り除かれていることもある(OS依存)
というあたりは、ドキュメントに記載してもいいのではないかと思いました

----------------------------------------
Bug #14969: Process.groups が返す GID が重複している場合がある
https://bugs.ruby-lang.org/issues/14969#change-73336

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-08-06 arith_seq 64201) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Ubuntu 16.04 から 18.04 にアップグレードした環境で以下の ruby spec が失敗することに気づきました。

```
1)
Process.groups gets an Array of the gids of groups in the supplemental group access list FAILED
Expected [4, 24, 27, 30, 46, 110, 114, 120, 120, 121]
to equal [4, 24, 27, 30, 46, 110, 114, 120, 121]

/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:11:in `block (3 levels) in <top (required)>'
/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:3:in `<top (required)>'
```

根本原因は、この環境に GID=120 のグループが2つ存在するからでした。

```
$ grep 120 /etc/group
libvirtd:x:120:mrkn
libvirt:x:120:mrkn
```

Ubuntu の Yakkety を堺にグループ名が libvirtd から libvirt に変わったらしく、私が 16.04 → 18.04 というアップグレードをしたことでこのような状態を作ってしまったようです。

https://help.ubuntu.com/lts/serverguide/libvirt.html.en
> In more recent releases (>= Yakkety) the group was renamed to libvirt. Upgraded systems get a new libvirt group with the same gid as the libvirtd group to match that.

失敗したテストは、`Process.groups` と `id -G` の結果をソートして比較するものです。`Process.groups` が中で使っている getgroups(2) は重複した gid があっても重複したまま返すけど、`id -G` コマンドは結果を uniq して返すので、両者の内容が異なっていてテストが失敗しています。

私は getgroups(2) や Process.groups の用途を正確に理解していないので、Process.groups の方を弄るべきか、失敗したテストを修正すべきか判断できません。
どなたかこの件に詳しい方、どのように修正すべきか教えて頂けますか。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-dev:50606] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある
       [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2018-08-06  8:08 ` [ruby-dev:50605] " kosaki.motohiro
@ 2018-08-06  8:11 ` kosaki.motohiro
  2018-08-07  1:47 ` [ruby-dev:50609] " zn
  2018-08-10  4:53 ` [ruby-dev:50619] [Ruby trunk Bug#14969][Assigned] " muraken
  5 siblings, 0 replies; 6+ messages in thread
From: kosaki.motohiro @ 2018-08-06  8:11 UTC (permalink / raw)
  To: ruby-dev

Issue #14969 has been updated by kosaki (Motohiro KOSAKI).


つまり、
・specを直すに賛成である
・ただ、API docで Process.groups.sort.uniq がふつうの使い方みたいに教えてあげるのが親切と思う
の2つが意見です

----------------------------------------
Bug #14969: Process.groups が返す GID が重複している場合がある
https://bugs.ruby-lang.org/issues/14969#change-73337

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-08-06 arith_seq 64201) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Ubuntu 16.04 から 18.04 にアップグレードした環境で以下の ruby spec が失敗することに気づきました。

```
1)
Process.groups gets an Array of the gids of groups in the supplemental group access list FAILED
Expected [4, 24, 27, 30, 46, 110, 114, 120, 120, 121]
to equal [4, 24, 27, 30, 46, 110, 114, 120, 121]

/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:11:in `block (3 levels) in <top (required)>'
/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:3:in `<top (required)>'
```

根本原因は、この環境に GID=120 のグループが2つ存在するからでした。

```
$ grep 120 /etc/group
libvirtd:x:120:mrkn
libvirt:x:120:mrkn
```

Ubuntu の Yakkety を堺にグループ名が libvirtd から libvirt に変わったらしく、私が 16.04 → 18.04 というアップグレードをしたことでこのような状態を作ってしまったようです。

https://help.ubuntu.com/lts/serverguide/libvirt.html.en
> In more recent releases (>= Yakkety) the group was renamed to libvirt. Upgraded systems get a new libvirt group with the same gid as the libvirtd group to match that.

失敗したテストは、`Process.groups` と `id -G` の結果をソートして比較するものです。`Process.groups` が中で使っている getgroups(2) は重複した gid があっても重複したまま返すけど、`id -G` コマンドは結果を uniq して返すので、両者の内容が異なっていてテストが失敗しています。

私は getgroups(2) や Process.groups の用途を正確に理解していないので、Process.groups の方を弄るべきか、失敗したテストを修正すべきか判断できません。
どなたかこの件に詳しい方、どのように修正すべきか教えて頂けますか。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-dev:50609] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある
       [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2018-08-06  8:11 ` [ruby-dev:50606] " kosaki.motohiro
@ 2018-08-07  1:47 ` zn
  2018-08-10  4:53 ` [ruby-dev:50619] [Ruby trunk Bug#14969][Assigned] " muraken
  5 siblings, 0 replies; 6+ messages in thread
From: zn @ 2018-08-07  1:47 UTC (permalink / raw)
  To: ruby-dev

Issue #14969 has been updated by znz (Kazuhiro NISHIYAMA).


(シェルスクリプトの uniq と違って) ruby の uniq は sort 済みかどうかに依存していないので、 `.sort.uniq` よりも `.uniq.sort` の方が良いと思います。

----------------------------------------
Bug #14969: Process.groups が返す GID が重複している場合がある
https://bugs.ruby-lang.org/issues/14969#change-73349

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-08-06 arith_seq 64201) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Ubuntu 16.04 から 18.04 にアップグレードした環境で以下の ruby spec が失敗することに気づきました。

```
1)
Process.groups gets an Array of the gids of groups in the supplemental group access list FAILED
Expected [4, 24, 27, 30, 46, 110, 114, 120, 120, 121]
to equal [4, 24, 27, 30, 46, 110, 114, 120, 121]

/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:11:in `block (3 levels) in <top (required)>'
/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:3:in `<top (required)>'
```

根本原因は、この環境に GID=120 のグループが2つ存在するからでした。

```
$ grep 120 /etc/group
libvirtd:x:120:mrkn
libvirt:x:120:mrkn
```

Ubuntu の Yakkety を堺にグループ名が libvirtd から libvirt に変わったらしく、私が 16.04 → 18.04 というアップグレードをしたことでこのような状態を作ってしまったようです。

https://help.ubuntu.com/lts/serverguide/libvirt.html.en
> In more recent releases (>= Yakkety) the group was renamed to libvirt. Upgraded systems get a new libvirt group with the same gid as the libvirtd group to match that.

失敗したテストは、`Process.groups` と `id -G` の結果をソートして比較するものです。`Process.groups` が中で使っている getgroups(2) は重複した gid があっても重複したまま返すけど、`id -G` コマンドは結果を uniq して返すので、両者の内容が異なっていてテストが失敗しています。

私は getgroups(2) や Process.groups の用途を正確に理解していないので、Process.groups の方を弄るべきか、失敗したテストを修正すべきか判断できません。
どなたかこの件に詳しい方、どのように修正すべきか教えて頂けますか。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-dev:50619] [Ruby trunk Bug#14969][Assigned] Process.groups が返す GID が重複している場合がある
       [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2018-08-07  1:47 ` [ruby-dev:50609] " zn
@ 2018-08-10  4:53 ` muraken
  5 siblings, 0 replies; 6+ messages in thread
From: muraken @ 2018-08-10  4:53 UTC (permalink / raw)
  To: ruby-dev

Issue #14969 has been updated by mrkn (Kenta Murata).

Status changed from Open to Assigned
Assignee set to mrkn (Kenta Murata)

----------------------------------------
Bug #14969: Process.groups が返す GID が重複している場合がある
https://bugs.ruby-lang.org/issues/14969#change-73470

* Author: mrkn (Kenta Murata)
* Status: Assigned
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-08-06 arith_seq 64201) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Ubuntu 16.04 から 18.04 にアップグレードした環境で以下の ruby spec が失敗することに気づきました。

```
1)
Process.groups gets an Array of the gids of groups in the supplemental group access list FAILED
Expected [4, 24, 27, 30, 46, 110, 114, 120, 120, 121]
to equal [4, 24, 27, 30, 46, 110, 114, 120, 121]

/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:11:in `block (3 levels) in <top (required)>'
/home/mrkn/src/github.com/ruby/ruby/spec/ruby/core/process/groups_spec.rb:3:in `<top (required)>'
```

根本原因は、この環境に GID=120 のグループが2つ存在するからでした。

```
$ grep 120 /etc/group
libvirtd:x:120:mrkn
libvirt:x:120:mrkn
```

Ubuntu の Yakkety を堺にグループ名が libvirtd から libvirt に変わったらしく、私が 16.04 → 18.04 というアップグレードをしたことでこのような状態を作ってしまったようです。

https://help.ubuntu.com/lts/serverguide/libvirt.html.en
> In more recent releases (>= Yakkety) the group was renamed to libvirt. Upgraded systems get a new libvirt group with the same gid as the libvirtd group to match that.

失敗したテストは、`Process.groups` と `id -G` の結果をソートして比較するものです。`Process.groups` が中で使っている getgroups(2) は重複した gid があっても重複したまま返すけど、`id -G` コマンドは結果を uniq して返すので、両者の内容が異なっていてテストが失敗しています。

私は getgroups(2) や Process.groups の用途を正確に理解していないので、Process.groups の方を弄るべきか、失敗したテストを修正すべきか判断できません。
どなたかこの件に詳しい方、どのように修正すべきか教えて頂けますか。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-10  4:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-14969.20180806075358@ruby-lang.org>
2018-08-06  7:53 ` [ruby-dev:50603] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある muraken
2018-08-06  8:03 ` [ruby-dev:50604] " mame
2018-08-06  8:08 ` [ruby-dev:50605] " kosaki.motohiro
2018-08-06  8:11 ` [ruby-dev:50606] " kosaki.motohiro
2018-08-07  1:47 ` [ruby-dev:50609] " zn
2018-08-10  4:53 ` [ruby-dev:50619] [Ruby trunk Bug#14969][Assigned] " muraken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).