delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/06/25/16:06:50

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_YG,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4E063FBF.8040103@lysator.liu.se>
Date: Sat, 25 Jun 2011 22:06:23 +0200
From: Peter Rosin <peda AT lysator DOT liu DOT se>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Strange cygpath behavior.
References: <73619422 DOT 20110621092310 AT mtu-net DOT ru> <4E00321A DOT 30105 AT lysator DOT liu DOT se> <92658329 DOT 20110623165230 AT mtu-net DOT ru> <4E03492D DOT 40109 AT gmail DOT com> <1144668147 DOT 20110623190534 AT mtu-net DOT ru> <4E035F46 DOT 7000207 AT gmail DOT com> <1291997550 DOT 20110623220605 AT mtu-net DOT ru>
In-Reply-To: <1291997550.20110623220605@mtu-net.ru>
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

Den 2011-06-23 20:06 skrev Andrey Repin:
> Greetings, Marco atzeri!
> 
>> On 6/23/2011 5:05 PM, Andrey Repin wrote:
>>> Greetings, Marco atzeri!
>>>
>>> Cygwin, to my best understanding, is supposed to transparently accept native
>>> Windows paths.
> 
>> No, cygwin expects to receive POSIX/Unix paths
> 
>> $ cygpath -h
>> [cut]
>>    -u, --unix            (default) print Unix form of NAMEs 
>> (/cygdrive/c/winnt)
> 
>> so cygpath -u
>> expects to receive a Windows path and convert it in a unix one.
> 
> That's your assumption. Which is not necessarily true. (Unless you're author
> of cygpath, in which case you have full authority to tell me what it is
> supposed to be.)
> Man page and reference card both do not specify the exact argument format,
> only the intended result format.

cygpath, at its core, calls some form of the cygwin_conv_path API. That
function takes either a POSIX path or a Win32 path and converts to the
other form. Anything interesting or useful that's happening when feeding
it a Win32 path and requesting it to convert from POSIX to Win32 is
purely coincidental and should not be relied upon. It you don't have a
desire to revisit your code later on and fix any breakage, that is...

(However, I'm not the cygpath author, but the src is readily available)

The fact that cygpath is not good for one-shot conversions from a Win32
path to some other form of Win32 path appears to not be explicitly
documented. But you should get the dos-file-warning if you try, which
should be a good hint that you are in murky waters.

Cheers,
Peter

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