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

Permission denied @ dir_chdir - /code (Errno::EACCES) #54

Closed
acarpe opened this issue Jul 13, 2015 · 8 comments
Closed

Permission denied @ dir_chdir - /code (Errno::EACCES) #54

acarpe opened this issue Jul 13, 2015 · 8 comments

Comments

@acarpe
Copy link

acarpe commented Jul 13, 2015

Installed via homebrew on osx 10.10.4.
Updated to version 0.0.22 via brew upgrade, re-ran codeclimate engines:install
Inside the project directory running codeclimate analyze I continue to get

Starting analysis
Running rubocop: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine rubocop failed with status 1 and stderr
"/usr/src/app/lib/cc/engine/rubocop.rb:16:in `chdir': Permission denied @ dir_chdir - /code (Errno::EACCES)\n\t
from /usr/src/app/lib/cc/engine/rubocop.rb:16:in `run'\n\t
from /usr/src/app/bin/codeclimate-rubocop:12:in `<main>'\n"
@pbrisbin
Copy link
Contributor

What are the permissions on the current directory where you run codeclimate analyze? You should be able to see that with stat . or ls -l ../.

@acarpe
Copy link
Author

acarpe commented Jul 13, 2015

Access: (0700/drwx------) Uid: ( 503/ silk) Gid: ( 20/ staff)

silk is my user id

@pbrisbin
Copy link
Contributor

So that is the issue. You've only given read access to the user bit. The group and (most importantly) all cannot read this directory.

7 - user (503/silk) can read (+4) / write (+2) / execute (+1)
0 - group (20/staff) can do nothing
0 - all can do nothing

Note: for directories "execute" means "able to change into the directory and/or list directory contents".

These are unusual permissions for a project directory and prevents anyone other than the user (503/silk) from entering the directory or seeing anything within it. This is also preventing our CLI from reading the code for the purposes of analysis (it does not run as you, it runs as a dedicated, unprivileged user).

I'd recommend opening up the permissions on this directory with chmod 755 .

7 - user can read/write/execute
5 - group can read/execute
5 - all can read/execute

If this gets you passed your current error but you find more permissions errors on files or directories within the project, it's possible they also have unexpectedly restrictive permissions on them as well. In that case you can either exclude them using exclude_paths or modify their permissions similarly.

@acarpe
Copy link
Author

acarpe commented Jul 13, 2015

changed permission (why not adding a check on permission before starting? ) and it has gone forward.
Now the issue seems to be about the exclude_paths not being considered:
Error: EACCES, permission denied '/code/vendor/assets/javascripts/fastclick.js

it started from the stuff in the public folder and in fact all files had wrong permission but adding:

exclude_paths:
- public
- public/**/*
- public/*

didn't work, at the end I updated all permissions inside public folder but it started the same behaviour in the vendor folder :(

@pbrisbin
Copy link
Contributor

Does

exclude_paths
- public/**
- vendor/**

Not work?

@pbrisbin
Copy link
Contributor

why not adding a check on permission before starting?

Unfortunately we have to prioritize improvements like this against all the other things we want to do and we just haven't gotten to it yet. Please know that it's on our roadmap though.

@pbrisbin
Copy link
Contributor

@acarpe i believe your issue is the same as #82, which we've hopefully just released a fix for. I'm going to close this and centralize discussion there.

Sorry for the troubles and the long time to fix, it was a much more complicated issue than it appeared.

@lucasmartins
Copy link

lucasmartins commented Jun 22, 2017

I've had the same problem, disabling SElinux "solves" it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants