Skip to content

no files found from JSON Compilation Database on linux if project contains upper case file names#2691

Closed
kragens wants to merge 1 commit intoSonarOpenCommunity:masterfrom
kragens:fix/UpperCaseJsonCompilationDatabase
Closed

no files found from JSON Compilation Database on linux if project contains upper case file names#2691
kragens wants to merge 1 commit intoSonarOpenCommunity:masterfrom
kragens:fix/UpperCaseJsonCompilationDatabase

Conversation

@kragens
Copy link
Copy Markdown

@kragens kragens commented Jun 7, 2024

convert files in JSON Compilation Database to lower case because unifyPath() converted file names to lower case


This change is Reviewable

… case on linux

convert files in JSON Compilation Database to lower case because unifyPath() converted file names to lower case
@kragens kragens changed the title files found from JSON Compilation Database empty on linux if project contains upper case file names no files found from JSON Compilation Database on linux if project contains upper case file names Jun 7, 2024
@guwirth guwirth added the bug label Jul 4, 2024
@guwirth
Copy link
Copy Markdown
Collaborator

guwirth commented Jul 4, 2024

Hi @kragens,

thanks for providing this. This issues seems to be related to #2700?

Not sure if your fix works on all operating systems. Reading here https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Troubleshooting-Reports#file-path-issues there are also case-sensitive operating systems where making all lower-case is not working?

Depending on the operating system and SonarQube Database settings paths can be case-sensitive (also on case-insensitive operating systems). Report sensors always try to restore the case-senitive path to avoid problems.

Have to check this.

Regards,

@guwirth guwirth self-requested a review July 4, 2024 06:26
var inputFilesInConfig = squidConfig.getFiles();
var result = StreamSupport.stream(inputFiles.spliterator(), false)
.filter(f -> inputFilesInConfig.contains(Path.of(f.uri())))
.filter(f -> inputFilesInConfig.contains(Paths.get((Path.of(f.uri()).toString()).toLowerCase(Locale.getDefault()))))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the operating system and SonarQube Database settings paths can be case-sensitive (also on case-insensitive operating systems). Think making it always lowercase does not work?

@guwirth
Copy link
Copy Markdown
Collaborator

guwirth commented Jul 8, 2024

Below the solution from the report sensors:

public InputFile getInputFileIfInProject(String path) {

private InputFile getInputFileTryRealPath(String path) {

@kragens
Copy link
Copy Markdown
Author

kragens commented Jul 11, 2024

thanks for providing this. This issues seems to be related to #2700?
I don't think so, because all files in compile_commands.json are lowercase in #2700

The problem here is that alle files in inputFilesInConfig were made lowercase by

return result.toLowerCase(Locale.getDefault());

@guwirth
Copy link
Copy Markdown
Collaborator

guwirth commented Jul 13, 2024

Hello @kragens, thx for the hint will have a look to it and try to find out why all is converted to lowercase …

guwirth added a commit to guwirth/sonar-cxx that referenced this pull request Aug 23, 2024
- the notation of paths in the db can deviate from the notation in the file system.
- restoring the spelling of paths from the file system
- close SonarOpenCommunity#2691
@guwirth guwirth closed this in 20c54bf Aug 27, 2024
@guwirth
Copy link
Copy Markdown
Collaborator

guwirth commented Aug 27, 2024

solved with #2725

@guwirth
Copy link
Copy Markdown
Collaborator

guwirth commented Aug 27, 2024

@kragens
Copy link
Copy Markdown
Author

kragens commented Mar 10, 2025

Tested successfully in release v2.2.0. thanks for fixing it @guwirth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants