Problems generating reproducer files

Template for a good new topic, formatted with Markdown:

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used when applicable (private details masked)
  • Languages of the repository C++
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  1. In argument sonar.cfamily.reproducer of SonarCloudPrepare@4 forwar slashes are required. On Windows build agents, the $(Build.SourcesDirectory) environment variable contains backslashes.

    ##[error]12:54:35.97 ERROR:
    The sonar.cfamily.reproducer property was set but no matching file was found. The property was set to:
    ‘D:_1\7\s\source\<Project>\<FileName>.ixx’
    

    Workaround: you have to force to a specific self-hosted build server, get the error message from the first run and then put the path exactely as given and run again on the same build server. (The directory number between build servers differ.)

  2. You are not allowed to use ' to format the path.
    Workaround: As I had no spaces in the folder names, sonar.cfamily.reproducer=D:/_1/35/s/source/.... worked.

  3. Uploading of the generated reproducer *.tar.xz was blocked.
    Workaround: rename it to *.tarxz

  4. In SonarCloudAnalyze@4 several errors are reported, even when the reproducer was generated.

08:47:50.498  INFO: Compilation database was generated by build-wrapper 6.78
##[error]08:47:50.628  ERROR: Requesting reproducer for: D:/_1/35/s/source/WT.NXG.ComputeEngines/AbstractionsDataTypes.ixx
08:47:50.628  ERROR: Requesting reproducer for: D:/_1/35/s/source/WT.NXG.ComputeEngines/AbstractionsDataTypes.ixx
##[error]08:47:50.64  ERROR: Requesting reproducer for: D:/_1/35/s/source/WT.NXG.ComputeEngines/AbstractionsDataTypes.ixx
08:47:50.64  ERROR: Requesting reproducer for: D:/_1/35/s/source/WT.NXG.ComputeEngines/AbstractionsDataTypes.ixx

08:47:56.734  INFO: [1/1] Finished analyzing: D:/_1/35/s/source/WT.NXG.ComputeEngines/AbstractionsDataTypes.ixx (68ms)
##[error]08:47:56.739  ERROR: 
A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  D:\_1\35\sonar-cfamily-reproducer.tar.xz
08:47:56.739  ERROR: 
A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  D:\_1\35\sonar-cfamily-reproducer.tar.xz
...
##[error]08:48:02.98  ERROR: Error during SonarScanner Engine execution
java.lang.IllegalStateException: 
A file named "sonar-cfamily-reproducer.tar.xz" has been generated to help the problem investigation.
...
##[error]08:48:03.345  The scanner engine did not complete successfully
08:48:03.345  The scanner engine did not complete successfully
##[error]08:48:03.345  Post-processing failed. Exit code: 1
08:48:03.345  Post-processing failed. Exit code: 1

##[error][ERROR] SonarQube Cloud: Error while executing task Analyze: The process 'D:\_1\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\4.1.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
##[error]The process 'D:\_1\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\4.1.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1

1 Like

Hello @milbrandt, and thank you for sharing your experience with us,

Unfortunately, due to the way sonar.cfamily.reproducer is currently implemented, the path should be provided exactly as printed by previous analysis logs. This is currently the recommended way to use this property. The idea is to make sure the correct match is found and to avoid any heuristics.

It is not entirely clear to me how are you passing this property using the SonarCloudPrepare action. Are you using extraProperties?

My recommendation would be to skip the YAML/Azure DevOps layer here, and provide the property in your sonar-project.properties (the name of the file can be customized by the configFile AzDo task input).
In the .properties file, you can specify backslashes, but they should be escaped. For example:

sonar.cfamily.reproducer=D:\\_1\\7\\s\\source\\<Project>\\<FileName>.ixx

Unless I am missing something, I don’t think that ' is normally needed. Once you are in the .properties file, spaces within the value don’t need to be escaped. The formal docs for this format can be found here. The summary is that we normally only need to escape backslashes in this case.

When this property is set, analysis fails by design (because it doesn’t try to report issues back to the SonarQube Server/Cloud). It only produces the .tar.xz file intended to be shared with us for further investigation. This is what these errors are trying to communicate. They can be safely ignored.

Note that this property is only meant to be used when tracking down some analyzer bugs. Thanks for your feedback, I will document these caveats so that they are communicated with users when asking for reproducers…

Thanks for highlighting this, I am checking if I can get .tar.xz as one of the approved extensions on this platform.

I can’t seem to find the generated reproducer in this thread though. Would you like me to start a thread with you so that you can share it privately?

Thanks for sharing the feedback,
Michael

Hello @michael.jabbour

yes, I use the azure-pipelines.yml and there the extraProperties in the prepare task to be as near as possible to our regular work flow for reproduction.

ok, I was asked from your colleague to generate a reproducer. As usual I specified everything in the YAML pipeline, and there it is safer to encapsulate file paths which might contain whitespaces with ’ or ".

This was already addressed by @ganncamp, see her note in cpp:S3470 for overloading std::hash - #12 by ganncamp

The reproducer was uploaded in cpp:S3470 for overloading std::hash - #11 by milbrandt and Together with @JolyLoic we learned more on caveats of the C++ standard.

1 Like

Thanks for taking the time to provide this feedback @milbrandt.

1 Like