delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/12/00:26:11

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-YMail-OSG: kaCq4T0VM1ngGIskCvZaZS.W73Itvf2_N3eor_x4nwvaxjFUqtDaBBq31WnkWLsTtMTD6EMlJMiw0WmhjKqRXW3gHlubO1AJpcBV8oHXYKNy9zwsGrkD4TcMDpDITq5HXHlCxel6_4LcSzE-
X-Mailer: YahooMailRC/818.31 YahooMailWebService/0.7.158.1
Date: Tue, 11 Dec 2007 21:25:34 -0800 (PST)
From: Brent <yhbrent AT yahoo DOT com>
Subject: Re: get cygpath to leave relative paths as relative?
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
Message-ID: <678518.3115.qm@web53803.mail.re2.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

Corinna wrote:

>This is not always possible when converting POSIX paths to Win32 paths
>for a couple of reasons.  One reason is that a relative path might
>contain symlinks, another one is that a path containing .. could cross
>mount points.  To recognize both cases extra processing is necessary
>which might convert the path to an absolute form.

Thanks for responding.

You use qualifiers like "not always possible" and "might".  Does that imply that cygpath CAN leave relative paths as relative under certain circumstances?

What I am seeing is that it always converts relative paths to absolute paths, even in cases that are outside the scenarios that you mention.  In particular, I have no symlinks.  But I am not sure what you mean by "cross mount points.  Sorry for my ignorance, but are you saying that if my path list contains paths that come from different physical drives ("mount points"?), then this will cause cygpath to always revert to absolute form?  If that is the meaning, then my path list does "cross mount points" because I have multiple physical drives.

On the other hand, I wrote a simple test script that basically just contains the line
    echo `cygpath -pw ../:../..`
I executed that script from a cygwin bash shell located several directories deep within one physical drive, so that the ..'s are guaranteed to stay within the same drive (i.e. so the path list above should never "cross mount points").  But cygpath still spits out absolute paths even in this case.

So, it is as if cypath always has the -a option on even if you do not specify it.


Igor wrote:

>... if you don't have any symlinks in the relative path,
> you should be able to use the forward slash variant without
>using cygpath.  All Windows system calls (and most Windows programs)
>understand forward slashes just fine.

Thanks for pointing out that most Windows system calls understand /'s just fine too--I had observed that with java before, but did not realize that it was so universal.

But the absence of symlinks will not help me avoid a call to cygpath because my path list by default uses unix style : chars as path separators, but if the script is running on windows (e.g. via cygwin), then the program that will use that path list (java in my case) needs windows style ; path separators.  (My script is intelligent enough to autodetect if is being run on cygwin, and it takes certain custom actions such as this in this case, because I want the script to run on any unix.)




      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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