Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2021-10-14 10:29:44 +0000
committerEd Merks2021-10-18 09:55:35 +0000
commit66ff9ad2440317e7d61834a3616096c1ef226051 (patch)
tree645c323b5e3e742592f580746c4f4c8a04297655
parent8c0f6bd7a48579234fa4d8b79633fcf56d52ff8b (diff)
downloadrt.equinox.p2-66ff9ad2440317e7d61834a3616096c1ef226051.tar.gz
rt.equinox.p2-66ff9ad2440317e7d61834a3616096c1ef226051.tar.xz
rt.equinox.p2-66ff9ad2440317e7d61834a3616096c1ef226051.zip
Bug 576506 - [win32] 2021-09 cannot be upgraded to 2021-12I20211020-1800I20211019-1800I20211018-1800
After a move to backup, check if the launcher executable is being moved and if so check if it has actually be removed properly. On Windows a running executable cannot be deleted and cannot be moved to a different drive so we must move (rename) it in place. Change-Id: I06a7cbb65c50ec61111d4969bc352243dad4da2f Signed-off-by: Ed Merks <ed.merks@gmail.com> Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/186477 Tested-by: Equinox Bot <equinox-bot@eclipse.org>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java17
4 files changed, 17 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java
index 0fa1cda76..a6f270835 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/SimpleBackupStoreTest.java
@@ -110,7 +110,12 @@ public class SimpleBackupStoreTest extends AbstractProvisioningTest {
super.move(a, b);
}
// Everything else - fail
- else {
+ else if (a.getFileName().endsWith("eclipse.exe")) {
+ // Simulate what happens on Windows when moving a running executable between
+ // drives. In this case the file will be copied to the target but will not be
+ // removed from the source.
+ Files.copy(a, b);
+ } else {
throw new IOException("Test fail move: " + a + " -> " + b);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
index d5c588998..fa30088a2 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.touchpoint.natives;singleton:=true
-Bundle-Version: 1.4.100.qualifier
+Bundle-Version: 1.4.200.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.touchpoint.natives.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml b/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml
index 27c485442..e1c2e865d 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.touchpoint.natives</artifactId>
- <version>1.4.100-SNAPSHOT</version>
+ <version>1.4.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java
index 07bf4f9c5..b1c0261d7 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/SimpleBackupStore.java
@@ -587,14 +587,15 @@ public class SimpleBackupStore implements IBackupStore {
NLS.bind(Messages.BackupStore_file_directory_mismatch, buPathDir.toAbsolutePath()), e);
}
- try {
- move(path, buPath);
- } catch (IOException e) {
- // TODO Log exception?
- if (!isEclipseExe(path)) {
- throw e;
- }
-
+ move(path, buPath);
+ if (isEclipseExe(path) && Files.isRegularFile(path)) {
+ // The original is the launcher executable and it still exists at the original
+ // location although the move succeeded.
+ // This happens when it is the Windows executable that is locked because it's
+ // running and we are attempting to move it to a different drive.
+ // In this case the target will exist as a copy, so we should delete it.
+ // Then backup in place which will necessarily be on the same drive.
+ Files.delete(buPath);
Path inPlaceBuPath = toInPlaceBackupPath(path);
move(path, inPlaceBuPath);
buInPlace.add(inPlaceBuPath);

Back to the top