diff options
author | BJ Hargrave | 2020-04-03 20:29:19 +0000 |
---|---|---|
committer | Sarika Sinha | 2021-04-15 17:37:33 +0000 |
commit | 207745114db3eb38158326e0eb30db5161aa9101 (patch) | |
tree | 49153cf0156002ac6dd4fc13653142a9138de597 | |
parent | 5a322df14122ebc566a988436717be558e7fb5b5 (diff) | |
download | eclipse.platform.debug-207745114db3eb38158326e0eb30db5161aa9101.tar.gz eclipse.platform.debug-207745114db3eb38158326e0eb30db5161aa9101.tar.xz eclipse.platform.debug-207745114db3eb38158326e0eb30db5161aa9101.zip |
Bug 561772 - Fix handling of double quotes on windowsI20210416-0810I20210415-1800
When processing an argument on windows which includes double quotes,
the code fails to reset the backslash count when a non-backslash or
double quote character is encountered. This results in any double
quotes encountered after a backslash having excess backslashes
inserted before the double quote.
Change-Id: I4822dc702627228051e36d4b73c93cd6e2634e45
Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.debug/+/160458
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Sarika Sinha <sarika.sinha@in.ibm.com>
4 files changed, 18 insertions, 3 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 0a9b71229..6bc20d819 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -1653,6 +1653,8 @@ public class DebugPlugin extends Plugin { } else { buf.append('\\'); } + } else if (isWin32) { + backslashes = 0; } buf.append(ch); } diff --git a/org.eclipse.debug.tests/META-INF/MANIFEST.MF b/org.eclipse.debug.tests/META-INF/MANIFEST.MF index fe2881fb6..7695c6432 100644 --- a/org.eclipse.debug.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.debug.tests;singleton:=true -Bundle-Version: 3.12.100.qualifier +Bundle-Version: 3.12.200.qualifier Bundle-Activator: org.eclipse.debug.tests.TestsPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)", diff --git a/org.eclipse.debug.tests/pom.xml b/org.eclipse.debug.tests/pom.xml index 5bd56b297..cd08a840c 100644 --- a/org.eclipse.debug.tests/pom.xml +++ b/org.eclipse.debug.tests/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2012, 2019 Eclipse Foundation and others. + Copyright (c) 2012, 2021 Eclipse Foundation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Distribution License v1.0 which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ </parent> <groupId>org.eclipse.debug</groupId> <artifactId>org.eclipse.debug.tests</artifactId> - <version>3.12.100-SNAPSHOT</version> + <version>3.12.200-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> <code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings> diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java index 19e0c9f77..b53f70d72 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java @@ -204,6 +204,19 @@ public class ArgumentParsingTests extends AbstractDebugTest { } @Test + public void testRenderWindowsBackslash() throws Exception { + String[] arguments = { + "-Dfoo=\"abc\\def\\ghi\"" + }; + String rendered = DebugPlugin.renderArguments(arguments, null); + if (Platform.getOS().equals(Constants.OS_WIN32)) { + assertEquals("unexpected renderArguments result;", "-Dfoo=\\\"abc\\def\\ghi\\\"", rendered); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + assertEquals("unexpected renderArguments result;", "-Dfoo=\\\"abc\\\\def\\\\ghi\\\"", rendered); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + @Test public void testEscapeDoubleQuote1() throws Exception { execute1Arg("\\\"", "\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } |