Skip to content

Commit 9b98375

Browse files
authored
Merge pull request #926 from pedro-hos/JBEAP-30585-1.1.x
[JBEAP-30585] - JBoss EAP 8 Update Deletes 'log' Directory Symlink, Causing Startup Failure
2 parents b0025d9 + 3eb8ecc commit 9b98375

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

prospero-common/src/main/java/org/wildfly/prospero/actions/ApplyCandidateAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,15 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e)
663663

664664
// Delete the files in the installation that are not present in the update and not added by the user
665665
// We need to skip .glnew and .glold.
666+
// JBEAP-30585: We need to keep the Symbolic files
666667
Files.walkFileTree(installationDir, new SimpleFileVisitor<Path>() {
667668
@Override
668669
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
669670
throws IOException {
670671
Path relative = installationDir.relativize(file);
671672
Path updateFile = updateDir.resolve(relative);
672673
final String fsDiffKey = getFsDiffKey(relative, false);
673-
if (isNotAddedOrModified(fsDiffKey, fsDiff) && fileNotPresent(updateFile)) {
674+
if (isNotAddedOrModified(fsDiffKey, fsDiff) && fileNotPresent(updateFile) && !Files.isSymbolicLink(file)) {
674675
if (ProsperoLogger.ROOT_LOGGER.isDebugEnabled()) {
675676
ProsperoLogger.ROOT_LOGGER.debug("Deleting the file " + relative + " that doesn't exist in the update");
676677
}

prospero-common/src/test/java/org/wildfly/prospero/actions/ApplyCandidateActionTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,34 @@ public void testUpdateNoUserChanges() throws Exception {
109109
assertThat(conflicts).isEmpty();
110110
}
111111

112+
public void testUpdateWithSymlink() throws Exception {
113+
final DirState expectedState = dirBuilder
114+
.addFile("prod1/p1.txt", "p1 1.0.1")
115+
.addDir("log")
116+
.addDir("testlog")
117+
.build();
118+
119+
// build test packages
120+
createSimpleFeaturePacks();
121+
122+
// install base and update. perform apply-update
123+
install(installationPath, FPL_100);
124+
125+
//creating SymbolicLink
126+
Path symlinkPath = Files.createDirectory(installationPath.resolve("testlog"));
127+
Path logPath = installationPath.resolve("log");
128+
Files.createSymbolicLink(logPath, symlinkPath);
129+
130+
prepareUpdate(updatePath, installationPath, FPL_101);
131+
final List<FileConflict> conflicts = new ApplyCandidateAction(installationPath, updatePath).applyUpdate(ApplyCandidateAction.Type.UPDATE);
132+
133+
// verify
134+
expectedState.assertState(installationPath);
135+
assertThat(conflicts).isEmpty();
136+
assertTrue(Files.exists(logPath));
137+
assertTrue(Files.isSymbolicLink(logPath));
138+
}
139+
112140
@Test
113141
public void testUpdateWithUserChanges() throws Exception {
114142
final DirState expectedState = dirBuilder

0 commit comments

Comments
 (0)