Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows PATH variables parsed with no '\' #124

Open
okuma10 opened this issue Aug 22, 2022 · 12 comments
Open

Windows PATH variables parsed with no '\' #124

okuma10 opened this issue Aug 22, 2022 · 12 comments

Comments

@okuma10
Copy link

okuma10 commented Aug 22, 2022

On windows using a PATH variable for includes ends up with a string with no ''
Example:
In Makefile: -I$(VK_SDK_PATH)/include
When make is run: -IC:\VulkanSDK\1.3.216.0/include
In compile_commands.json: -IC:VulkanSDK1.3.216.0/include

ydamigos added a commit to ydamigos/compiledb that referenced this issue Oct 26, 2022
Unescape input to bashlex parser.
It should address issues nickdiego#124, nickdiego#120

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
@arminveres
Copy link

I just noticed this issue as well. Is the PR #126 going to be merged i.e. the problem fixed in the foreseeable future?
Thanks for working on it @jinyi-x

@okuma10
Copy link
Author

okuma10 commented Nov 11, 2022

@arminveres did the fix worked for you? Nothing on my end

@arminveres
Copy link

arminveres commented Nov 11, 2022

@arminveres did the fix worked for you? Nothing on my end

Hi, I didn't try. So I am guessing it didn't work for you?
I just tried his branch, but it didn't do anything for me either.

@okuma10
Copy link
Author

okuma10 commented Nov 11, 2022

yes windows Path variables are without their "\" . I suppose it's a simple correction since everything is extracted correctly it just skips adding that character. I'll try to look into it next week.

@jinyi-x
Copy link

jinyi-x commented Nov 12, 2022 via email

@okuma10
Copy link
Author

okuma10 commented Nov 14, 2022

So I looked into it today and it appears the issue is due to this module --> bashlex, used to parse the command output from make
image

as you can see the preprocesed variable has the correct string, but the output of the bashlex.parser.parse() function is without the \\ character
image

Edit:
Adding a quick check for each character in preprocessed and if finding a '\' character and adding another fixed the issue. Oddly the clangd lsp server in nvim is having issues with the vulkan dir. but all else appears to be working fine and the compile_commands.json looks correct.

image

@okuma10
Copy link
Author

okuma10 commented Nov 15, 2022

I think this issue is solved by the above comment, maybe author can apply better change, but I also found this, trying to solve why the vulkan header wasn't being detected by nvim's clangd lsp.
image

Do you guys still get the same compile_commands.json ...with the arguments having " ' argument ' " instead of " argument "? @jinyi-x @arminveres

@arminveres
Copy link

I think this issue is solved by the above comment, maybe author can apply better change, but I also found this, trying to solve why the vulkan header wasn't being detected by nvim's clangd lsp. image

Do you guys still get the same compile_commands.json ...with the arguments having " ' argument ' " instead of " argument "? @jinyi-x @arminveres

Nicely done. It really solves it. I am also gettting the " ' ' " quotation. I haven't investigated it, I only ran a quick sed from inside neovim and now it works!

I think you should propose a PR for this.

@okuma10
Copy link
Author

okuma10 commented Nov 15, 2022

@arminveres I looked up an old compile_commands.json generated from compiledb and that didn't had the " ' ' ", so it might be something from the change. I'll take a look at it later and will try to find why it adds those quotation marks.

@okuma10
Copy link
Author

okuma10 commented Nov 15, 2022

@arminveres I looked it up and it appears the " ' ' " pattern is introduced by @jinyi-x 's solution of using repr(s).encode().decode() in the unescape(s) function at the end.
Not sure what exactly that function does as there are no comments, but on my end Windows10 Python 3.11 returning to the original output of s.encode().decode() was giving me errors that cannot read a byte at the end of the string. So I just returned s, and that appeared to work. Might be a good idea for @nickdiego to give his input on this.
The unescape() function is used in the parse_build_log() function at around line 140(on my end since I might have commented out prints above it)
image

@arminveres
Copy link

@okuma10 It seems to work, if you drop jinyi's solution and just add yours. I have not tried it on Linux, though.

@GitMensch
Copy link

#128 seems to also take this into account...

marzojr pushed a commit to marzojr/compiledb that referenced this issue Feb 22, 2024
Unescape input to bashlex parser.
It should address issues nickdiego#124, nickdiego#120

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
marzojr pushed a commit to marzojr/compiledb that referenced this issue Feb 22, 2024
Unescape input to bashlex parser.
It should address issues nickdiego#124, nickdiego#120

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants