delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/06/02/09:05:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,TW_RW,TW_WX,TW_XR,TW_YG,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4C065B9C.4020301@gmail.com>
Date: Wed, 02 Jun 2010 14:24:44 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT gmail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygpath behaviour when input is not a path
References: <83d3wff7t5 DOT fsf AT garydjones DOT name> <837hmmenu0 DOT fsf AT garydjones DOT name> <AANLkTilbSnkvkJwetC20mzSWld48nOTYtDnKp8OXNQNh AT mail DOT gmail DOT com> <83d3wdomiy DOT fsf AT garydjones DOT name> <4C030C39 DOT 8020303 AT gmail DOT com> <AANLkTil4WCMkMxicHxGwfLVE-dwCHxW7wF7PyhO6zVZf AT mail DOT gmail DOT com>
In-Reply-To: <AANLkTil4WCMkMxicHxGwfLVE-dwCHxW7wF7PyhO6zVZf@mail.gmail.com>
X-IsSubscribed: yes
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 01/06/2010 09:19, Gary . wrote:
> On 5/31/10, Dave Korn wrote:
>> On 30/05/2010 08:51, Gary wrote:
>>> Since the tool
>>> output is mixed paths and text, I'd hoped cygpath made "intelligent"
>>> guesses about what was and was not likely to be a path.
>>>
>>   Well, that is basically what it does; but, being a POSIX tool, the
>> consequence is that it assumes that a colon is just a char like any other in
>> a filename.
> 
> Okay. So I'm SOL with tool output like
> "Parse error: syntax error, unexpected '}' in
> C:\cygwin\home\jg\work\foo.php on line 10"
> then, short of parsing it myself :-(

  Hang on, isn't this is a bit far from your original question?  You wanted to
know what happens when cygpath is "given a PATH list ... without the -p
option".  Now you're telling me that you want to feed it a bunch of gibberish,
amongst which might or might not be a path, and have it spot that?  I think
you oversimplified the initial presentation a little there!

> Actually cygpath's response to the tool ouput in this instance was
> "cygpath: can't convert empty path"
> although that seems to be a barf on a previous, empty, line of output,
> because on testing just that line with cygpath -u I got
> "Parse error: syntax error, unexpected '}' in C:/cygwin/home/jg/work/foo.php on
> line 10"
> That is, the path is more posix-like, but certainly isn't "unixified".

  Well, have you ever heard the term GIGO?  That's basically what you're
getting here.  cygpath expects anything you pass it is a path, and given the
flexibility of the POSIX filename character set, it can't really be expected
to know better; how does it know you don't mean what you say?  After all, ...

> $ pushd /tmp/
> /tmp ~
> 
> $ mkdir posixpaths
> 
> $ cd posixpaths/
> 
> $ touch "Parse error: syntax error, unexpected '}' in"
> 
> $ ls -la
> total 0
> drwxr-xr-x+ 1 Admin None 0 2010-06-02 14:17 .
> drwxrwxrwt  1 Admin None 0 2010-06-02 14:17 ..
> -rw-r--r--  1 Admin None 0 2010-06-02 14:17 Parse error: syntax error, unexpec
> ted '}' in
> 
> $

... you might have a file by that name!  Sounds to me like you want to pipe it
through sed or grep (probably via d2u on the way) to extract just the
filenames and pass them to cygpath.

    cheers,
      DaveK


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