Error during SonarAnalysis: InvalidPathException: Illegal char <<> at index 0: <enter\

Hello,

We use SonarCloud to analyse our code, and lately we tried to analyse our embededd code which is compile by Clang.

Sonar analysis is launched with AzureDevOps and the prepare analysis step is done with those parameters:

sonar.host.url=https://sonarcloud.io
sonar.cfamily.build-wrapper-output=C:\BuildWrapper\ArtefactStagingDirectory
sonar.cfamily.threads=4
sonar.css.node= "C:\Program Files\nodejs"
sonar.cfamily.cache.enabled=true
sonar.cfamily.cache.path=$(Build.BinariesDirectory)/SonarCacheDev203
sonar.log.level=TRACE

An analysis has been alreade correctly done, but when we include in the source files our drivers code we got this error during the analysis step:

ERROR: Error during SonarScanner execution
##[error]java.nio.file.InvalidPathException: Illegal char <<> at index 0: <enter\

You can find complete log into the linked file.

Do you have a way to know on which file this error occur?

Do you know this kind of error and how I can fix it maybe ?

Thank you for your help
LogErrorSonar.txt (879.9 KB)

Hello @AlexJulita,

You seem to have the “<enter …” string that is used in place of a filepath. Could it be that you did not replace some placeholder like “<enter path here>”?

For starters, can you, please, provide the sonar-project.properties as well as the invocation line of sonar-scanner?

Hello @necto ,
Thank you for your answer!

So, we use SonarCloud GUI and we don’t use a sonar-project.properties file to configure the scanner. The only tune thing we give to the scanner is on our pipeline, the “prepare analysis” phase, here is the yaml :

steps:

  • task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
    displayName: ‘Prepare analysis on SonarCloud’
    inputs:
    SonarCloud: ‘SonarCloud IC Tiama’
    organization: ‘nicolas-courtiller19594’
    scannerMode: CLI
    configMode: manual
    cliProjectKey: ‘TIAMA_MonoRepos_099-42-TR_HotMass2_Embedded’
    cliProjectName: ‘TR HotMass2 Embedded’
    cliSources: ‘Core,DetAspect,DetHotMassNG,DetRadiation’
    extraProperties: |
    sonar.host.url=https://sonarcloud.io
    sonar.cfamily.build-wrapper-output=C:\BuildWrapper\ArtefactStagingDirectory
    sonar.css.node= “C:\Program Files\nodejs”
    sonar.cfamily.cache.enabled=true
    sonar.cfamily.cache.path=$(Build.BinariesDirectory)/SonarCacheDev203
    sonar.log.level = TRACE

So I guess this is mostly by default configuration.

The main issue is that if I don’t exclude 1 specific folder, this error occurs else the analysis works fine.

Here is the list of exclusion working:
(without the CALIA4 exclusion the error occurs)

Have you configured the full pipeline required for C and C++ analysis?
You can follow the “Analyzing a C/C++/Obj-C project” section in SonarQube documentation on Azure DevOps integration.
Note that configuring the “prepare analysis” step is not enough: you need to also download the Build Wrapper before the analysis step and invoke it with your build command (in the “Command Line” task).

Yes,
image

the full pipeline is working; when we exclude the folder CALIA4 we can see the analysis result on Sonar Cloud.

Do you think this error could be cause by an erroneous file at the time of its analysis or it is for sure a problem on the configuration side?

When you “can see the analysis result”, do you see any C or C++ issues on SonarCloud?

Can you, please, share the contents of the build-wrapper-output directory (i.e. “C:\BuildWrapper\ArtefactStagingDirectory”) after the compilation (you will probably need to insert a command after the “Compile Workbench pour VisioCxp” step)?

Yes I see every C++ issues on SonarCloud when I exclude the folder that make the analysis fail

We run it on our own VM so here is the build-wrapper log and json. This is from my last run with the same java.nio.file.InvalidPathException: Illegal char <<> at index 0: <enter\

Thank you for your help
build wrapper outpu.zip (1.0 MB)

Thank you for the BuildWrapper output, it gave me a better insight into your compilation process. Here is one of the compilation commands that you execute when building the project:

c:\vx7_SR0610\compilers\llvm-10.0.1.1\WIN64\bin\clang
-O2
-g2
-fno-builtin
--target=arm64
-ffixed-x18
-D__vxworks
-D__VXWORKS__
-D__ELF__
-D_HAVE_TOOL_XTORS
-nostdlibinc
-nostdinc++
-ftls-model=local-exec
-fno-builtin
-fno-strict-aliasing
-D_USE_INIT_ARRAY
-mllvm
-two-entry-phi-node-folding-threshold=2
-mno-implicit-float
-std=c++14
-Wno-nonportable-include-path
-Werror=return-type
-Werror=tautological-constant-out-of-range-compare
-Werror=constant-conversion
-MD
-MP
-DCPU=_VX_ARMARCH8A
-DTOOL_FAMILY=llvm
-DTOOL=llvm
-D_WRS_KERNEL
-D_WRS_VX_SMP
-D_WRS_CONFIG_SMP
-D_VSB_CONFIG_FILE="D:\AzDvOps_work\40\s\Core\CALIA4\VSB-CALIA4-SMP\h\config\vsbConfig.h"
-DARMEL
-U__USER_LABEL_PREFIX__
-D__USER_LABEL_PREFIX__=
-DCALIA3
-DCALIA4
-DEMBEDDED
-DZ_PREFIX
-DFREE_X8
-DEDX_EMBARQUE
-ID:\AzDvOps_work\40\s\Core\CALIA4\VSB-CALIA4-SMP\share\h
-isystemD:\AzDvOps_work\40\s\Core\CALIA4\VSB-CALIA4-SMP\krnl\h\system
-isystemD:\AzDvOps_work\40\s\Core\CALIA4\VSB-CALIA4-SMP\krnl\h\public
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\bati\LibEdxC3\LIBS\Interface
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\bati\LibEdxC3\LIBS\vxWorks\DRV_C3
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\bati\LibEdxC3\LIBS\vxWorks\LIBS_C3
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\bati
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\..\LibDataModel
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\Bati\LibsSiso\Runtime\include
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\Bati\LibsSiso\Runtime\siso_genicam\interface
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\CommunDet\Cls
-ID:\AzDvOps_work\40\s\Core\CALIA4\DKMlib_Libs_C4\..\..\bati\Cls
-I<enter your include search path here>
-o DKMlib_Libs_C4_partialImage\NonDebug\Objects\DKMlib_Libs_C4\LIBS_C4\LibAcqTrt\LibAcqTrt.o
-c D:\AzDvOps_work\40\s\Core\CALIA4\LIBS_C4\LibAcqTrt\LibAcqTrt.cpp

Note the line

-I<enter your include search path here>

This line uses an invalid path “<enter” as a user-provided include directory. This is the cause of your analysis failure, as our analyzer does not accept an invalid path for an include directory.

In order to avoid the analysis failure, you should remove the -I<enter your include search path here> option wherever it comes from.

Let me know if you have further questions

2 Likes

Correction has been done and this was the reason of the failure !!

Thank you very much for your support, I think without you I could’nt find why!

Have a nice day,

See you !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.