https://issues.jenkins-ci.org/browse/JENKINS-16942
PrintWriter.println() uses the OS specific line separator. When
SecretRewriter rewrites the secret file, the lines are converted to the
format of the running OS. The test case does not account for this.
Since the test case is coded expecting line endings of \n, this fix
converts \r\n to \n before comparing.
Prevents us from leaving behind a temp dir with cyclic symlinks, which breaks JGit’s clean function.
That in turn can cause test builds to break:
https://jenkins.ci.cloudbees.com/job/core/job/jenkins_main_trunk/783/console
Cleaning workspace
FATAL: Could not delete file …/workspace/core/jenkins_main_trunk/core/target/hudson5309354136960541268tmp/c/symlink/c/symlink/c/symlink/…/c/foo.xml
org.eclipse.jgit.api.errors.JGitInternalException: Could not delete file …/workspace/core/jenkins_main_trunk/core/target/hudson5309354136960541268tmp/c/symlink/c/symlink/c/symlink/…/c/foo.xml
at org.eclipse.jgit.api.CleanCommand.call(CleanCommand.java:137)
at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:305)
at hudson.plugins.git.GitAPI.clean(GitAPI.java:248)
at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1213)
at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1196)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2236)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.IOException: Could not delete file …/workspace/core/jenkins_main_trunk/core/target/hudson5309354136960541268tmp/c/symlink/c/symlink/c/symlink/…/c/foo.xml
at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:142)
at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
…
at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:126)
at org.eclipse.jgit.api.CleanCommand.call(CleanCommand.java:132)
... 14 more
- ID_FORMATTER is time zone sensitive, so comparing against # of
milliseconds since the epoch won't be portable.
- resolveSymlink can return a relative path.
Based on comments from Jesse, revising the fix.
I'm now putting permlinks inside the builds/ directory to avoid the computing hassle involved in the split $JENKINS_HOME.
What we historically had in $JENKINS_HOME/jobs/JOB/lastSuccessfulBuild is also now subsumed by this feature. I initially attempted to create these permalinks in the buidl root directory, but turns out those symlinks aren't the same name as the ID of permalinks, so it doesn't mesh well.
And finally, a test!
There are several incompatibilities in XStream 1.4 that resulted in our
changing the core, but according to the text search on all the public
plugins, none of these changes affect the 600+ plugins we have today.
However, it is still possible that there are some parts of XStream 1.3
that plugins depend on but the core doesn't depend on --- we won't be
able to tell those problems at this point.
We are replacing it by the ConfidentialStore class and the
ConfidentialKey class, which provides purpose-specific confidential
information that are separated from each other.
In this way, not all eggs are in one basket, and in case of a
compromise, the impact will contained.
Also replaced several insecure use of digest(secret|messsage) or
digest(message|secret) by HMAC.
The updated version uses the locally cached timestamp, '.timestamp', to set the
'If-Modified-Since' header. 304 Not Modified responses are dealt with by
aborting the installation.