提交 707629b0 编写于 作者: J Jesse Glick

[FIXED JENKINS-19192] LoginCommand failed on Windows after introduction of JNR.

Root cause of class loading error (on jnr.ffi.util.ref.internal.Finalizer$ShutDown) still unclear,
but easy fix is to simplify ClientAuthenticationCache.save to use FilePath.chmod,
which at least for now relies on hudson.util.jna.GNUCLibrary rather than JNR.
上级 58c8a939
......@@ -58,6 +58,9 @@ Upcoming changes</a>
<li class=bug>
Ungraceful handling of empty matrix project axes.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19135">issue 19135</a>)
<li class='major bug'>
CLI login command broken on Windows since 1.518.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19192">issue 19192</a>)
<li class=bug>
A malformed JUnit result file should mark that test suite as a failure, but not interrupt archiving of other tests.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19186">issue 19186</a>)
......
package hudson.cli;
import hudson.FilePath;
import hudson.FilePath.FileCallable;
import jenkins.model.Jenkins;
import jenkins.model.Jenkins.MasterComputer;
import hudson.os.PosixAPI;
import hudson.remoting.Callable;
import hudson.remoting.Channel;
import hudson.remoting.VirtualChannel;
import hudson.util.Secret;
import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationException;
......@@ -16,7 +13,6 @@ import org.acegisecurity.userdetails.UserDetails;
import org.springframework.dao.DataAccessException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
......@@ -106,21 +102,13 @@ public class ClientAuthenticationCache implements Serializable {
}
private void save() throws IOException, InterruptedException {
store.act(new FileCallable<Void>() {
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f.getParentFile().mkdirs();
OutputStream os = new FileOutputStream(f);
try {
props.store(os,"Credential store");
} finally {
os.close();
}
// try to protect this file from other users, if we can.
PosixAPI.jnr().chmod(f.getAbsolutePath(),0600);
return null;
}
});
OutputStream os = store.write();
try {
props.store(os,"Credential store");
} finally {
os.close();
}
// try to protect this file from other users, if we can.
store.chmod(0600);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册