Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Langer2019-06-22 06:32:56 +0000
committerChristoph Langer2019-10-13 21:36:29 +0000
commit4c9f2ab32d4f60aca08375e176ee06928aa22edf (patch)
tree411ddd4f739c2491d2228e633e22da47cb5ad114
parentacf3335419e20bba9e5ddf9541c8795f2eb50057 (diff)
downloadrt.equinox.p2-4c9f2ab32d4f60aca08375e176ee06928aa22edf.tar.gz
rt.equinox.p2-4c9f2ab32d4f60aca08375e176ee06928aa22edf.tar.xz
rt.equinox.p2-4c9f2ab32d4f60aca08375e176ee06928aa22edf.zip
Bug 465602 p2 fails to resolve a target platform with Eclipse Mars
artifacts on Mac OS X If a path segment is missing, it seems on Mac a FileOutputStream won't be created. This can be avoided by using canonicalized paths. Also for chmod it might be beneficial to use canonicalized paths Change-Id: Ibdc8552e04ef47ffc09f1a487f9cd9f36fbba817 Signed-off-by: Christoph Langer <christoph.langer@sap.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf4
-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/Messages.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java135
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties5
7 files changed, 131 insertions, 35 deletions
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 f1383e9fa..e9708585c 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.3.300.qualifier
+Bundle-Version: 1.3.400.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/META-INF/p2.inf b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf
index 3893b06a5..f8dcaa676 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/p2.inf
@@ -29,3 +29,7 @@ provides.6.version=1.3.200.$qualifier$
provides.7.namespace=org.eclipse.equinox.p2.iu
provides.7.name=org.eclipse.equinox.p2.touchpoint.natives
provides.7.version=1.3.300.$qualifier$
+
+provides.8.namespace=org.eclipse.equinox.p2.iu
+provides.8.name=org.eclipse.equinox.p2.touchpoint.natives
+provides.8.version=1.3.400.$qualifier$
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml b/bundles/org.eclipse.equinox.p2.touchpoint.natives/pom.xml
index 1052f50ad..43054ba1e 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.3.300-SNAPSHOT</version>
+ <version>1.3.400-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/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java
index 84ba4e3c5..dde3435ed 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2014 IBM Corporation and others.
+ * Copyright (c) 2007, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Rapicorp, Inc - prompt to install debian package
+ * SAP SE - bug 465602
*******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.natives;
@@ -46,6 +47,8 @@ public class Messages extends NLS {
public static String BlockMacUpdate_0;
public static String BlockMacUpdate_1;
+ public static String action_0_status;
+ public static String action_0_failed_on_file_1_reason_2;
public static String action_0_failed_file_1_doesNotExist;
public static String artifact_not_available;
public static String artifact_repo_not_found;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java
index d867d5ada..3edabc078 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 IBM Corporation and others.
+ * Copyright (c) 2007, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Red Hat Inc. - Bug 460967
+ * SAP SE - bug 465602
*******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.natives;
@@ -39,6 +40,10 @@ public class Util {
return new Status(IStatus.ERROR, Activator.ID, message);
}
+ public static IStatus createError(String message, Throwable exception) {
+ return new Status(IStatus.ERROR, Activator.ID, message, exception);
+ }
+
public static String getInstallFolder(IProfile profile) {
return profile.getProperty(IProfile.PROP_INSTALL_FOLDER);
}
@@ -210,6 +215,8 @@ public class Util {
} catch (FileNotFoundException e) {
// TEMP: ignore this for now in case we're trying to replace
// a running eclipse.exe
+ // TODO: This is very questionable as it will shadow any other
+ // issue with extraction!!
}
outFile.setLastModified(ze.getTime());
}
@@ -223,8 +230,8 @@ public class Util {
}
private static File createSubPathFile(File root, String subPath) throws IOException {
- File result = new File(root, subPath);
- String resultCanonical = result.getCanonicalPath();
+ File result = new File(root, subPath).getCanonicalFile();
+ String resultCanonical = result.getPath();
String rootCanonical = root.getCanonicalPath();
if (!resultCanonical.startsWith(rootCanonical + File.separator) && !resultCanonical.equals(rootCanonical)) {
throw new IOException("Invalid path: " + subPath); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java
index a8e3b52a2..2264fd22e 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,7 @@
* IBM Corporation - ongoing development
* Cloudsmith Inc - ongoing development
* Landmark Graphics Corporation - bug 397183
+ * SAP SE - bug 465602
*******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.natives.actions;
@@ -20,8 +21,7 @@ import java.io.*;
import java.util.ArrayList;
import java.util.Map;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.touchpoint.natives.Messages;
-import org.eclipse.equinox.internal.p2.touchpoint.natives.Util;
+import org.eclipse.equinox.internal.p2.touchpoint.natives.*;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.osgi.util.NLS;
@@ -29,18 +29,77 @@ public class ChmodAction extends ProvisioningAction {
private static final String ACTION_CHMOD = "chmod"; //$NON-NLS-1$
private static final boolean WINDOWS = java.io.File.separatorChar == '\\';
- // target targetFile absoluteFiles
- // Y Y Y can't set all these arguments
- // Y Y N Y -> today, add the ability to specifty a list of fileNames
- // Y N Y warning? targetFolder unecessary
- // Y N N incorrect, missing targetFile
- // N Y Y incorrect, target file can't be with absoluteFiles
- // N Y N incorrect, missing the targetFolder
- // N N Y Y
- // N N N
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * Changes the file permission attributes. This is not applicable on Windows so
+ * it is a no-op in that case.
+ * </p>
+ *
+ * <table>
+ * <tr>
+ * <td>target</td>
+ * <td>targetFile</td>
+ * <td>absoluteFiles</td>
+ * <td>validity</td>
+ * </tr>
+ * <tr>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>can't set all these arguments</td>
+ * </tr>
+ * <tr>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>N</td>
+ * <td>Y today, add the ability to specify a list of fileNames</td>
+ * </tr>
+ * <tr>
+ * <td>Y</td>
+ * <td>N</td>
+ * <td>Y</td>
+ * <td>warning? targetFolder unnecessary</td>
+ * </tr>
+ * <tr>
+ * <td>Y</td>
+ * <td>N</td>
+ * <td>N</td>
+ * <td>incorrect, missing targetFile</td>
+ * </tr>
+ * <tr>
+ * <td>N</td>
+ * <td>Y</td>
+ * <td>Y</td>
+ * <td>incorrect, target file can't be with absoluteFiles</td>
+ * </tr>
+ * <tr>
+ * <td>N</td>
+ * <td>Y</td>
+ * <td>N</td>
+ * <td>incorrect, missing the targetFolder</td>
+ * </tr>
+ * <tr>
+ * <td>N</td>
+ * <td>N</td>
+ * <td>Y</td>
+ * <td>Y</td>
+ * </tr>
+ * <tr>
+ * <td>N</td>
+ * <td>N</td>
+ * <td>N</td>
+ * <td>N</td>
+ * </tr>
+ * </table>
+ */
@Override
public IStatus execute(Map<String, Object> parameters) {
- Object absoluteFiles = parameters.get(ActionConstants.PARM_ABSOLUTE_FILES); //String or String[]
+ // on Windows this isn't implemented, so we can return right here.
+ if (WINDOWS)
+ return Status.OK_STATUS;
+ Object absoluteFiles = parameters.get(ActionConstants.PARM_ABSOLUTE_FILES); // String or String[]
String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
String targetFile = (String) parameters.get(ActionConstants.PARM_TARGET_FILE);
@@ -58,24 +117,42 @@ public class ChmodAction extends ProvisioningAction {
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PERMISSIONS, ACTION_CHMOD));
String optionsString = (String) parameters.get(ActionConstants.PARM_OPTIONS);
- String[] filesToProcess = absoluteFiles != null ? ((absoluteFiles instanceof String) ? new String[] {(String) absoluteFiles} : (String[]) absoluteFiles) : makeFilesAbsolute(targetDir, targetFile);
- for (String fileToChmod : filesToProcess) {
- // Check that file exist
- File probe = new File(fileToChmod);
- if (!probe.exists())
- return Util.createError(NLS.bind(Messages.action_0_failed_file_1_doesNotExist, ACTION_CHMOD, probe.toString()));
+ String[] filesToProcess = absoluteFiles != null
+ ? ((absoluteFiles instanceof String) ? new String[] { (String) absoluteFiles }
+ : (String[]) absoluteFiles)
+ : makeFilesAbsolute(targetDir, targetFile);
+
+ MultiStatus rStatus = new MultiStatus(Activator.ID, IStatus.OK,
+ NLS.bind(Messages.action_0_status, ACTION_CHMOD), null);
- doChmod(fileToChmod, permissions, optionsString);
+ for (String fileToChmod : filesToProcess) {
+ // Check that file exists
+ try {
+ File probe = new File(fileToChmod).getCanonicalFile();
+ if (!probe.exists()) {
+ rStatus.add(Util.createError(
+ NLS.bind(Messages.action_0_failed_file_1_doesNotExist, ACTION_CHMOD, probe.toString())));
+ continue;
+ }
+ } catch (IOException e) {
+ rStatus.add(Util.createError(NLS.bind(Messages.action_0_failed_on_file_1_reason_2,
+ new String[] { ACTION_CHMOD, fileToChmod, e.getMessage() }), e));
+ continue;
+ }
+ IStatus chmodStatus = doChmod(fileToChmod, permissions, optionsString);
+ if (!chmodStatus.isOK()) {
+ rStatus.merge(chmodStatus);
+ }
}
- return Status.OK_STATUS;
+ return rStatus;
}
private String[] makeFilesAbsolute(String targetDir, String targetFile) {
- return new String[] {new String(targetDir + IPath.SEPARATOR + targetFile)};
+ return new String[] { new String(targetDir + IPath.SEPARATOR + targetFile) };
}
- private void doChmod(String fileToChmod, String permissions, String optionsString) {
+ private IStatus doChmod(String fileToChmod, String permissions, String optionsString) {
String options[] = null;
if (optionsString != null) {
ArrayList<String> collect = new ArrayList<>();
@@ -97,18 +174,18 @@ public class ChmodAction extends ProvisioningAction {
}
}
- chmod(fileToChmod, permissions, options);
+ return chmod(fileToChmod, permissions, options);
}
@Override
public IStatus undo(Map<String, Object> parameters) {
- //TODO: implement undo ??
+ // TODO: implement undo ??
return Status.OK_STATUS;
}
- public void chmod(String fileToChmod, String perms, String[] options) {
+ public IStatus chmod(String fileToChmod, String perms, String[] options) {
if (WINDOWS)
- return;
+ return Status.OK_STATUS;
Runtime r = Runtime.getRuntime();
try {
// Note: 3 is from chmod, permissions, and target
@@ -131,8 +208,10 @@ public class ChmodAction extends ProvisioningAction {
Thread.currentThread().interrupt();
}
} catch (IOException e) {
- // ignore
+ return Util.createError(NLS.bind(Messages.action_0_failed_on_file_1_reason_2,
+ new String[] { ACTION_CHMOD, fileToChmod, e.getMessage() }), e);
}
+ return Status.OK_STATUS;
}
private void readOffStream(InputStream inputStream) {
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties
index 9ad0f2335..a58772ee9 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007, 2014 IBM Corporation and others.
+# Copyright (c) 2007, 2019 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
# Rapicorp, Inc - prompt to install debian package
+# SAP SE - bug 465602
###############################################################################
BackupStore_backupCopy_closed_store=Can not perform backup on closed backup store.
@@ -35,6 +36,8 @@ BackupStore_restore_closed_store=Can not perform restore on closed backup store
BlockMacUpdate_0=Installation impossible
BlockMacUpdate_1=The installation/update you are trying to perform can not be completed because of structural changes to Eclipse. The installation/update will stop and will leave your existing Eclipse installation intact. You need to retrieve a new version of Eclipse from http://download.eclipse.org/.
+action_0_status=The action {0} was performed.
+action_0_failed_on_file_1_reason_2=The action {0} on file {1} failed. Reason: {2}
action_0_failed_file_1_doesNotExist=The action {0} failed - file {1} does not exist
artifact_not_available=The artifact for {0} is not available.
unzipping=Extracting {0}

Back to the top