compiledb
compiledb copied to clipboard
compiledb incorrectly strip quotes.
Version: using master at commit 88ec08ea36e097dbd8c5ee2ad6123274767d18ea Found this while trying to build kernel with compiledb.
> cat a.log
gcc -DKBUILD_MODNAME='"swap"' ./swap.c
> compiledb --parse a.log
## Processing build commands from a.log
## Writing compilation database with 1 entries to compile_commands.json
## Done.
> cat compile_commands.json
[
{
"directory": "/tmp",
"arguments": [
"gcc",
"-DKBUILD_MODNAME=swap",
"./swap.c"
],
"file": "./swap.c"
}
]
The single quotes in the argument disappear.
I noticed the same thing building Git (compiledb make
).
This seems to be an issue with bashlex, e.g.:
In [1]: import bashlex
In [2]: bashlex.parse("""gcc -DVERSION='"1.2.3.4"'""")
Out[2]: [CommandNode(parts=[WordNode(parts=[] pos=(0, 3) word='gcc'), WordNode(parts=[] pos=(4, 25) word='-DVERSION=1.2.3.4')] pos=(0, 25))]
This might be related to https://github.com/idank/bashlex/issues/26 and/or https://github.com/idank/bashlex/pull/56.