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

Quote double-quotes and include dummy commands #1

Closed
wants to merge 4 commits into from

Conversation

d3m3t3r
Copy link
Contributor

@d3m3t3r d3m3t3r commented May 22, 2024

Fixes for invalid JSON generated in the two following cases:

  1. Empty sections if no source files are found within the command. E.g.
[,,,,,,,,,,
  {
},,,
}
{

I decided to still include a "dummy" section with null file rather than completely ignoring such commands just to have a record of such a thing happening. Tools like clangd do not care.

  {
    "directory": "/home/user",
    "command": "gcc -v ",
    "file": null
  },
  1. Unquoted double-quotes in arguments. E.g.:
     "-DPREFIX="/usr"",

@i-ky i-ky self-assigned this May 23, 2024
@i-ky
Copy link
Owner

i-ky commented May 23, 2024

Hi, @d3m3t3r!

First of all, thank you for your interest in this project! I highly appreciate your contribution.

Fixes for invalid JSON generated in the two following cases:

May I ask you to submit fixes for these two issues separately? Just to keep commit history organized.

  1. Empty sections if no source files are found within the command.

Oops, this is obviously a bug that needs to be fixed. However...

I decided to still include a "dummy" section with null file rather than completely ignoring such commands just to have a record of such a thing happening. Tools like clangd do not care.

... I am not sure that this is the best course of action. Compilation Database Format says:

file: The main translation unit source processed by this compilation step. This is used by tools as the key into the compilation database. There can be multiple command objects for the same file, for example if the same source file is compiled with different configurations.

There is no mention that it may be null. And while clangd does not care, there may be other tools that do. Since interoperability is at stake, I would like to follow the format description as closely as possible.

  1. Unquoted double-quotes in arguments.

Good catch! " is not the only character that needs escaping. \ and codepoints in 0-1F range need escaping as well.

Please let me know if you would like to continue working on the fixes or you would prefer me to take it further. In the latter case, I would be glad to mention you as a co-author if you share the required information.

@d3m3t3r
Copy link
Contributor Author

d3m3t3r commented May 24, 2024

May I ask you to submit fixes for these two issues separately?

Like separate (less sloppy) commits or even PRs?

... I am not sure that this is the best course of action. Compilation Database Format says:

What I wanted was to include those previously ignored commands in the output for debugging. Perhaps, only when some command-line option is used? I've simplified it in a recent commit a lot. Still it's not really important feature and can be completely dismissed.

Please let me know if you would like to continue working on the fixes or you would prefer me to take it further.

I'll try to create a new, nicer PR in some time but I really don't care what you do with the code, feel free to pick only parts. No "co-authoring" necessary.

@i-ky
Copy link
Owner

i-ky commented May 24, 2024

Like separate (less sloppy) commits or even PRs?

Separate PRs would be perfect. It is much easier to review and discuss one feature/bugfix at a time.
But also separate commits are OK, they can be cherry-picked.
I assume you are just fixing issues as you encounter them while using the tool.

... I am not sure that this is the best course of action. Compilation Database Format says:

What I wanted was to include those previously ignored commands in the output for debugging.

For debugging of basset or your build process?

Perhaps, only when some command-line option is used?

There is some support for --verbose option, which dumps some information to cerr during the run.
I guess not it's only in main(), but it can be implemented in other places as well, if needed.

I'll try to create a new, nicer PR in some time but I really don't care what you do with the code, feel free to pick only parts. No "co-authoring" necessary.

Sure, no rush. I really value your contributions. Please feel free to share any feedback on the project (not just code fixes, but issues reports and feature requests).

I have switched workplace and I no longer have a use case for basset, but I am still willing to improve the tool and will gladly spend some free time on it.

@d3m3t3r
Copy link
Contributor Author

d3m3t3r commented May 27, 2024

Replaced this PR by three hopefully better ones.

@d3m3t3r d3m3t3r closed this May 27, 2024
@d3m3t3r d3m3t3r deleted the fix-json branch May 29, 2024 13:53
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

Successfully merging this pull request may close these issues.

None yet

2 participants