-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: enable setuid/setgid test #12403
Conversation
Will be interested to see how this goes on CI.... |
Fixed up a bit. Once again, CI: https://ci.nodejs.org/job/node-test-pull-request/7385/ |
Fixed it up so it isn't skipped anymore. Would be nice if there was a way to specify tests that need superuser, but I guess we shouldn't expect devs to have local superuser necessarily. (Would be nice for CI, though!) New CI: https://ci.nodejs.org/job/node-test-pull-request/7387/ |
Fixed up more to be forgiving if |
SmartOS is letting me know that different OS's can have somewhat different error messages. Made the check a little more lenient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the CI is straightened out.
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel.
Yet more lenient. |
Single ARM failure is infrastructure-related. (That instance that failed doesn't even run this test.) CI is effectively green. |
|
||
assert.throws( | ||
() => { process.setgid('nobody'); }, | ||
/^Error: (EPERM, .+|setgid group id does not exist)$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually getting Error: EPERM, Operation not permitted
for both the cases. Also, the capture group doesn't look correct to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually getting Error: EPERM, Operation not permitted for both the cases.
@thefourtheye Error message depends on your operating system. SmartOS gives Error: EPERM, Not owner
here.
The regexp allows any error that starts with Error: EPERM,
and also allows Error: setgid group id does not exist
for the situation where nobody
is not included on the operating system (which happens on ubuntu1404-64 in FIPS mode on our CI).
TL;DR: Test passes if you have group nobody
and get EPERM
back along with some text from the OS, and it will also pass if group nobody
doesn't exist at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the capture group doesn't look correct to me.
@thefourtheye There's room for improvement. For one thing, it could be a non-capturing group. But the regexp seems to work to me. What situation are you concerned about?
> /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: setgid group id does not exist')
true
> /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: setgid group id does not exist adding some text so it will be false')
false
> /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: EPERM, setgid group id does not exist adding some text so it will be false except now it as EPERM at the start so it should be true again')
true
>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I thought EPERM is always going to be there. As "setgid group id does not exist" is present in all the cases, can we make EPERM,
optional and check for the presence of "setgid group id does not exist"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that's there in all cases is Error:
.
> /^Error: (EPERM, .+|setgid group id does not exist)$/.test('Error: EPERM, arbitrary text.')
true
>
The regexp can be thought of as: String must start with Error:
and then there are two options that will match after that. One is EPERM,
followed by one or more characters of anything. The other is the string setgid group id does not exist
precisely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay.
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: nodejs#12403 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Landed in 189afc8 |
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
@Trott should this be backported to v6.x? |
Didn't backport cleanly, could you raise a PR? |
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: nodejs#12403 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: nodejs#12403 Backport-PR-URL: nodejs#13060 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Backport-PR-URL: #13060 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Refactor test for situations where it was expected to fail. Move from disabled directory to parallel. PR-URL: #12403 Backport-PR-URL: #13060 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
#13060 landed. Removed |
Refactor test to be skipped in situations where it is expected to fail.
Move from disabled directory to parallel.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test process