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

Error 404 for multi-configuration projects when values contains a slash '/'

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • matrix-project-plugin
    • None
    • Platform: PC, OS: Linux

      For multi-configuration projects where the values for a axis contains a slash
      '/' a Error 404 occures when a link is clicked which refers to the build status
      for that specifc build. The build exists and can be found in the jobs-directory
      with log files and success status etc. Thus the build is successfull but cannot
      be viewed via the web-interface.

      === Example ===
      Build-axis name: foo
      Build-axis values (foo): foo.txt dir1/foo.txt dir2/foo.txt

      In this case links refering to axis foo with value foo.txt will work. The other
      two will give "Error 404". The link gets the form:
      http://server:port/view/viewname/jobname/foo=foo.txt
      http://server:port/view/viewname/jobname/foo=dir1/foo.txt
      http://server:port/view/viewname/jobname/foo=dir2/foo.txt

      === Updated Environment (after reopening issue) ===
      Hudson: 1.580.1
      Java: java version "1.6.0_27"
      OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1)
      Browser: Firefox 33.1

          [JENKINS-2670] Error 404 for multi-configuration projects when values contains a slash '/'

          dvrzalik added a comment -

          Hi,
          just trying to catch up ... is this issue related to the build-publisher plugin?
          E.g. can you observe this behaviour only after build has been published? (You
          can also point me to a thread on the user list, if I missed any)

          Thanks

          P.S. I am on vacation till Jan 5th

          dvrzalik added a comment - Hi, just trying to catch up ... is this issue related to the build-publisher plugin? E.g. can you observe this behaviour only after build has been published? (You can also point me to a thread on the user list, if I missed any) Thanks P.S. I am on vacation till Jan 5th

          Alan Harder added a comment -

          setting subcomponent to "matrix".. I tried this, build-publisher doesn't seem
          related.

          Alan Harder added a comment - setting subcomponent to "matrix".. I tried this, build-publisher doesn't seem related.

          Alan Harder added a comment -

          unassigning myself from this one.. it's more involved than I have time for.
          here's what I found:

          1) AbstractItem.getShortUrl() just uses getName() right in the URL, so it
          assumes item names are always URL-safe.. clearly not so for matrix jobs, where
          the URL contains PARAM=VALUE and those could be anything.

          2) I put an override of getShortUrl in MatrixConfiguration that uses
          Util.rawEncode(getName()) instead.. this made a URL like
          /job/my-job/MyParam=test%2Fslash/
          However, maybe stapler doesn't handle this well.. when
          MatrixProject.getDynamic is called it receives token = "MyParam=test".. it seems
          stapler decoded %2F into / and still treated it as a path separator, rather than
          "MyParam=test/slash" being one token.

          3) Matrix job also uses the axis value for storing on the filesystem, so it
          wrote stuff into configurations/axis-MyParam/test/slash/ directory.. this extra
          depth (2 levels under axis-MyParam instead of one) seems to confuse things, as
          the status for these items shows "Pending" instead of "Success".

          4) MatrixProject/ajaxMatrix.jelly and MatrixBuild/ajaxMatrix.jelly use different
          sources for the URL, so each should be fixed up.

          Hope this helps....

          Alan Harder added a comment - unassigning myself from this one.. it's more involved than I have time for. here's what I found: 1) AbstractItem.getShortUrl() just uses getName() right in the URL, so it assumes item names are always URL-safe.. clearly not so for matrix jobs, where the URL contains PARAM=VALUE and those could be anything. 2) I put an override of getShortUrl in MatrixConfiguration that uses Util.rawEncode(getName()) instead.. this made a URL like /job/my-job/MyParam=test%2Fslash/ However, maybe stapler doesn't handle this well.. when MatrixProject.getDynamic is called it receives token = "MyParam=test".. it seems stapler decoded %2F into / and still treated it as a path separator, rather than "MyParam=test/slash" being one token. 3) Matrix job also uses the axis value for storing on the filesystem, so it wrote stuff into configurations/axis-MyParam/test/slash/ directory.. this extra depth (2 levels under axis-MyParam instead of one) seems to confuse things, as the status for these items shows "Pending" instead of "Success". 4) MatrixProject/ajaxMatrix.jelly and MatrixBuild/ajaxMatrix.jelly use different sources for the URL, so each should be fixed up. Hope this helps....

          Alan Harder added a comment -

          taking another crack at this one

          Alan Harder added a comment - taking another crack at this one

          Alan Harder added a comment -

          I filed STAPLER-8 (https://stapler.dev.java.net/issues/show_bug.cgi?id=8) to
          make this fix possible, and I have local changes ready to commit to fix things
          on the Hudson side.

          Alan Harder added a comment - I filed STAPLER-8 ( https://stapler.dev.java.net/issues/show_bug.cgi?id=8 ) to make this fix possible, and I have local changes ready to commit to fix things on the Hudson side.

          Alan Harder added a comment -

          Created an attachment (id=877)
          Proposed fix

          Alan Harder added a comment - Created an attachment (id=877) Proposed fix

          SCM/JIRA link daemon added a comment - Code changed in stapler User: : mindless Path: trunk/stapler/core/src/main/java/org/kohsuke/stapler/AncestorImpl.java https://stapler.dev.java.net/source/browse/stapler/trunk/stapler/core/src/main/java/org/kohsuke/stapler/AncestorImpl.java?view=diff&rev=1102&p1=trunk/stapler/core/src/main/java/org/kohsuke/stapler/AncestorImpl.java&p2=trunk/stapler/core/src/main/java/org/kohsuke/stapler/AncestorImpl.java&r1=1101&r2=1102 trunk/stapler/core/src/main/java/org/kohsuke/stapler/Stapler.java https://stapler.dev.java.net/source/browse/stapler/trunk/stapler/core/src/main/java/org/kohsuke/stapler/Stapler.java?view=diff&rev=1102&p1=trunk/stapler/core/src/main/java/org/kohsuke/stapler/Stapler.java&p2=trunk/stapler/core/src/main/java/org/kohsuke/stapler/Stapler.java&r1=1101&r2=1102 trunk/stapler/core/src/main/java/org/kohsuke/stapler/TokenList.java https://stapler.dev.java.net/source/browse/stapler/trunk/stapler/core/src/main/java/org/kohsuke/stapler/TokenList.java?view=diff&rev=1102&p1=trunk/stapler/core/src/main/java/org/kohsuke/stapler/TokenList.java&p2=trunk/stapler/core/src/main/java/org/kohsuke/stapler/TokenList.java&r1=1101&r2=1102 Log: [FIXED STAPLER-8] In looking at JENKINS-2670 I found that stapler did not recognize the difference between abc/def and abc%2Fdef in a url.. it would always try to map the request to "abc" instead of "abc/def" as a single entity.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/core/src/main/java/hudson/Util.java
          trunk/hudson/main/core/src/main/java/hudson/matrix/MatrixBuild.java
          trunk/hudson/main/core/src/main/java/hudson/matrix/MatrixProject.java
          trunk/hudson/main/core/src/main/java/hudson/model/AbstractItem.java
          trunk/hudson/main/core/src/main/resources/hudson/matrix/MatrixBuild/ajaxMatrix.jelly
          http://fisheye4.cenqua.com/changelog/hudson/?cs=21321
          Log:
          [FIXED JENKINS-2670] Matrix project includes axis values in URLs..
          add encoding when needed for characters in these values, particularly /

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/core/src/main/java/hudson/Util.java trunk/hudson/main/core/src/main/java/hudson/matrix/MatrixBuild.java trunk/hudson/main/core/src/main/java/hudson/matrix/MatrixProject.java trunk/hudson/main/core/src/main/java/hudson/model/AbstractItem.java trunk/hudson/main/core/src/main/resources/hudson/matrix/MatrixBuild/ajaxMatrix.jelly http://fisheye4.cenqua.com/changelog/hudson/?cs=21321 Log: [FIXED JENKINS-2670] Matrix project includes axis values in URLs.. add encoding when needed for characters in these values, particularly /

          krizleebear added a comment -

          I just observed exactly this issue with Jenkins LTS version 1.580.1
          Do you need more information on this? I'm happy to help.

          krizleebear added a comment - I just observed exactly this issue with Jenkins LTS version 1.580.1 Do you need more information on this? I'm happy to help.

          Oleg Nenashev added a comment -

          Please check existing issues before reopening unrelated ones

          Oleg Nenashev added a comment - Please check existing issues before reopening unrelated ones

            mindless Alan Harder
            tesandro tesandro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: