Running in docker, getting java.io.IOException: Operation not permitted after cannot get canonical path

#bug:fault

SonarScanner 4.6.2.2472
Java 11.0.11 AdoptOpenJDK (64-bit)
Linux 4.15.0-144-generic amd64
Project root configuration file: /usr/src/sonar-project.properties
Analyzing on SonarQube server 8.8.0

ERROR: cannot get canonical form of: '/usr/src/projects/xx2/loading/screens/../LoadingScreenAssets.h'
error	05-Aug-2021 14:57:06	java.io.IOException: Operation not permitted
error	05-Aug-2021 14:57:06		at java.base/java.io.UnixFileSystem.canonicalize0(Native Method)
error	05-Aug-2021 14:57:06		at java.base/java.io.UnixFileSystem.canonicalize(Unknown Source)
error	05-Aug-2021 14:57:06		at java.base/java.io.File.getCanonicalPath(Unknown Source)
error	05-Aug-2021 14:57:06		at java.base/java.io.File.getCanonicalFile(Unknown Source)
error	05-Aug-2021 14:57:06		at org.sonar.cxx.preprocessor.SourceCodeProvider.getSourceCodeFile(SourceCodeProvider.java:110)
error	05-Aug-2021 14:57:06		at org.sonar.cxx.preprocessor.CxxPreprocessor.findIncludedFile(CxxPreprocessor.java:1033)
error	05-Aug-2021 14:57:06		at org.sonar.cxx.preprocessor.CxxPreprocessor.handleIncludeLine(CxxPreprocessor.java:1194)
error	05-Aug-2021 14:57:06		at org.sonar.cxx.preprocessor.CxxPreprocessor.process(CxxPreprocessor.java:644)
error	05-Aug-2021 14:57:06		at com.sonar.sslr.impl.Lexer.preprocess(Lexer.java:153)
error	05-Aug-2021 14:57:06		at com.sonar.sslr.impl.Lexer.preprocess(Lexer.java:143)
error	05-Aug-2021 14:57:06		at com.sonar.sslr.impl.Lexer.lex(Lexer.java:132)
error	05-Aug-2021 14:57:06		at com.sonar.sslr.impl.Lexer.lex(Lexer.java:110)

I just start analyzing our entire c++ code base, which compiles just fine without these errors. I see this error repeat, and the path being observer grows with more and more relative markers, along the lines of:
abc/def/ghi/…/hjk/…/hjk/…/hjk/…/hjk/…/hjk/…/hjk/…/hjk/…/hjk/…/hjk/…/hjk/file.cpp
and I get the “cannot get the canonical form of” error then the operation not permitted error.
I have no idea what might be causing this.

Hi,

Welcome to the community!

It looks like you’re using the Cxx plugin which, as you may be aware, is in direct competition with our commercial offerings. So we can’t support you here. I suggest you raise an issue with the plugin authors.

 
Ann

Hi @raberto, I had a similar issue which I was able to solve.
Maybe my fix will also help you.
See https://community.sonarsource.com/t/running-in-docker-of-gitlab-ci-results-in-java-io-ioexception-operation-not-permitted-from-computecanonicalpath/49456/3

1 Like