cygpath -m behaviour change

bartels bartels@mailme.ath.cx
Wed Sep 18 17:31:00 GMT 2013


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



More information about the Cygwin mailing list