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

Fix chmod error when different owner's dir exists in preprocess-cache #491

Merged
merged 1 commit into from
Sep 7, 2015

Conversation

yudoufu
Copy link
Contributor

@yudoufu yudoufu commented Sep 7, 2015

If /tmp/jest_preprocess_cache already exists by different owner then preprocess-cache raises chmodSync permission error.

e.g. When many users run Jest on a shared-server, raise following error:

Error: /<snip>/node_modules/babel-jest: EPERM, operation not permitted '/tmp/jest_preprocess_cache'
  at Object.fs.chmodSync (fs.js:833:18)
  at Object.readAndPreprocessFileContent (/<snip>/node_modules/jest-cli/src/lib/utils.js:392:12)
  at Loader._execModule (/<snip>/node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:209:11)
  at Loader.requireModule (/<snip>/node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:914:12)
  at jasmineTestRunner (/<snip>/node_modules/jest-cli/src/jasmineTestRunner/jasmineTestRunner.js:292:16)
  at /<snip>/node_modules/jest-cli/src/TestRunner.js:376:12
  at tryCatcher (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/util.js:26:23)
  at Promise._settlePromiseFromHandler (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/promise.js:503:31)
  at Promise._settlePromiseAt (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/promise.js:577:18)
  at Promise._settlePromises (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/promise.js:693:14)
  at Async._drainQueue (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/async.js:123:16)
  at Async._drainQueues (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/async.js:133:10)
  at Async.drainQueues (/<snip>/node_modules/jest-cli/node_modules/bluebird/js/main/async.js:15:14)
  at process._tickCallback (node.js:448:13)

So, I fixed it.

@yudoufu yudoufu changed the title Fix chmod error when different owner's dir exists Fix chmod error when different owner's dir exists in preprocess-cache Sep 7, 2015
@cpojer
Copy link
Member

cpojer commented Sep 7, 2015

Thank You!

cpojer added a commit that referenced this pull request Sep 7, 2015
Fix chmod error when different owner's dir exists in preprocess-cache
@cpojer cpojer merged commit 345cc96 into jestjs:master Sep 7, 2015
@jsdf
Copy link
Contributor

jsdf commented Sep 10, 2015

This change shouldn't have removed the handling for the EEXIST error. There is a race condition which now occurs when the preprocess cache dir is created by another process in between the fs.existsSync check and the fs.mkdirSync, which is quite likely seeing as all the workers are trying to create it at the same time.

@jsdf
Copy link
Contributor

jsdf commented Sep 10, 2015

The issue experienced by @yudoufu would be fixed by the combination of the preprocess cache dir respecting the cache dir config (#470) and ensuring that the configured cache dir is somewhere that the user has the correct permissions for.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants