This is the mail archive of the
cygwin
mailing list for the Cygwin project.
it seems a bug inside cygwin in parsing command line with double quotes and backslashes
- From: Dmitry Bolshakov <dmitry dot bolshakov at bridge-quest dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 12 Dec 2011 17:45:13 +0400
- Subject: it seems a bug inside cygwin in parsing command line with double quotes and backslashes
hi
when launching cygwin's programs from within windows's cmd
if the command line parameter has two backslashes and is double quoted (e.g. a path to local network drive)
then inside cygwin's program the corresponding ARGV element has single backslash only
but without double quotes all is ok - both backslashes are kept
simple testcase
C:\Documents and Settings\bdimych>cmd
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>c:\cygwin\bin\bash -c "set -x; : $*" -- "\\blabla"
+ : '\blabla'
C:\Documents and Settings\bdimych>c:\cygwin\bin\bash -c "set -x; : $*" -- \\blabla
+ : '\\blabla'
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>c:\Perl\bin\perl.exe -e "print $ARGV[0]" "\\blabla"
\\blabla
C:\Documents and Settings\bdimych>c:\cygwin\bin\perl.exe -e "print $ARGV[0]" "\\blabla"
\blabla
C:\Documents and Settings\bdimych>c:\cygwin\bin\perl.exe -e "print $ARGV[0]" \\blabla
\\blabla
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>c:\Ruby192\bin\ruby.exe -e "print ARGV[0]" "\\blabla"
\\blabla
C:\Documents and Settings\bdimych>c:\cygwin\bin\ruby.exe -e "print ARGV[0]" "\\blabla"
\blabla
C:\Documents and Settings\bdimych>c:\cygwin\bin\ruby.exe -e "print ARGV[0]" \\blabla
\\blabla
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
it seems a bug somewhere inside cygwin libraries
PS
cygwin version
bdimych@bolshakovxp ~
$ uname -a
CYGWIN_NT-5.1 bolshakovxp 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin
PPS
whoops, tcl occured has no this bug
it has some initialization problems but the value has two backslashes
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>echo puts $argv | c:\Tcl\bin\tclsh.exe - "\\blabla"
- {\\blabla}
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>echo puts $argv | c:\cygwin\bin\tclsh84.exe - "\\blabla"
application-specific initialization failed: Can't find a usable init.tcl in the following directories:
c:/cygwin/share/tcl8.4 c:/cygwin/share/tcl8.4 c:/cygwin/usr/share/tcl8.4 c:/share/tcl8.4 c:/cygwin/library c:/library c:/../tcl8.4.1/library
This probably means that Tcl wasn't installed properly.
- {\\blabla}
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>echo puts $argv | c:\cygwin\bin\tclsh84.exe - \\blabla
application-specific initialization failed: Can't find a usable init.tcl in the following directories:
c:/cygwin/share/tcl8.4 c:/cygwin/share/tcl8.4 c:/cygwin/usr/share/tcl8.4 c:/share/tcl8.4 c:/cygwin/library c:/library c:/../tcl8.4.1/library
This probably means that Tcl wasn't installed properly.
- {\\blabla}
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
PPPS
gawk has
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>c:\cygwin\bin\gawk.exe "BEGIN {print ARGV[1]; exit}" "\\blabla"
\blabla
C:\Documents and Settings\bdimych>c:\cygwin\bin\gawk.exe "BEGIN {print ARGV[1]; exit}" \\blabla
\\blabla
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
C:\Documents and Settings\bdimych>
--
With best regards
Dmitry Bolshakov
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple