[ https://issues.jenkins-ci.org/browse/JENKINS-12364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=161872#comment-161872 ]
SCM/JIRA link daemon commented on JENKINS-12364: ------------------------------------------------ Code changed in jenkins User: Gregory Boissinot Path: src/main/java/com/thalesgroup/hudson/plugins/cppcheck/CppcheckBuildAction.java src/main/java/org/jenkinsci/CppcheckSourceContainer.java src/main/java/org/jenkinsci/plugins/cppcheck/CppcheckPublisher.java src/main/java/org/jenkinsci/plugins/cppcheck/CppcheckResult.java src/main/java/org/jenkinsci/plugins/cppcheck/CppcheckSourceContainer.java http://jenkins-ci.org/commit/cppcheck-plugin/ba87566276c491cde5d621894e90dcca8f9fdb51 Log: Fix JENKINS-12364 > Cannot drill down to source code with cppcheck when build source is checked > out using SVN > ----------------------------------------------------------------------------------------- > > Key: JENKINS-12364 > URL: https://issues.jenkins-ci.org/browse/JENKINS-12364 > Project: Jenkins > Issue Type: Bug > Components: cppcheck > Affects Versions: current > Environment: Linux > Reporter: Chris Welch > Assignee: gbois > Priority: Minor > > Using the lastest cppcheck (v1.1). cppcheck is unable to produce linkable > references to the source code when Subversion is used to check out the code. > If you have a project that uses SVN, by default it is checked out into a sub > directory under the Jenkins workspace named as the last part of the > Subversion URL. This is document in Jenkins in the "If left empty" portion > of the optional module local directory: > "Specify a local directory (relative to the workspace root) where this module > is checked out. If left empty, the last path component of the URL is used as > the default, just like the svn CLI. A single period (.) may be used to check > out the project directly into the workspace rather than into a subdirectory." > So we have a project with a Subversion URL: > svn+ssh://svnhost/svnrep/branches/myproj_P2_0_0_cppcheck/myproj > As a result, our Jenkins workspace becomes: > /build/workspace/myproj_P2_0_0_cppcheck > and the source code is checked out in: > /build/workspace/myproj_P2_0_0_cppcheck/myproj > cppcheck is run from the Jenkins workspace: > /build/workspace/myproj_P2_0_0_cppcheck > and the cppcheck-results.xml file ends up in the Jenkins workspace: > /build/workspace/myproj_P2_0_0_cppcheck/cppcheck-results.xml > But, the cppcheck reporter is not using the Jenkins workspace as the root for > references in cppcheck-results.xml (/build/workspace/myproj_P2_0_0_cppcheck). > The cppcheck reporter is using the SVN check out location to generate the > report (/build/workspace/myproj_P2_0_0_cppcheck/myproj). > Here is an entry from the cppcheck-results.xml file: > <error file="/myproj/ADI Sharc/Shared/EDFA/deviceClass.c" > id="s_tempStorageAssignment" line="34" msg="Implicitly only sto > rage pObj->pOutVar (type ST_ADC_POINT_T *) not released before assignment: > pObj->pOutVar = pOutObj A memory leak h > as been detected. Only-qualified storage is not released before the last > reference to it is lost. (Use -mustfreeonly to > inhibit warning)" severity="warning"/> > And the cppcheck plugin generates the following warning: > [Cppcheck] [WARNING] - The source file > 'file:/build/workspace/myproj_P2_0_0_cppcheck/myproj/myproj/ADI%20Sharc/Shared/EDFA/deviceClass.c' > doesn't exist on the slave. The ability to display its source code has been > removed. > Note the duplication of the myproj directory. The reporter is not using the > Jenkins workspace as the root directory. It is using the SVN check out > directory. The report generation should be built relative to the Jenkins > workspace, not to the SVN check out directory. > This should be easy to fix. The reporter should be using the present working > directory of the cppcheck-result.xml file as the path to prepend to the file > spec from the cppcheck-results.xml file. > For example, in this case, the reporter start up to examin the > cppcheck-results.xml file: > pwd > /build/workspace/myproj_P2_0_0_cppcheck > File in cppcheck-results.xml message: > file="/myproj/ADI Sharc/Shared/EDFA/deviceClass.c" > File path is: > pwd + cppcheck-results.xml file = > /build/workspace/myproj_P2_0_0_cppcheck/myproj/ADI > Sharc/Shared/EDFA/deviceClass.c -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira