Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52864

Cppcheck plugin fails to resolve files in details view

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      In the cppcheck details view it is no longer possible to click on a file to show the source code. Switching back to 1.21 fixes the problem (also with the data generated with 1.23) so I assume the lookup code is somehow screwed up.

        Attachments

          Activity

          Hide
          ajjunior Aricio Joi Junior added a comment -

          I have some issues with cppcheck plugin when my job run in a slave node. Apparently, cppcheck store the full path off the source file based on the file system in the slave node, but the plugin runs on master node. Also I wish to use pipeline. I find a very simple work around that works with pipeline and slave node:

          1) run the cppcheck

          2) use https://github.com/danmar/cppcheck/tree/master/htmlreport to build html results 

          3) publish html on jenkins with Html Publish Plugin

          Example:

          cppcheck.exe .\ --force --xml-version=2 -q 2> cppcheck-result.xml
          python cppcheck-htmlreport --file=cppcheck-result.xml --title=Embedded --report-dir=.\cppcheckResult --report-dir=.\ --source-encoding="iso8859-1"

          The disadvantage for this approach is :

          • missing the tables, trend and graphical as result from the build
          • use of space in master node, once the target source files with errors will be stored on it.

          reference: https://dunterov.github.io/cppcheck/

           

          Show
          ajjunior Aricio Joi Junior added a comment - I have some issues with cppcheck plugin when my job run in a slave node. Apparently, cppcheck store the full path off the source file based on the file system in the slave node, but the plugin runs on master node. Also I wish to use pipeline. I find a very simple work around that works with pipeline and slave node: 1) run the cppcheck 2) use https://github.com/danmar/cppcheck/tree/master/htmlreport to build html results  3) publish html on jenkins with Html Publish Plugin Example: cppcheck.exe .\ --force --xml-version=2 -q 2> cppcheck-result.xml python cppcheck-htmlreport --file=cppcheck-result.xml --title=Embedded --report-dir=.\cppcheckResult --report-dir=.\ --source-encoding="iso8859-1" The disadvantage for this approach is : missing the tables, trend and graphical as result from the build use of space in master node, once the target source files with errors will be stored on it. reference:  https://dunterov.github.io/cppcheck/  
          Hide
          mike_pumford Mike Pumford added a comment -

          Seeing the same thing on my setup (again since 1.21). Based on the error output it the plugin seems to be assuming that the workspaces paths are the same on the build slave as on the master. This isn't true in our setup as the build slave does not have access to the master filesystem at all.

           

          However jenkins itself seems to have no problem displaying the workspace through the workspace link.

          Show
          mike_pumford Mike Pumford added a comment - Seeing the same thing on my setup (again since 1.21). Based on the error output it the plugin seems to be assuming that the workspaces paths are the same on the build slave as on the master. This isn't true in our setup as the build slave does not have access to the master filesystem at all.   However jenkins itself seems to have no problem displaying the workspace through the workspace link.
          Hide
          mike_pumford Mike Pumford added a comment - - edited

          While doing some jenkins updates I've now dug into this a little more deeply and I can now see exactly why the files are not being displayed. If I go to one of the summary view panes e.g.( cppcheckResult/source.all) I get an error like:

          Can't read file: /var/jenkins_home/jobs/<job-directory>/jobs/<jobname>/workspace-files/ed57db50.tmp

          However if I go and look at the jenkins_home on the masterI can see that the path should actually be:

          /var/jenkins_home/jobs/<job-directory>/jobs/<jobname>/builds/<build-number>/workspace-files/ed57db50.tmp

          So it just looks like the plugin is generating the wrong filesystem path( its missing the builds/<buildnumber> bit) and it has nothing to do with the difference in FS path between the jenkins master and the build slave as I get the same issue even if I make cppcheck produce workspace root relative paths for its errors using:

          -rp=$WORKSPACE

          In the cppcheck command line arguments.

          Show
          mike_pumford Mike Pumford added a comment - - edited While doing some jenkins updates I've now dug into this a little more deeply and I can now see exactly why the files are not being displayed. If I go to one of the summary view panes e.g.( cppcheckResult/source.all) I get an error like: Can't read file: /var/jenkins_home/jobs/<job-directory>/jobs/<jobname>/workspace-files/ed57db50.tmp However if I go and look at the jenkins_home on the masterI can see that the path should actually be: /var/jenkins_home/jobs/<job-directory>/jobs/<jobname>/builds/<build-number>/workspace-files/ed57db50.tmp So it just looks like the plugin is generating the wrong filesystem path( its missing the builds/<buildnumber> bit) and it has nothing to do with the difference in FS path between the jenkins master and the build slave as I get the same issue even if I make cppcheck produce workspace root relative paths for its errors using: -rp=$WORKSPACE In the cppcheck command line arguments.

            People

            • Assignee:
              marcosteffan Marco Steffan
              Reporter:
              chehrlic Christian Ehrlicher
            • Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated: