delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=2.5 required=5.0 tests=AWL,BAYES_00,BOTNET |
X-Spam-Check-By: | sourceware.org |
Message-id: | <4B75A507.4050801@cygwin.com> |
Date: | Fri, 12 Feb 2010 13:59:19 -0500 |
From: | "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com> |
Reply-to: | cygwin AT cygwin DOT com |
User-Agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090320 Remi/2.0.0.21-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0 |
MIME-version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: execute a file in backslash notation from shell |
References: | <202081 DOT 90708 DOT qm AT web88306 DOT mail DOT re4 DOT yahoo DOT com> |
In-reply-to: | <202081.90708.qm@web88306.mail.re4.yahoo.com> |
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 |
On 02/12/2010 12:33 PM, Ilguiz Latypov wrote: > > It never occurred to me that shells are unable to execute their first > word in the Windows native backslash format, > > $ 'c:\cygwin\bin\echo.exe' test > bash: c:\cygwin\bin\echo.exe: command not found > > $ ls -la 'c:\cygwin\bin\echo.exe' > -rwxr-xr-x 1 ilatypov Domain Users 48128 2008-12-17 17:16 c:\cygwin\bin\echo.exe > > > I suspect that none of the shells was ever patched to attempt the > "native Windows to POSIX" conversion on the first word of the command line. > > Ideally, the patches would not be necessary had the shells used a > filename translation/detection/manipulation API. But Posix does not seem to provide a > complete API for this. > > Alternatively, the shells could attempt to execute the first word as a > program through the exec..() family of C library calls. > > Instead, bash and pdksh execute the first word of the command line in > the following cases. > > (a) The first word has forward slashes. > (b) Concatenation of the first word against elements of PATH points > (probably, with addition of default suffixes) to an existing file. > > I am attaching a patch to pdksh that allows to execute the first word in > backslash notation. This might be necessary for GNU make based build systems > that could pass a backslash filename to SHELL as a command. Thanks but the point of Cygwin is that individual applications shouldn't need altering in order to build and run. The intent is also to provide a POSIX environment supporting POSIX paths. The Cygwin DLL provides some facilities to convert POSIX<->DOS paths. This can be invoked directly using the 'cygpath' utility or Cygwin will do it transparently generally, but you have to properly quote the path (i.e. escape the backslashes or enclose the whole path inside ' '). There are some limitations to the transparent handling of DOS paths, since this requires detecting that the path is DOS. Some conventions of DOS paths conflict with that of POSIX. In those cases, the algorithm comes down on the side of POSIX. But 'cygpath' can always be used to help in these cases. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |