gwomacks / php-debug

Atom Text Editor package for PHP debugging
MIT License
119 stars 31 forks source link

Uncaught Error: EACCES: permission denied, scandir 'data' #275

Closed ghost closed 6 years ago

ghost commented 6 years ago

[Enter steps to reproduce:]

  1. Set up debugging
  2. Set up a breakpoint
  3. Have a folder in your project that contains data and is not readable or traversable by the current user
  4. Error ensues

In my case, this is a folder created by docker and which is owned by the root user, which I have no access to without root permissions, and is only used by the container.

Atom: 1.26.1 x64 Electron: 1.8.4 OS: linux 4.16.5-1-ARCH Thrown From: php-debug package 0.3.0

Stack Trace

Uncaught Error: EACCES: permission denied, scandir '/home/user/project/data'

At /home/user/.atom/packages/php-debug/node_modules/@mrmlnc/readdir-enhanced/lib/call.js:51

Error: EACCES: permission denied, scandir '/home/user/project/data'
    at Object.fs.readdirSync (fs.js:910:18)
    at Object.fs.readdirSync (ELECTRON_ASAR.js:578:28)
    at exports.readdir (/packages/php-debug/node_modules/@mrmlnc/readdir-enhanced/lib/sync/fs.js:18:20)
    at /packages/php-debug/node_modules/@mrmlnc/readdir-enhanced/lib/call.js:24:8)
    at DirectoryReader.readNextDirectory (/packages/php-debug/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:78:10)
    at Readable.DirectoryReader.stream._read (/packages/php-debug/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:57:18)
    at Readable.read (_stream_readable.js:431:10)
    at maybeReadMore_ (_stream_readable.js:525:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
cchamplin commented 6 years ago

So this is an interesting issue. My guess is it's related to the glob we do over the projects in atom to try and match pathmaps automatically.

You might be able to solve by manually setting the pathmap via the button on the top right, otherwise I might be able to add a config option to not perform the directory scan...

ghost commented 6 years ago

Thanks for your response.

Unfortunately even clicking that button causes a similar error. I've tried manually configuring a path map to my project folder (which is a higher-level directory), but it doesn't seem to help. Another solution may be to move all such folders out of my project, but it is a bith comparable to the var directory for Symfony, in which cache files and such are stored that are created by the server inside a container (i.e. as another user), so moving them all out would be very difficult.

Is there perhaps a way to try-catch the EACCESS and skip the folder?

Thanks!

cchamplin commented 6 years ago

@tominventisbe v0.3.4 just landed and has a setting to turn off the project scan on missing path maps. Let me know if this resolves your issue: projectScan - "Automatically scan projects in Atom to try and find path maps"

ghost commented 6 years ago

That seems to have done the trick, thanks!