Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

Irony CDB trying to access a (nonexistent) file through tramp. #455

Closed emily33901 closed 4 years ago

emily33901 commented 6 years ago

I assume this is caused by irony trying to access a file that doesnt exist (hence ending up somewhere in tramp)...

The error in question Irony CDB: error in compilation database: (file-error "Tramp failed to connect. If this happens repeatedly, try ‘M-x tramp-cleanup-this-connection’")

My project is located at e:\src\project with the compilation commands in question being located at e:\src\project\compile_commands.json. I can access both the project directory and the compile commands file itself.

The paths in the cdb-json-projects file all seem to be correct aswell... So im not sure what it is actually attempting to access.

upon further inspection it does actually find the compile option file (irony-cdb-menu returns the correct compile options) however calling autosetup compile options will cause tramp to attempt to open a file every time.

gmittert commented 5 years ago

I've run into this, also on Windows. I took some time to look into it, but I can't figure out why tramp is getting called. For me, it finds and loads the json compile_commands.json, but fails later on. I know it's somewhere in irony-cdb-json--adjust-compile-options though.

Specifically eval'ing

(progn (require 'json) (mapcar (lambda (x) (let* ((directory (irony-cdb-json--compile-command-directory x))(path (expand-file-name (irony-cdb-json--compile-command-file x) directory))(options (irony-cdb-json--compile-command-options x))) (irony-cdb-json--adjust-compile-options options path directory))) (json-read-file (irony-cdb-json--locate-db))))

triggers the behaviour.

I can provide the compile_commands.json if that's helpful, though it's fairly long, 4400+ lines.

Gist: https://gist.github.com/jmittert/ad240020f526c7f2936b2ff0375198a8

emily33901 commented 5 years ago

I only had it happen in 1 repository out of my several C++ projects that I was using with irony mode at the time. All projects were located in the same folder and all had the compile commands in the root of the folder.