Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
28bf5d80
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
28bf5d80
编写于
3月 12, 2013
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
差异文件
[FIXED JENKINS-15587]
The actual fix was in the pull request #675.
上级
f7c9e810
2f781863
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
63 addition
and
0 deletion
+63
-0
changelog.html
changelog.html
+3
-0
core/src/main/java/hudson/Util.java
core/src/main/java/hudson/Util.java
+15
-0
core/src/main/java/hudson/model/Run.java
core/src/main/java/hudson/model/Run.java
+8
-0
core/src/test/java/hudson/model/RunTest.java
core/src/test/java/hudson/model/RunTest.java
+37
-0
未找到文件。
changelog.html
浏览文件 @
28bf5d80
...
...
@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
bug
>
Fixed a bad interaction between Windows symlinks and build record lazy loading.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-15587"
>
issue 15587
</a>
)
<li
class=
rfe
>
Remember the lastStable/Failed/Successful/etc builds to avoid eager loading builds.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-16089"
>
issue 16089
</a>
)
...
...
core/src/main/java/hudson/Util.java
浏览文件 @
28bf5d80
...
...
@@ -1140,6 +1140,21 @@ public class Util {
return
resolveSymlink
(
link
);
}
/**
* Resolves a symlink to the {@link File} that points to.
*
* @return null
* if the specified file is not a symlink.
*/
public
static
File
resolveSymlinkToFile
(
File
link
)
throws
InterruptedException
,
IOException
{
String
target
=
resolveSymlink
(
link
);
if
(
target
==
null
)
return
null
;
File
f
=
new
File
(
target
);
if
(
f
.
isAbsolute
())
return
f
;
// absolute symlink
return
new
File
(
link
.
getParentFile
(),
target
);
// relative symlink
}
/**
* Resolves symlink, if the given file is a symlink. Otherwise return null.
* <p>
...
...
core/src/main/java/hudson/model/Run.java
浏览文件 @
28bf5d80
...
...
@@ -341,6 +341,12 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
/*package*/
static
long
parseTimestampFromBuildDir
(
File
buildDir
)
throws
IOException
{
try
{
if
(
Util
.
isSymlink
(
buildDir
))
{
// "Util.resolveSymlink(file)" resolves NTFS symlinks.
File
target
=
Util
.
resolveSymlinkToFile
(
buildDir
);
if
(
target
!=
null
)
buildDir
=
target
;
}
// canonicalization to ensure we are looking at the ID in the directory name
// as opposed to build numbers which are used in symlinks
return
ID_FORMATTER
.
get
().
parse
(
buildDir
.
getCanonicalFile
().
getName
()).
getTime
();
...
...
@@ -348,6 +354,8 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
throw
new
IOException2
(
"Invalid directory name "
+
buildDir
,
e
);
}
catch
(
NumberFormatException
e
)
{
throw
new
IOException2
(
"Invalid directory name "
+
buildDir
,
e
);
}
catch
(
InterruptedException
e
)
{
throw
new
IOException2
(
"Interrupted while resolving symlink directory "
+
buildDir
,
e
);
}
}
...
...
core/src/test/java/hudson/model/RunTest.java
浏览文件 @
28bf5d80
...
...
@@ -24,10 +24,20 @@
package
hudson.model
;
import
hudson.Util
;
import
hudson.util.StreamTaskListener
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.nio.charset.Charset
;
import
java.util.Date
;
import
java.util.TimeZone
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
javax.xml.stream.events.Characters
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
import
org.jvnet.hudson.test.Bug
;
...
...
@@ -77,4 +87,31 @@ public class RunTest {
}
}
@Bug
(
15587
)
@Test
public
void
testParseTimestampFromBuildDir
()
throws
Exception
{
//Assume.assumeTrue(!Functions.isWindows() || (NTFS && JAVA7) || ...);
String
buildDateTime
=
"2012-12-21_04-02-28"
;
int
buildNumber
=
155
;
StreamTaskListener
l
=
StreamTaskListener
.
fromStdout
();
File
tempDir
=
Util
.
createTempDir
();
File
buildDir
=
new
File
(
tempDir
,
buildDateTime
);
assertEquals
(
true
,
buildDir
.
mkdir
());
File
buildDirSymLink
=
new
File
(
tempDir
,
Integer
.
toString
(
buildNumber
));
try
{
buildDir
.
mkdir
();
Util
.
createSymlink
(
tempDir
,
buildDir
.
getAbsolutePath
(),
buildDirSymLink
.
getName
(),
l
);
long
time
=
Run
.
parseTimestampFromBuildDir
(
buildDirSymLink
);
assertEquals
(
buildDateTime
,
Run
.
ID_FORMATTER
.
get
().
format
(
new
Date
(
time
)));
}
finally
{
Util
.
deleteRecursive
(
tempDir
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录