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

EACCES error when running cspell in a docker container #1510

Closed
4 of 18 tasks
pingvinen opened this issue Aug 13, 2021 · 4 comments · Fixed by #1512
Closed
4 of 18 tasks

EACCES error when running cspell in a docker container #1510

pingvinen opened this issue Aug 13, 2021 · 4 comments · Fixed by #1512

Comments

@pingvinen
Copy link

Info

Kind of Issue

  • runtime - command-line tools
  • building / compiling
  • security
  • change in behavior
  • crash / error

Which Tool or library

  • cspell -- the command-line spelling tool
  • cspell-tools -- used for building dictionary files
  • cspell-lib -- library that does the actual spell checking.
  • cspell-trie -- tool for working with trie files.

Which Version

Version: 5.6.6

Issue with supporting library?

  • No
  • cspell-glob -- library for matching glob patterns
  • cspell-io -- thin file i/o library
  • cspell-trie-lib - trie lib
  • cspell-trie2-lib - trie lib alternate format

OS:

  • Macos
  • Linux
  • Windows
  • Other

version:

OS version if applicable.

Not sure if this is applicable, but the container is an Alpine 3.14 and my actual machine is running Ubuntu 20.04.

Bug Description

Describe the bug

I have made a Dockerfile with Node 16.6.2 and when I run cspell (cspell 'src/**/*.md') the below error is written to the console. The spellcheck is still performed, so this is more of a nuisance than anything else. I do have a cspell.json file in the directory from which I am running cspell.

> cspell 'src/**/*.md'

Error: EACCES: permission denied, open '/root/.config/configstore/cspell.json'
You don't have access to this file.

    at Object.openSync (node:fs:582:3)
    at Object.readFileSync (node:fs:450:35)
    at Configstore.get all [as all] (/app/repository/node_modules/configstore/index.js:34:25)
    at Object.getRawGlobalSettings (/app/repository/node_modules/cspell-lib/dist/Settings/GlobalSettings.js:20:30)
    at Object.getGlobalSettings (/app/repository/node_modules/cspell-lib/dist/Settings/CSpellSettingsServer.js:465:45)
    at determineFinalDocumentSettings (/app/repository/node_modules/cspell-lib/dist/spellCheckFile.js:179:103)
    at spellCheckFullDocument (/app/repository/node_modules/cspell-lib/dist/spellCheckFile.js:116:25)
    at async processFile (/app/repository/node_modules/cspell/dist/lint.js:53:23)
    at async Object.measurePromise (/app/repository/node_modules/cspell/dist/util/timer.js:8:9)
    at async processFiles (/app/repository/node_modules/cspell/dist/lint.js:111:39) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/root/.config/configstore/cspell.json'
}

To Reproduce

Steps to reproduce the behavior:

I have a repository with the setup: https://github.com/pingvinen/cspell-eaccess-in-docker-container-issue

  1. Create Dockerfile with node and cspell that can be run with docker-compose
  2. Trigger the cspell command either by entering the container by running /bin/sh or by triggered the npm script directly
  3. See error

Expected behavior

I would not expect it to complain, as there is a config file (cspell.json) in the same directory that I am running cspell from. When I try this exact same setup outside of the docker container (using the same cspell and node versions), cspell runs without that issue and I do not have a ~/.config/configstore/cspell.json file, so it is clearly not required to make the software work.

Screenshots

Not relevant

Additional context

Nothing further to add.

cspell.json

This is also available in the example repository mentioned above, but here is a copy as well:

{
    "language": "en",
    "allowCompoundWords": true,
    "words": [
        "OWASP",
        "frontends",
        "backends",
        "hotspot",
        "tika",
        "modelmapper",
        "jjwt",
        "joda",
        "pincode",
        "automagically",
        "callout"
    ]
}

Example Repository (Optional)

https://github.com/pingvinen/cspell-eaccess-in-docker-container-issue

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 13, 2021

Excellent report!

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 13, 2021

I checked the code, it only logs the message it got from configstore, but it doesn't prevent the spell checker from running.

I put up a fix to clean up the log in #1512

@pingvinen
Copy link
Author

Thank you :)

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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

Successfully merging a pull request may close this issue.

2 participants