Skip to content

Conversation

@danbev
Copy link
Contributor

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 testingonly. Do not use them.Can't clean tmpdir: /root/node/test/.tmp.522Files 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-botnodejs-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


constcommon=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
ContributorAuthor

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

Landed in f7321dc

@TrottTrott 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]>
@targostargos mentioned this pull request Aug 19, 2019
@danbevdanbev deleted the test-fs-access-as-root branch August 21, 2019 07:45
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@danbev@nodejs-github-bot@Trott@lpinca@cjihrig@gengjiawen@ZYSzys