Skip to content

Conversation

@i8-pi
Copy link
Contributor

Some tests which create files and check file permissions assume the
umask is compatible with 022, and break when set to something like 007.
Explicitly set umask to 022

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

I'm seeing test errors

=== release test-fs-mkdir-mode-mask === Path: parallel/test-fs-mkdir-mode-mask assert.js:86 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 416 !== 420 at test (/home/i8-pi/src/node/test/parallel/test-fs-mkdir-mode-mask.js:32:12) at Object.<anonymous> (/home/i8-pi/src/node/test/parallel/test-fs-mkdir-mode-mask.js:44:1) 

when running
umask 007; make -j4 test

Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022
@nodejs-github-botnodejs-github-bot added test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels Dec 25, 2018
@Trott
Copy link
Member

The issue here is that the temp directory is being created with more restrictive permissions than that being used by the test. Rather than fixing in the Python test runner, might it be better to change the tmpdir module (in test/common) to specify mode 755 when creating the temp directory? This would have the following advantages:

  • Fixes it both with and without the Python test runner. (./node test/parallel/test-fs-mkdir-mode-mask.js will work no matter what your starting umask.)

  • Keeps all the tmpdir code in one place.

  • Allows us to run tests with different umasks easily to make sure they still work. In other words, Node.js should work as expected no matter what the starting umask, but by forcing the starting umask, maybe we miss something.

Counterarguments I can think of would be that this solution is simpler, and there may be edge cases where it's more robust too although I can't think of any.

@i8-pi
Copy link
ContributorAuthor

Sorry, I didn't list all failing tests. Here are the rest:

=== release test-fs-open-mode-mask === Path: parallel/test-fs-open-mode-mask assert.js:86 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 416 !== 420 at test (/home/i8-pi/src/node/test/parallel/test-fs-open-mode-mask.js:25:12) at Object.<anonymous> (/home/i8-pi/src/node/test/parallel/test-fs-open-mode-mask.js:41:1) 
=== release test-fs-promises-file-handle-chmod === Path: parallel/test-fs-promises-file-handle-chmod (node:9455) ExperimentalWarning: The fs.promises API is experimental /home/i8-pi/src/node/test/common/index.js:690 const crashOnUnhandledRejection = (err) =>{throw err}; ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: 288 !== 292 at validateFilePermission (/home/i8-pi/src/node/test/parallel/test-fs-promises-file-handle-chmod.js:22:10) 

so this isn't purely a tmpdir issue

I would consider the umask part of the test environment that the test framework should sanitize before each run, just like with environment variables. A common entry point to all test would be the best place to set it, if the Python test runner is not such a place

If there are tests that should be run with a different umask, I think they should be separate tests where we explicitly override the default, so a single test run covers all cases

@Trott
Copy link
Member

so this isn't purely a tmpdir issue

All of the listed failures are indeed the same tmpdir issue (which makes sense because tests generally shouldn't be creating files outside of tmpdir).

I would consider the umask part of the test environment that the test framework should sanitize before each run, just like with environment variables. A common entry point to all test would be the best place to set it, if the Python test runner is not such a place

If there are tests that should be run with a different umask, I think they should be separate tests where we explicitly override the default, so a single test run covers all cases

That all makes a lot of sense to me. Perhaps both things should be done.

@Trott
Copy link
Member

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 26, 2018
@Trott
Copy link
Member

Belated welcome @i8-pi and thanks for the pull request! As you might guess, reviews can be a bit slow to happen this time of year, even for simple changes, so thanks in advance for your patience.

@TrottTrott mentioned this pull request Dec 26, 2018
2 tasks
Copy link
Member

@bnoordhuisbnoordhuis left a comment

Choose a reason for hiding this comment

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

@addaleax
Copy link
Member

@addaleax
Copy link
Member

Landed in ee592c3

@addaleaxaddaleax closed this Jan 2, 2019
addaleax pushed a commit that referenced this pull request Jan 2, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: #25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit that referenced this pull request Jan 5, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: #25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Trott added a commit to Trott/io.js that referenced this pull request Jan 9, 2019
nodejs#25213 proposes setting umask in the Python test runner to avoid spurious test failures when running from a shell with a restrictive umask. This is a good idea, but will only fix the issue for tests run with the Python runner. Set it in `common/index.js` as well so that it fixes it even when tests are run directly with a `node` binary, bypassing the Python test runner.
Trott added a commit to Trott/io.js that referenced this pull request Jan 10, 2019
nodejs#25213 proposes setting umask in the Python test runner to avoid spurious test failures when running from a shell with a restrictive umask. This is a good idea, but will only fix the issue for tests run with the Python runner. Set it in `common/index.js` as well so that it fixes it even when tests are run directly with a `node` binary, bypassing the Python test runner. PR-URL: nodejs#25229 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: nodejs#25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit that referenced this pull request Jan 14, 2019
#25213 proposes setting umask in the Python test runner to avoid spurious test failures when running from a shell with a restrictive umask. This is a good idea, but will only fix the issue for tests run with the Python runner. Set it in `common/index.js` as well so that it fixes it even when tests are run directly with a `node` binary, bypassing the Python test runner. PR-URL: #25229 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@BridgeARBridgeAR mentioned this pull request Jan 16, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: nodejs#25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
nodejs#25213 proposes setting umask in the Python test runner to avoid spurious test failures when running from a shell with a restrictive umask. This is a good idea, but will only fix the issue for tests run with the Python runner. Set it in `common/index.js` as well so that it fixes it even when tests are run directly with a `node` binary, bypassing the Python test runner. PR-URL: nodejs#25229 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Jan 24, 2019
BethGriggs pushed a commit that referenced this pull request Apr 28, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: #25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
@BethGriggsBethGriggs mentioned this pull request May 1, 2019
BethGriggs pushed a commit that referenced this pull request May 10, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: #25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 16, 2019
Some tests which create files and check file permissions assume the umask is compatible with 022, and break when set to something like 007. Explicitly set umask to 022 PR-URL: #25213 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.testIssues and PRs related to the tests.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@i8-pi@Trott@addaleax@bnoordhuis@nodejs-github-bot