irony-mode icon indicating copy to clipboard operation
irony-mode copied to clipboard

Input file not stripped from compile options causing crash in irony-server

Open ratelle opened this issue 6 years ago • 0 comments

When editing files through symlinks or editing files that are present as a symlink in the compilation database, irony-server get-compile-options compares true names and resolves to the proper entry in the compilation database. irony-cdb-json--adjust-compile-options expects to remove the exact filename and fails to do so.

For example

compile_commands.json has an entry for /path/to/project/symlink-to-submodule/file.c /path/to/project/symlink-to-submodule/file.c is a symlink to /path/to/project/.submodules/subproject/lib/file.c

When calling irony-server get-compile-options /path/to/project/.submodules/subproject/lib/file.c we'll get back the entry for /path/to/project/symlink-to-submodule/file.c

When irony-cdb-json--adjust-compile-options is called on the list of arguments, the buffer filename and the source file in the list of options -c /path/to/project/symlink-to-submodule/file.c will be different and the file doesn't get stripped.

This causes irony-server to crash during parse.

Solution is either to remove the pair '-c /path/to/file' entirely like is done for -o instead of doing it piecewise. An alternative would be to compare true names but I don't think it required.

ratelle avatar Oct 26 '17 19:10 ratelle