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

FilePath.installIfNecessaryFrom does not follow HTTP 30x redirects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None

      I'm using a tool installer which, for some downloads, the URL returns a 302 redirect.

      However, Jenkins reads the contents of the redirect page (i.e. some text like "This page has moved to http://foo/bar") and attempts to parse that as the zip/tar/whatever file.

      The stacktrace users see when this happens is pretty cryptic:

      Unpacking Go from http://golang.org/dl/go1.3.darwin-amd64-osx10.6.tar.gz to /Users/Shared/Jenkins/Home/tools/org.jenkinsci.plugins.golang.GolangInstallation/Go_1.3 on Jenkins
      FATAL: Failed to install http://golang.org/dl/go1.3.darwin-amd64-osx10.6.tar.gz to /Users/Shared/Jenkins/Home/tools/org.jenkinsci.plugins.golang.GolangInstallation/Go_1.3
      hudson.util.IOException2: Failed to install http://golang.org/dl/go1.3.darwin-amd64-osx10.6.tar.gz to /Users/Shared/Jenkins/Home/tools/org.jenkinsci.plugins.golang.GolangInstallation/Go_1.3
      	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:768)
      	at org.jenkinsci.plugins.golang.GolangInstaller.performInstallation(GolangInstaller.java:53)
      	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:61)
      	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
      	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:204)
      	at org.jenkinsci.plugins.golang.GolangInstallation.forNode(GolangInstallation.java:41)
      	at org.jenkinsci.plugins.golang.GolangBuildWrapper.setUp(GolangBuildWrapper.java:34)
              ...
      Caused by: hudson.util.IOException2: Failed to unpack http://golang.org/dl/go1.3.darwin-amd64-osx10.6.tar.gz (28 bytes read of total -1)
      	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:762)
      	... 12 more
      Caused by: hudson.util.IOException2: Failed to extract input stream
      	at hudson.FilePath.readFromTar(FilePath.java:2071)
      	...
      Caused by: java.io.IOException: incorrect header check
      	at com.jcraft.jzlib.InflaterInputStream.read(InflaterInputStream.java:112)
      	at org.apache.tools.tar.TarBuffer.readBlock(TarBuffer.java:257)
      	...
      

      I will try and fix the tool installer in question to resolve the end URL, but this isn't a great idea in the long run — Jenkins should follow the 30x redirects itself.

            vlatombe Vincent Latombe
            orrc Christopher Orr
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: