cygpath unable to translate the *nix path to an NTFS junction point

Corinna Vinschen
Tue Nov 23 10:19:00 GMT 2010

On Nov 23 12:34, Pierce Morton wrote:
> If you've got a junction point (let's call it JUNC, located at
> c:\example\junc ) and a real folder TARG (located at c:\example\TARG )
> and your junction point points to TARG:
> cygpath -w /cygdrive/c/example/junc
> will give you
> c:\example\TARG
> as your output instead.
> This leaves cygpath completely unable to translate the original path
> of an NTFS junction.  This is proving to be a problem for me (I'm
> trying to use the output of cygpath for the equivalent of a backtick
> operation in another script...)

Sorry if I don't get your problem.  The resulting path is correct, isn't
it?  Cygwin handles junction points as symlinks.  When creating
a Windows path, symlinks get resolved, since native Windows applications
(the target audience for cygpath -w) don't understand symlinks.

> However, the reverse (win to nix) works fine:
> cygpath "c:\example\junc"
> gives you
> /cygdrive/c/example/junc
> without the faulty translation.

"Faulty" is a bit harsh, isn't it?  The target audience for `cygpath -u'
are POSIX apps which *do* understand symlinks, so it's not necessary
to resolve them.

> Interestingly enough, cygpath does not normally seem to care whether
> or not a folder really exists.
> cygpath -w /cygdrive/c/thisdirisnotreal/blah
> will give you
> c:\thisdirisnotreal\blah
> even if "thisdirisnotreal" doesn't exist in the filesystem.

Sure.  Otherwise it's not possible to create DOS paths from POSIX paths
for yet-to-be-created files.


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

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list