Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

Trott
Copy link
Member

@Trott Trott commented Apr 13, 2017

Refactor test to be skipped in situations where it is expected to fail.
Move from disabled directory to parallel.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test process

@Trott Trott added process Issues and PRs related to the process subsystem. test Issues and PRs related to the tests. labels Apr 13, 2017
@Trott
Copy link
Member Author

Trott commented Apr 13, 2017

Will be interested to see how this goes on CI....

CI: https://ci.nodejs.org/job/node-test-pull-request/7382/

@Trott Trott force-pushed the fix-setuid-test branch from 8f74ea0 to 4653295 Compare April 13, 2017 20:41
@Trott
Copy link
Member Author

Trott commented Apr 13, 2017

Fixed up a bit. Once again, CI: https://ci.nodejs.org/job/node-test-pull-request/7385/

@Trott Trott changed the title test: enable setuid/setgit test test: enable setuid/setgid test Apr 13, 2017
@Trott Trott force-pushed the fix-setuid-test branch from 4653295 to c0baf52 Compare April 13, 2017 23:14
@Trott
Copy link
Member Author

Trott commented Apr 13, 2017

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/

@Trott Trott force-pushed the fix-setuid-test branch from c0baf52 to 6db736f Compare April 13, 2017 23:33
@Trott
Copy link
Member Author

Trott commented Apr 13, 2017

Fixed up more to be forgiving if nobody is not a valid group id.

CI: https://ci.nodejs.org/job/node-test-pull-request/7388/

@Trott Trott force-pushed the fix-setuid-test branch from 6db736f to 93a2ec9 Compare April 13, 2017 23:55
@Trott
Copy link
Member Author

Trott commented Apr 13, 2017

SmartOS is letting me know that different OS's can have somewhat different error messages. Made the check a little more lenient.

CI: https://ci.nodejs.org/job/node-test-pull-request/7389/

Copy link
Contributor

@cjihrig cjihrig left a 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.
@Trott Trott force-pushed the fix-setuid-test branch from 93a2ec9 to 7e46be1 Compare April 14, 2017 03:31
@Trott
Copy link
Member Author

Trott commented Apr 14, 2017

Yet more lenient.

CI: https://ci.nodejs.org/job/node-test-pull-request/7391/

@Trott
Copy link
Member Author

Trott commented Apr 14, 2017

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)$/
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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
> 

Copy link
Contributor

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"?

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay.

Trott added a commit to Trott/io.js that referenced this pull request Apr 16, 2017
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>
@Trott
Copy link
Member Author

Trott commented Apr 16, 2017

Landed in 189afc8

@Trott Trott closed this Apr 16, 2017
evanlucas pushed a commit that referenced this pull request Apr 25, 2017
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>
@evanlucas evanlucas mentioned this pull request May 1, 2017
evanlucas pushed a commit that referenced this pull request May 1, 2017
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>
evanlucas pushed a commit that referenced this pull request May 2, 2017
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>
@gibfahn
Copy link
Member

gibfahn commented May 15, 2017

@Trott should this be backported to v6.x?

@Trott
Copy link
Member Author

Trott commented May 16, 2017

@Trott should this be backported to v6.x?

@gibfahn I think so.

@gibfahn
Copy link
Member

gibfahn commented May 16, 2017

Didn't backport cleanly, could you raise a PR?

@Trott
Copy link
Member Author

Trott commented May 16, 2017

@gibfahn #13060

Trott added a commit to Trott/io.js that referenced this pull request May 20, 2017
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>
gibfahn pushed a commit to gibfahn/node that referenced this pull request Jun 17, 2017
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>
gibfahn pushed a commit that referenced this pull request Jun 20, 2017
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>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2017
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>
@Trott
Copy link
Member Author

Trott commented Jul 18, 2017

#13060 landed. Removed backport-requested-v6.x and adding backported-to-v6.x.

@MylesBorins MylesBorins mentioned this pull request Jul 18, 2017
@Trott Trott deleted the fix-setuid-test branch January 13, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants