changeset 6321:23fcb7fce77c

8006536: [launcher] removes trailing slashes on arguments Reviewed-by: ksrini, akhil Contributed-by: jviswana@linux.vnet.ibm.com
author ksrini
date Fri, 01 Feb 2013 07:25:51 -0800
parents e52ec1a93974
children 41edc28b57f6
files src/windows/bin/cmdtoargs.c test/tools/launcher/Arrrghs.java
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/bin/cmdtoargs.c	Sat Dec 29 17:43:32 2012 +0400
+++ b/src/windows/bin/cmdtoargs.c	Fri Feb 01 07:25:51 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,6 +104,11 @@
 
         case ' ':
         case '\t':
+            if (prev == '\\') {
+                for (i = 0 ; i < slashes; i++) {
+                   *dest++ = prev;
+                }
+            }
             if (quotes % 2 == 1) {
                 *dest++ = ch;
             } else {
@@ -591,6 +596,12 @@
     // v->disable();
     vectors[i++] = v;
 
+    v= new Vector(argv[0], "a b\\\\ d");
+    v->add("a", FALSE);
+    v->add("b\\\\", FALSE);
+    v->add("d", FALSE);
+    vectors[i++] = v;
+
     dotest(vectors);
     printf("All tests pass [%d]\n", i);
     doexit(0);
--- a/test/tools/launcher/Arrrghs.java	Sat Dec 29 17:43:32 2012 +0400
+++ b/test/tools/launcher/Arrrghs.java	Fri Feb 01 07:25:51 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -311,6 +311,7 @@
         checkArgumentParsing("../../*", "../../*");
         checkArgumentParsing("..\\..\\", "..\\..\\");
         checkArgumentParsing("../../", "../../");
+        checkArgumentParsing("a b\\ c", "a", "b\\", "c");
     }
 
     private void initEmptyDir(File emptyDir) throws IOException {