delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/08/19:21:33

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM
X-Spam-Check-By: sourceware.org
Message-ID: <513562.83001.qm@web88302.mail.re4.yahoo.com>
X-RocketYMMF: ilatypov
Date: Mon, 8 Mar 2010 16:21:16 -0800 (PST)
From: Ilguiz Latypov <ilatypov AT infradead DOT org>
Subject: allow executing a path in backslash notation
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
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

--0-420054160-1268094076=:83001
Content-Type: text/plain; charset=us-ascii


The attached patch allows executing a path in backslash notation.  This can be tested in the Cygwin builds of GNU make with the "DOS compatibility" compile-time option of GNU make enabled, such as those from Cygwin make packages 3.79 and 3.80.

$ cat dos-compat.mak
default:
        ..\echo.exe test
        C:\<FULLPATH>\echo.exe test

$ ./make.exe --win32 -f dos-compat.mak
..\echo.exe test
test
C:\<FULLPATH>\echo.exe test
test

The patch cannot be tested by simply running a command in backslash notation in the existing Cygwin build of bash or pdksh because these shells re-implement the search of the potential executable command.  I believe these re-implementations are for improved user interaction and platform-independent security.

The patch is a blind conjecture because I am not fully aware about the intention of find_exec() in spawn.cc.  Its implementation seems exceedingly complicated to me, and the comments in the middle of the function about refusing a full Windows path contradict the description of the function above its prototype.

-- 
--0-420054160-1268094076=:83001
Content-Type: text/plain; name="cygwin-dos-compatibility.txt"
Content-Transfer-Encoding: base64
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G9wdCkpICE9IE5VTEwpDQogICAgIHsNCi0gICAgICBpZiAo
cG9zaXggJiYgIWhhc19zbGFzaCkNCisgICAgICBpZiAocG9zaXggJiYgIWhh
c19zbGFzaCAmJiAhaGFzX2JhY2tzbGFzaCkNCiAJew0KIAkgIHRtcFswXSA9
ICcuJzsNCiAJICB0bXBbMV0gPSAnLyc7DQpAQCAtMTQ3LDcgKzE0OCw3IEBA
DQogICAgICAgcGF0aCA9IHM7DQogICAgICAgcG9zaXhfcGF0aCA9IG15d2lu
ZW52IC0gMTsNCiAgICAgfQ0KLSAgZWxzZSBpZiAoaGFzX3NsYXNoIHx8IHN0
cmNociAobmFtZSwgJ1xcJykgfHwgaXNkcml2ZSAobmFtZSkNCisgIGVsc2Ug
aWYgKGhhc19zbGFzaCB8fCBoYXNfYmFja3NsYXNoIHx8IGlzZHJpdmUgKG5h
bWUpDQogICAgICAgfHwgISh3aW5wYXRoID0gZ2V0d2luZW52IChteXdpbmVu
dikpDQogICAgICAgfHwgIShwYXRoID0gd2lucGF0aC0+Z2V0X25hdGl2ZSAo
KSkgfHwgKnBhdGggPT0gJ1wwJykNCiAgICAgLyogUmV0dXJuIHRoZSBlcnJv
ciBjb25kaXRpb24gaWYgdGhpcyBpcyBhbiBhYnNvbHV0ZSBwYXRoIG9yIGlm
IHRoZXJlDQo=


--0-420054160-1268094076=:83001
Content-Type: text/plain; charset=us-ascii

--
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
--0-420054160-1268094076=:83001--

- Raw text -


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