Support for additional groups and basic expectations in sockets #123

wants to merge 3 commits into


None yet

2 participants


Hello, you may want to consider the two commits I made which implement initialization of additional group membership while changing privileges and basic expectation rules on what the SocketResponding condition should read from a socket to consider it alive.

@eric eric commented on the diff Jan 30, 2013
@@ -292,7 +292,7 @@ def spawn(command)
::Dir.chroot(self.chroot) if self.chroot
- ::Process.groups = [gid_num] if self.gid
+ ::Process.initgroups(self.uid, gid_num) if self.uid
eric Jan 30, 2013

Did this intend to say if self.uid but not check for self.gid?

vihai Feb 7, 2013

Well, the ratio would be that you would init additional groups only if you're switching UID. It has to be checked that if the UID change clears the additional groups to avoid keeping the former additional groups when changing only the GID.


Thanks for the pull request!

If you could add some tests for your new SocketResponding behavior, the additional options for the condition look great.

Just a side comment related to pull requests: it's easier to get things merged if unrelated changes are submitted as separate pull requests (by creating the changes in separate branches) to prevent problems or discussions from one change hang up an unrelated one.

@eric eric commented on an outdated diff Jan 30, 2013
@@ -118,6 +128,24 @@ def test
status = false
+ begin
+ timeout(expect_timeout) do
+ s.write(send_data) if send_data
+ if expect_data
+ line = s.readline.chop
+ if expect_data.is_a?(Regexp) && !expect_data.match(line) ||
+ line != expect_data
eric Jan 30, 2013

For readability I think it would be good to put parens around the grouped conditions:

              if (expect_data.is_a?(Regexp) && !expect_data.match(line)) || line != expect_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment