delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/18/14:16:13

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Wed, 18 Oct 2000 14:15:04 -0400
From: Jason Tishler <Jason DOT Tishler AT dothill DOT com>
To: Cygwin <cygwin AT sources DOT redhat DOT com>
Subject: Double Backslash/Space exec Argument Problem
Message-ID: <20001018141504.B1023@dothill.com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
Organization: Dot Hill Systems Corp.

--QrVcLFVTQP43pKpF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Cygwin appears to double up backslashes in arguments containing spaces
when passed from a Cygwin program (e.g., bash) to a native Win32 program:

    $ foo 'C:\duda man'
    argv[1] = (C:\\duda man)
                  ^
                  +--- doubling

    $ foo 'C:\dudaman'
    argv[1] = (C:\dudaman)

However, when foo is run from cmd:

    H:\> foo "C:\duda man"
    argv[1] = (C:\duda man)

    H:\> foo "C:\dudaman"
    argv[1] = (C:\dudaman)

the doubling doesn't occur.

Note that foo.c compiled with gcc does not exhibit the doubling regardless
of the shell from which it is invoked.

See attached for foo.c.

Thanks,
Jason

P.S. The only reason that I stumbled across this, is that on Windows
98 the (non-leading) double backslashes are treated as UNC while on NT
they are not.  Hence, code that was running fine on NT started failing
with ERROR_BAD_NETPATH after long delays on 98.  Now I understand why
the Cygwin team holds Windows 9X in such high esteem! :,)

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corporation         Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason DOT Tishler AT dothill DOT com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--QrVcLFVTQP43pKpF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="foo.c"

#include <stdio.h>

int
main(int argc, char* argv[])
{
	char* s = argv[1];
	printf("argv[1] = (%s)\n", s);
}


--QrVcLFVTQP43pKpF
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
--QrVcLFVTQP43pKpF--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019