Search hangs on files which atom does not have permission to read


#1

As said, the ‘project find’ hangs when it tries to read a file which it does not have permission to read. It actually dumps a trace in the console, but does not seem to pop it open by default, making it look like the search has frozen.

You can duplicate this by doing the following in an empty directory.

echo string > 1; cp 1 2; cp 1 3; chmod 0 2; atom .

When this folder is opened, do search in project for the string ‘string’. It will find the string in file 1, and then hang, never finding the string in file 3.

If you pop open the developer tools by hand, we find:

Bad argument TypeError: Bad argument
  at Object.fs.closeSync (fs.js:383:18)
  at ChunkedLineReader.module.exports.ChunkedLineReader._read (/Applications/Atom.app/Contents/Resources/app/node_modules/scandal/lib/chunked-line-reader.js:90:12)
  at ChunkedLineReader.Readable.read (_stream_readable.js:334:10)
  at ChunkedLineReader.Readable.resume (_stream_readable.js:704:12)
  at ChunkedLineReader.Readable.on (_stream_readable.js:670:10)
  at PathSearcher.module.exports.PathSearcher.searchPath (/Applications/Atom.app/Contents/Resources/app/node_modules/scandal/lib/path-searcher.js:79:21)
  at searchPath (/Applications/Atom.app/Contents/Resources/app/node_modules/scandal/lib/single-process-search.js:40:23)
  at PathScanner.maybeSearchPath (/Applications/Atom.app/Contents/Resources/app/node_modules/scandal/lib/single-process-search.js:54:16)
  at PathScanner.EventEmitter.emit (events.js:123:20)
  at PathScanner.module.exports.PathScanner.processFile (/Applications/Atom.app/Contents/Resources/app/node_modules/scandal/lib/path-scanner.js:74:21)
  at /Applications/Atom.app/Contents/Resources/app/node_modules/scandal/lib/path-scanner.js:47:17
  at Object.oncomplete (fs.js:97:15)

#2

Can you file an issue here https://github.com/atom/find-and-replace/issues ?

There the devs/collaborators can see the bug.

Thanks.