bug in cygwin_conv_to_posix_path() caused by period in win32 path

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Jul 13 07:37:00 GMT 2007

On Jul 12 21:01, Pavel Kudrna wrote:
> After that change cygwin_conv_to_posix_path() treats all following paths 
> in the same
> way:
> c:\     /cygdrive/c
> c:      /cygdrive/c
> c:\.\   /cygdrive/c/
> c:\.    /cygdrive/c
> c:.\    /cygdrive/c/./
> c:.     /cygdrive/c/.
> Before the suggested change last two items were slashified only.

C:. in DOS terms is *not* the same as /cygdrive/c/.  C:. is something
which has no meaning in the POSIX world.  There is no such thing as a
drive-relative current working directory [DCWD] in POSIX.  The above
conversion is plain wrong.  I don't see how converting a pure DOS-ism
into a wrong POSIX path is doing any good.

As for the idea to use the environment variables storing the DCWD in
Cygwin, these variables are being created by CMD.EXE(*).  So they don't
even exist if you start your shell without the detour of starting a
batch file.  They don't exist when you start your shell with a desktop
shortcut, by starting rxvt, or by starting your shell through a remote
ssh session.  Trick question:  How is Cygwin supposed to convert C:.
correctly when there's no information about the DCWD for drive C?

The bottom line is, I don't think it makes sense to convert C:. into a
POSIX path at all.


(*) and, funny enough, there's no API call in Win32 to return a DCWD.
There's just a call GetCurrentDirectory() which returns *the* CWD.
Which makes sense, given that the RTL_USER_PROCESS_PARAMETERS can only
store one CWD per process.

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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/

More information about the Cygwin mailing list