This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygpath -m behaviour change
- From: bartels <bartels at mailme dot ath dot cx>
- To: cygwin at cygwin dot com
- Date: Wed, 18 Sep 2013 19:20:24 +0200
- Subject: Re: cygpath -m behaviour change
- Authentication-results: sourceware.org; auth=none
- References: <CAF+hkWpba76MxiLzbcfUD=bHs=N=Xbti7vN4qLw7H2BWtWYQYw at mail dot gmail dot com>
On 09/18/2013 04:34 PM, David Griffiths wrote:
Hi, the script is attempting to determine the directory in which it
exists, so CURRENT_DIR is a bit misleading. This is so that it can
access other files in the same package relative to it (quite a common
technique I think).
Might be helpful to have some examples:
/home/dgriff> mkdir test
/home/dgriff> cd test
/home/dgriff/test> cygpath -m "file\.."
./
/home/dgriff/test> cygpath -m "file/.."
cygpath: error converting "file/.." - No such file or directory
/home/dgriff/test> cygpath -m "file\..\.."
C:/cygwin/home/dgriff/
/home/dgriff/test> cygpath -m "file/../.."
cygpath: error converting "file/../.." - No such file or directory
/home/dgriff/test> touch file
/home/dgriff/test> cygpath -m "file/../.."
cygpath: error converting "file/../.." - No such file or directory
/home/dgriff/test> cygpath -m "file\..\.."
C:/cygwin/home/dgriff/
/home/dgriff/test> mkdir dir
/home/dgriff/test> cygpath -m "dir/../.."
C:/cygwin/home/dgriff/
Note that the backslash variant always works and all of these used to
work under previous levels of cygwin.
Conceptually, I have always considered relative paths to be relative to a directory.
Your one liners are creating a path relative to a file.
I think that approach is flawed and there is nothing wrong in the way cygpath works now.
Yesterday's cygpath behaviour was probably not intentional.
We have utilities like dirname and realpath available to help out.
Just my thoughts . . .
- Bartels
--
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