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

Bad warnings detected with GNU compiler parser in v2.11

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: warnings-plugin
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      Hi,

      I have a problem with the GNU compiler parser in version 2.11 of the plugin
      which I didn't have with version 2.10. New warnings appeared, always the same.

      Results of gcc command sometimes give me that :
      "
      In file included from C:/<path_1>/file_1.h:28,
      from C:\<path_2>\file_2.c:31:
      C:/<path_3>/file_3.h:2:2: warning: no newline at end of file
      "

      The GNU compiler parser used to parse only the third line in previous version.
      Now, it also parses the second line, and the result is an GCC error in "Compiler
      warning" section. Besides, the parser consider "from C:\<path_2>\file_2.c" as
      the pathfile, therefore clicking on "file_2.c" link in "Compiler warning"
      section leads to the following error when trying to display the source code:
      "
      null
      01 hudson.util.IOException2: remote file operation failed
      02 at hudson.FilePath.act(FilePath.java:672)
      03 at hudson.FilePath.act(FilePath.java:660)
      04 at hudson.FilePath.copyTo(FilePath.java:1272)
      05 at
      hudson.plugins.warnings.util.HealthAwarePublisher.copyFilesFromSlaveToMaster(HealthAwarePublisher.java:189)
      06 at
      hudson.plugins.warnings.util.HealthAwarePublisher.perform(HealthAwarePublisher.java:145)
      07 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      08 at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:480)
      09 at
      hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:466)
      10 at
      hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:454)
      11 at hudson.model.Build$RunnerImpl.post2(Build.java:146)
      12 at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:438)
      13 at hudson.model.Run.run(Run.java:1129)
      14 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      15 at hudson.model.ResourceController.execute(ResourceController.java:93)
      16 at hudson.model.Executor.run(Executor.java:122)
      17 Caused by: java.io.FileNotFoundException: from C:\<path_2>\file_2.c (Syntaxe
      du nom de fichier, de répertoire ou de volume incorrecte)
      18 at java.io.FileInputStream.open(Native Method)
      19 at java.io.FileInputStream.<init>(Unknown Source)
      20 at hudson.FilePath$30.invoke(FilePath.java:1276)
      21 at hudson.FilePath$30.invoke(FilePath.java:1272)
      22 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2032)
      23 at hudson.remoting.UserRequest.perform(UserRequest.java:103)
      24 at hudson.remoting.UserRequest.perform(UserRequest.java:47)
      25 at hudson.remoting.Request$2.run(Request.java:236)
      26 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      27 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      28 at java.util.concurrent.FutureTask.run(Unknown Source)
      29 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      30 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      31 at hudson.remoting.Engine$1$1.run(Engine.java:54)
      32 at java.lang.Thread.run(Unknown Source)
      33 Can't copy file from slave to master: slave=from C:\<path_2>\file_2.c,
      master=/<path_4>/304e2596.tmp
      "

      I checked the source code, and figured it was because of the new regular
      expression introduce in version 2.11 :
      "^(.
      .(?:[chpixsola0-9]+|os21debug))?
      d
      )?:
      d*\\s(?:(warning|error)\\s*:|\\s*(.))|
      s
      (undefined
      reference to.))(.)$"

      I tried to fix the problem as follow :
      I checked out the source code, and changed the regexp by
      "^(.
      .(?:[chpixsola0-9]|os21debug))?
      d
      )?:
      d*\\s(?:(warning|error)\\s*:|\\s*(.))|
      s*(undefined
      reference to.))(.)$"
      (only changed the * by a + in group 4)
      Then I build the plugin with maven 2, and load it into hudson, and it worked as
      with version 2.10. I think this little change will not affect the improvement of
      the GCC regexp PATTERN introduce in version 2.11 (but I'm not sure), so it can
      be a start for you to resolve that issue.

      Also, it might be still interesting to parse the second line ("
      from C:\<path_2>\file_2.c:31:") as a warning, but with another parser.
      Emacs does that with a parser called "gcc-include" (which differs from its own
      GNU parser).
      Anyway, that's a subject for a future ENHANCEMENT issue.

        Attachments

        1. GccParser.java
          2 kB
        2. GccParserTest.java
          7 kB
        3. issue4382.txt
          0.5 kB

          Activity

          Hide
          drulli Ulli Hafner added a comment -

          Did the unit tests run with the exception? Then it is save to change the regular
          expression.

          I'll have a look at it tonight...

          Show
          drulli Ulli Hafner added a comment - Did the unit tests run with the exception? Then it is save to change the regular expression. I'll have a look at it tonight...
          Hide
          drulli Ulli Hafner added a comment -

          Hmm, I tried to use the new regexp but now the testcase issue4260 breaks. Did
          you run the test cases?

          Show
          drulli Ulli Hafner added a comment - Hmm, I tried to use the new regexp but now the testcase issue4260 breaks. Did you run the test cases?
          Hide
          metavalon metavalon added a comment -

          Hi,

          I ran the test cases, and it worked, but was it was maybe not with the last
          version of the plugin.

          I downloaded the last sources (2.13), and the testcase issue4260 failed like you
          said.

          I have another solution which do not imply to change the regexp.

          In GccParser.java, "createWarning", last "else" case, return a FALSE_POSITIVE if
          group(1) contains " from"

          I rebuilt the plugin, do the test cases, and nothing failed, so it should be good.

          My modified GccParser.java is in attachment.

          Also I added a test for this issue in GccParserTest.java (also in attachment)
          and create the file issue4382.txt for this test (also in attachment)

          Show
          metavalon metavalon added a comment - Hi, I ran the test cases, and it worked, but was it was maybe not with the last version of the plugin. I downloaded the last sources (2.13), and the testcase issue4260 failed like you said. I have another solution which do not imply to change the regexp. In GccParser.java, "createWarning", last "else" case, return a FALSE_POSITIVE if group(1) contains " from" I rebuilt the plugin, do the test cases, and nothing failed, so it should be good. My modified GccParser.java is in attachment. Also I added a test for this issue in GccParserTest.java (also in attachment) and create the file issue4382.txt for this test (also in attachment)
          Hide
          metavalon metavalon added a comment -

          Created an attachment (id=909)
          GccParser.java

          Show
          metavalon metavalon added a comment - Created an attachment (id=909) GccParser.java
          Hide
          metavalon metavalon added a comment -

          Created an attachment (id=911)
          GccParserTest.java

          Show
          metavalon metavalon added a comment - Created an attachment (id=911) GccParserTest.java
          Hide
          metavalon metavalon added a comment -

          Created an attachment (id=912)
          issue4382.txt

          Show
          metavalon metavalon added a comment - Created an attachment (id=912) issue4382.txt
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : drulli
          Path:
          trunk/hudson/plugins/warnings/src/main/java/hudson/plugins/warnings/parser/GccParser.java
          trunk/hudson/plugins/warnings/src/test/java/hudson/plugins/warnings/parser/GccParserTest.java
          trunk/hudson/plugins/warnings/src/test/resources/hudson/plugins/warnings/parser/issue4382.txt
          http://fisheye4.cenqua.com/changelog/hudson/?cs=22097
          Log:
          [FIXED JENKINS-4382] Fixed some false GCC positives.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : drulli Path: trunk/hudson/plugins/warnings/src/main/java/hudson/plugins/warnings/parser/GccParser.java trunk/hudson/plugins/warnings/src/test/java/hudson/plugins/warnings/parser/GccParserTest.java trunk/hudson/plugins/warnings/src/test/resources/hudson/plugins/warnings/parser/issue4382.txt http://fisheye4.cenqua.com/changelog/hudson/?cs=22097 Log: [FIXED JENKINS-4382] Fixed some false GCC positives.

            People

            Assignee:
            drulli Ulli Hafner
            Reporter:
            metavalon metavalon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: