Repository navigation
[JENKINS-23507] FilePath.installIfNecessaryFrom does not follow HTTP 30x redirects #23205
Description
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.
Originally reported by
orrc, imported from: FilePath.installIfNecessaryFrom does not follow HTTP 30x redirects
- assignee:
vlatombe
- status: Resolved
- priority: Major
- component(s): core
- resolution: Fixed
- resolved: 2016-05-13T10:40:33+00:00
- votes: 1
- watchers: 5
- imported: 2025-11-24
Raw content of original issue
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.
Activity
jenkins-infra-bot commentedon Jun 20, 2014
Remote link associated with this issue:
jenkins-infra-bot commentedon Nov 5, 2015
Raw content of original comment:
Code changed in jenkins
User: 15knots
Path:
cmake.groovy
http://jenkins-ci.org/commit/backend-crawler/9e81b09be1e950d2feed836fc5fe9bb0ae92ad00
Log:
Workarounbd for
JENKINS-23507Compare: jenkins-infra/crawler@2dd4c00...9e81b09
jenkins-infra-bot commentedon May 11, 2016
Raw content of original comment:
Filed #2331 to fix this issue.
jenkins-infra-bot commentedon May 11, 2016
Raw content of original comment:
Code changed in jenkins
User: Vincent Latombe
Path:
core/src/main/java/hudson/FilePath.java
core/src/test/java/hudson/FilePathTest.java
http://jenkins-ci.org/commit/jenkins/23a37feec061c4def89b1ae65976b55ae7bc3be4
Log:
JENKINS-23507Make FilePath.installIfNecessaryFrom follow redirectsjenkins-infra-bot commentedon May 13, 2016
Raw content of original comment:
Code changed in jenkins
User: Vincent Latombe
Path:
core/src/main/java/hudson/FilePath.java
core/src/test/java/hudson/FilePathTest.java
http://jenkins-ci.org/commit/jenkins/0c16c8576bf662b2af049d8d9720ea7d30085c3a
Log:
JENKINS-23507Make FilePath.installIfNecessaryFrom follow redirects (#2331)jenkins-infra-bot commentedon Jun 6, 2016
Raw content of original comment:
Released as Jenkins-2.4
jenkins-infra-bot commentedon Jul 27, 2016
Raw content of original comment:
oleg_nenashev is this issue back?
I just got the following on jenkins 2.15:
jenkins-infra-bot commentedon Jul 27, 2016
Raw content of original comment:
cmelo
Looks to me the url is resolved properly. I get an HTTP 200 from curl -I https://storage.googleapis.com/golang/go1.5.4.darwin-amd64.tar.gz
So whatever is your problem, it's probably unrelated to this issue.
jenkins-infra-bot commentedon Nov 24, 2025
[Original
relates_tofrom Jira: JENKINS-23509]