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

Parser should make relative paths absolute correctly if make is used recursively.

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • analysis-model
    • Jenkins 2.309
      Analysis Model API 10.3.0
      Warnings Next Generation Plugin 9.5.0

      For my project, I call cmake for a third party library that I include statically from a custom make task (using automake), which results in the parser changing directory to the third party library; however it does not change back to the previous directory. 

      Basic issue is that the parser uses the last 'Entering Directory' line to set paths, ignoring any 'Leaving Directory' lines.

      I was able to get around the issue by building the third party library as a separate step, then checking for its existence and not re-building if it is present so when the main build happens then the directory is not changed.

      When running the gcc tool using an out of source build, I received several errors (java.nio.file.NoSuchFileException) with incorrect paths listed.

       -- 

      I found that the parser should be using the GNU Make lines that begin with `make[] Entering directory` to resolve paths (JENKINS-54035). 

       -- 

      It looks like the responsibility for this is currently in src/main/java/edu/hm/hafner/analysis/LookaheadParser.java.

       -- 

      I did test the regex ".make(?:
      [

      d+])?: " + ENTERING_DIRECTORY + " [`'](?<dir>.)['`]" and it worked for my output.

       -- 

      I don't use Java very often and I don't have time at work to confirm this, however I believe the issue may be with the extractAndStoreDirectory function. The IssueBuilder parameter is marked as final, and a quick search suggests that when the build.SetDirectory call is made the final specification makes the change local to the function and thus does not carry forward to the Gcc4CompilerParser.java createIssue function.

       

       

       

       

          [JENKINS-66835] Parser should make relative paths absolute correctly if make is used recursively.

          Ulli Hafner added a comment -

          Can you please provide more details?

          • What is the path that is reported by my plugin (which is not resolvable)?
          • What is the exact error message of my plugin (in the console log)?
          • A snippet of the console output that contains the make directory logging statement and a warning of the Gcc compiler

          Ulli Hafner added a comment - Can you please provide more details? What is the path that is reported by my plugin (which is not resolvable)? What is the exact error message of my plugin (in the console log)? A snippet of the console output that contains the make directory logging statement and a warning of the Gcc compiler

          Ulli Hafner added a comment - - edited

          The IssueBuilder parameter is marked as final, and a quick search suggests that when the build.SetDirectory call is made the final specification makes the change local to the function and thus does not carry forward to the Gcc4CompilerParser.java createIssue function.

          final does only mean that the reference is constant not the object itself. Actually the directory in the builder instance should be changed if make enters a new folder.

          Ulli Hafner added a comment - - edited The IssueBuilder parameter is marked as final, and a quick search suggests that when the build.SetDirectory call is made the final specification makes the change local to the function and thus does not carry forward to the Gcc4CompilerParser.java createIssue function. final does only mean that the reference is constant not the object itself. Actually the directory in the builder instance should be changed if make enters a new folder.

          Walter Gates added a comment -

          Updated issue Title and Description based on results of debugging the issue.

          Walter Gates added a comment - Updated issue Title and Description based on results of debugging the issue.

          Ulli Hafner added a comment -

          Thanks for clarifying. It would help if you could add a (anonymized) snippet that shows some of those directory messages and a warning that gets the wrong file path assigned. Then a volunteer can use that file as a test case.

          Ulli Hafner added a comment - Thanks for clarifying. It would help if you could add a (anonymized) snippet that shows some of those directory messages and a warning that gets the wrong file path assigned. Then a volunteer can use that file as a test case.

          Walter Gates added a comment -

          Walter Gates added a comment - Created pull request  https://github.com/jenkinsci/analysis-model/pull/690

          Ulli Hafner added a comment -

          Ah, that is even better

          Ulli Hafner added a comment - Ah, that is even better

          Walter Gates added a comment -

          Walter Gates added a comment - https://github.com/jenkinsci/analysis-model/pull/690  ready for review

            wgates Walter Gates
            wgates Walter Gates
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: