delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/12/12/08:45:47

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TBC,TW_OV,TW_VX
X-Spam-Check-By: sourceware.org
Message-ID: <4EE60569.8040609@bridge-quest.com>
Date: Mon, 12 Dec 2011 17:45:13 +0400
From: Dmitry Bolshakov <dmitry DOT bolshakov AT bridge-quest DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: it seems a bug inside cygwin in parsing command line with double quotes and backslashes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT 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

- Raw text -


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