Skip to content

Commit

Permalink
[FIXED JENKINS-11073] handle failure to set timestamp on Windows plat…
Browse files Browse the repository at this point in the history
…forms more gracefully - this time hopefully for real
  • Loading branch information
kutzi committed Nov 23, 2011
1 parent 8656049 commit 8755e59
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
6 changes: 3 additions & 3 deletions changelog.html
Expand Up @@ -64,6 +64,9 @@
<li class=bug>
Fixed ConcurrentModificationException in parallel Maven 3 builds.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11256">issue 11256</a>)
<li class=bug>
Copy artifacts fails on windows slaves due to failing to set a timestamp.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11073">issue 11073</a>)
<li class=rfe>
CLI jar now has the version number in the manifest as well as the "-version" option.
<li class=rfe>
Expand Down Expand Up @@ -95,9 +98,6 @@ <h3><a name=v1.440>What's new in 1.440</a> (2011/11/17)</h3>
<li class=bug>
Dependency wasn't recalculated with CLI "update-job" command.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11636">issue 11636</a>)
<li class=bug>
Copy artifacts fails on windows slaves due to failing to set a timestamp.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11073">issue 11073</a>)
<li class=rfe>
Sortable table wasn't "stable" when there are same values in different rows
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11551">issue 11551</a>)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/FilePath.java
Expand Up @@ -291,7 +291,7 @@ private static String normalize(String path) {
/**
* Checks if the remote path is Unix.
*/
private boolean isUnix() {
boolean isUnix() {
// if the path represents a local path, there' no need to guess.
if(!isRemote())
return File.pathSeparatorChar!=';';
Expand Down Expand Up @@ -1429,7 +1429,7 @@ public void copyToWithPermission(FilePath target) throws IOException, Interrupte
target.touch(lastModified());
} catch (IOException e) {
// On Windows this seems to fail often. See JENKINS-11073
if (!isUnix()) {
if (!target.isUnix()) {
LOGGER.warning("Failed to set timestamp on " + target.getRemote());
} else { // rethrow
throw new IOException2(e);
Expand Down
19 changes: 19 additions & 0 deletions core/src/test/java/hudson/FilePathTest.java
Expand Up @@ -23,6 +23,7 @@
*/
package hudson;

import hudson.remoting.LocalChannel;
import hudson.remoting.VirtualChannel;
import hudson.util.IOException2;
import hudson.util.NullStream;
Expand Down Expand Up @@ -296,5 +297,23 @@ public void testListWithExcludes() throws Exception {
Util.deleteRecursive(baseDir);
}
}

@Bug(11073)
public void testIsUnix() {
FilePath winPath = new FilePath(new LocalChannel(null),
" c:\\app\\hudson\\workspace\\3.8-jelly-db\\jdk/jdk1.6.0_21/label/sqlserver/profile/sqlserver\\acceptance-tests\\distribution.zip");
assertFalse(winPath.isUnix());

FilePath base = new FilePath(new LocalChannel(null),
"c:\\app\\hudson\\workspace\\3.8-jelly-db");
FilePath middle = new FilePath(base, "jdk/jdk1.6.0_21/label/sqlserver/profile/sqlserver");
FilePath full = new FilePath(middle, "acceptance-tests\\distribution.zip");
assertFalse(full.isUnix());


FilePath unixPath = new FilePath(new LocalChannel(null),
"/home/test");
assertTrue(unixPath.isUnix());
}

}

0 comments on commit 8755e59

Please sign in to comment.