-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Conversation
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.
@@ -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`'); |
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.
Totally optional suggestion:
common.skip('as this test should not be run as `root`'); | |
common.skip('test needs to be run as an unprivileged user'); |
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.
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?
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.
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.
Landed in f7321dc |
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]>
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]>
Currently, if this test is run as the root user the following
failure will occur:
This commit adds a root user check and skips this test if running as the
user root.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes