mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-06 08:36:01 +00:00
[FIXED JENKINS-13202] Don't set mtime or mode on symlinks
Previously, the untar code tries to set the last modified time and mode on every untarred file. However, if the tar contains a broken symlink, or a symlink that points to a file that has not been untarred yet, the time/mode setting would fail on the broken symlink. Symlinks don't have meaningful modified times or modes of their own, so only set these values on non-symlinks. Rename the file "a" in the test to expose the bug.
This commit is contained in:
1 parent
005effe68e
commit
e15b2e19e3
3 files changed
+11
-9
No files matched your search
@@ -1812,12 +1812,12 @@ public final class FilePath implements Serializable {
|
||||
new FilePath(f).symlinkTo(te.getLinkName(), TaskListener.NULL);
|
||||
} else {
|
||||
IOUtils.copy(t,f);
|
||||
|
||||
f.setLastModified(te.getModTime().getTime());
|
||||
int mode = te.getMode()&0777;
|
||||
if(mode!=0 && !Functions.isWindows()) // be defensive
|
||||
_chmod(f,mode);
|
||||
}
|
||||
|
||||
f.setLastModified(te.getModTime().getTime());
|
||||
int mode = te.getMode()&0777;
|
||||
if(mode!=0 && !Functions.isWindows()) // be defensive
|
||||
_chmod(f,mode);
|
||||
}
|
||||
}
|
||||
} catch(IOException e) {
|
||||
|
||||
Reference in new issue
Block a user