bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

child command line quoting in NT


From: Dmitry Karasik
Subject: child command line quoting in NT
Date: Wed, 02 May 2001 12:32:33 +0200

Dear All

I found an annoying situation under NT when cvs launches
child processes that are compiled with cygwin, and those
parse their command-line incorrectly if their argv[0] if quoted.
Recognizing that this is not a cvs problem, I assumed that,
for example, c:/usr/bin/ssh.exe is not necessary to quote,
as windows-NT/run.c:build_command(char**) does.

There's a patch to windows-NT/run.c, that quotes arguments
only if necessary:

--- C:\src\cvs-1.11.1p1\windows-NT\run.c Thu Apr 19 19:29:13 2001
+++ run.c Wed May 02 10:14:24 2001
@@ -533,6 +533,7 @@
         int i;

  len = 0;
+
         for (i = 0; argv[i]; i++)
  {
      char *p;
@@ -570,7 +571,13 @@
  for (i = 0; argv[i]; i++)
  {
      char *a;
-     *p++ = '"';
+            int need_quota = 0;
+     for (a = argv[i]; *a; a++)
+               if ( *a == ' ') {
+                  need_quota = 1;
+                  break;
+               }
+     if ( need_quota) *p++ = '"';
      for (a = argv[i]; *a; a++)
      {
          if (*a == '"')
@@ -578,7 +585,7 @@
   else
       *p++ = *a;
      }
-     *p++ = '"';
+     if ( need_quota) *p++ = '"';
      *p++ = ' ';
  }
  if (p > command)


-----------
The problem can be reproduced under the following conditions:

$ export CVS_RSH=ssh
$ cvs -d :ext:whatever.domain:/whatever/path co whatever_project

of even without cvs  :)  - the suspect ( ssh in my case ) cannot be run
successfully from within the directories with space in name.

Sincerely,
  Dmitry Karasik


NB I am not subscribed to any cvs mailing lists, so please mail me
directly





reply via email to

[Prev in Thread] Current Thread [Next in Thread]