ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: zn@mbf•nifty.com
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50609] [Ruby trunk Bug#14969] Process.groups が返す GID が重複している場合がある
Date: Tue, 07 Aug 2018 01:47:29 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-73349.20180807014727.d7c84b5f04b005bc@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14969.20180806075358@ruby-lang.org

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/

  parent reply	other threads:[~2018-08-07  1:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 ` zn [this message]
2018-08-10  4:53 ` [ruby-dev:50619] [Ruby trunk Bug#14969][Assigned] " muraken

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-73349.20180807014727.d7c84b5f04b005bc@ruby-lang.org \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).