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: skip test-fs-access if root #29092

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Aug 12, 2019

Currently, if this test is run as the root user the following
failure will occur:

=== release test-fs-access ===
Path: parallel/test-fs-access
(node:46733) internal/test/binding: These APIs are for internal testing
only. Do not use them.
Can't clean tmpdir: /root/node/test/.tmp.522
Files blocking: [ 'read_only_file', 'read_write_file' ]

/root/node/test/common/tmpdir.js:136
    throw e;
    ^

Error: EACCES: permission denied, rmdir '/root/node/test/.tmp.522'
    at Object.rmdirSync (fs.js:693:3)
    at rmdirSync (/root/node/test/common/tmpdir.js:72:8)
    at rimrafSync (/root/node/test/common/tmpdir.js:41:7)
    at process.onexit (/root/node/test/common/tmpdir.js:121:5)
    at process.emit (events.js:214:15) {
  errno: -13,
  syscall: 'rmdir',
  code: 'EACCES',
  path: '/root/node/test/.tmp.522'
}
Command: ./node --expose-internals test/parallel/test-fs-access.js

This commit adds a root user check and skips this test if running as the
user root.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Currently, if this test is run as the root user the following
failure will occur:

=== release test-fs-access ===
Path: parallel/test-fs-access
(node:46733) internal/test/binding: These APIs are for internal testing
only. Do not use them.
Can't clean tmpdir: /root/node/test/.tmp.522
Files blocking: [ 'read_only_file', 'read_write_file' ]

/root/node/test/common/tmpdir.js:136
    throw e;
    ^

Error: EACCES: permission denied, rmdir '/root/node/test/.tmp.522'
    at Object.rmdirSync (fs.js:693:3)
    at rmdirSync (/root/node/test/common/tmpdir.js:72:8)
    at rimrafSync (/root/node/test/common/tmpdir.js:41:7)
    at process.onexit (/root/node/test/common/tmpdir.js:121:5)
    at process.emit (events.js:214:15) {
  errno: -13,
  syscall: 'rmdir',
  code: 'EACCES',
  path: '/root/node/test/.tmp.522'
}
Command: ./node --expose-internals test/parallel/test-fs-access.js

This commit adds a root user check and skips this test if running as the
user root.
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Aug 12, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@@ -5,6 +5,9 @@
// and the errors thrown from these APIs include the desired properties

const common = require('../common');
if (!common.isWindows && process.getuid() === 0)
common.skip('as this test should not be run as `root`');
Copy link
Member

Choose a reason for hiding this comment

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

Totally optional suggestion:

Suggested change
common.skip('as this test should not be run as `root`');
common.skip('test needs to be run as an unprivileged user');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I like your suggestion and I'm happy to change this. But perhaps this should be done in a follow up PR as there are a couple of these skips that I've added in the past with this wording and changing them all would make the output more consistent. Does that sound alright?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, that sounds fine. It was a totally optional suggestion anyway and I wouldn't mind if you ignored it completely. Do it now, do it later, don't do it at all, it's all good by me.

@Trott
Copy link
Member

Trott commented Aug 14, 2019

Landed in f7321dc

@Trott Trott closed this Aug 14, 2019
Trott pushed a commit to Trott/io.js that referenced this pull request Aug 14, 2019
Currently, if this test is run as the root user the following
failure will occur:

=== release test-fs-access ===
Path: parallel/test-fs-access
(node:46733) internal/test/binding: These APIs are for internal testing
only. Do not use them.
Can't clean tmpdir: /root/node/test/.tmp.522
Files blocking: [ 'read_only_file', 'read_write_file' ]

/root/node/test/common/tmpdir.js:136
    throw e;
    ^

Error: EACCES: permission denied, rmdir '/root/node/test/.tmp.522'
    at Object.rmdirSync (fs.js:693:3)
    at rmdirSync (/root/node/test/common/tmpdir.js:72:8)
    at rimrafSync (/root/node/test/common/tmpdir.js:41:7)
    at process.onexit (/root/node/test/common/tmpdir.js:121:5)
    at process.emit (events.js:214:15) {
  errno: -13,
  syscall: 'rmdir',
  code: 'EACCES',
  path: '/root/node/test/.tmp.522'
}
Command: ./node --expose-internals test/parallel/test-fs-access.js

This commit adds a root user check and skips this test if running as the
user root.

PR-URL: nodejs#29092
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
targos pushed a commit that referenced this pull request Aug 19, 2019
Currently, if this test is run as the root user the following
failure will occur:

=== release test-fs-access ===
Path: parallel/test-fs-access
(node:46733) internal/test/binding: These APIs are for internal testing
only. Do not use them.
Can't clean tmpdir: /root/node/test/.tmp.522
Files blocking: [ 'read_only_file', 'read_write_file' ]

/root/node/test/common/tmpdir.js:136
    throw e;
    ^

Error: EACCES: permission denied, rmdir '/root/node/test/.tmp.522'
    at Object.rmdirSync (fs.js:693:3)
    at rmdirSync (/root/node/test/common/tmpdir.js:72:8)
    at rimrafSync (/root/node/test/common/tmpdir.js:41:7)
    at process.onexit (/root/node/test/common/tmpdir.js:121:5)
    at process.emit (events.js:214:15) {
  errno: -13,
  syscall: 'rmdir',
  code: 'EACCES',
  path: '/root/node/test/.tmp.522'
}
Command: ./node --expose-internals test/parallel/test-fs-access.js

This commit adds a root user check and skips this test if running as the
user root.

PR-URL: #29092
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
@danbev danbev deleted the test-fs-access-as-root branch August 21, 2019 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants