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

Bad warnings detected with GNU compiler parser in v2.11

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • warnings-plugin
    • None
    • Platform: All, OS: All

    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

          People

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

            Dates

              Created:
              Updated:
              Resolved: