Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
added option to setgid, same as setuid #3
Adding the code to support setgid was pretty trivial. However, finding a portable way to test that functionality is not trivial. As it was, the exisitng setuid feature was untested so I had hoped to add a test for both features.
I considered using the nobody/nogroup pair but that creates two problems. The first problem is that the 'nobody' user likely doesn't exist on platforms such as Win32. The second problem is that the 'nobody' user very likely can't write to the t/ test directory (as the other tests do to allow communication between the spawned daemons). I could use File::Spec->tmpdir to get a more portable temp path that is likely world writable but that still doesn't guarantee the 'nobody' user will exist or will be able to write to that path.
In the end, the only test I was reasonably sure would work cross platform was to just setgid and setuid back to the current effective group/user. That is basically a noop but at least it provides a tiny improvement in test coverage :(.
Let me know if you can think of a better way to test this.