absolute native symlinks vs file explorer on windows 8.1

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Dec 5 09:50:00 GMT 2013

On Dec  4 22:26, Andras Nagy wrote:
> I'm experiencing the following symptom with the latest 64bit cygwin on
> windows 8.1: absolute native symlinks created with cygwin differ slightly
> from those created with mklink; cygwin's symlinks start with a "\\?\" .
> Because of this, file explorer (nee windows explorer) refuses to handle them
> properly, specifically, nothing happens when I double click on such a
> symlink. See exact repro below.
> Cygwin exhibits the same behavior on windows 7, but windows 7's explorer
> handles such symlinks fine.

It also works fine on Windows Vista and Windows 8.  This is most
certainly a bug in Windows 8.1.

Cygwin uses the official OS function CreateSymbolicLinkW[1], which
handles the \\?\ prefix and thus long pathnames just fine.

CMD and the rest of the Windows 8.1 OS handles symlinks with long path
prefix correctly (try: cmd /c type v1.txt).  Only the ShellExecuteW
function seems to be broken now.

> Questions:
> - Why does the target of the native cygwin symlink start with "\\?\"  ?

Long path prefix[2].

> - Is there a way to make cygwin not add that prefix to native symlinks?

No, because it always worked so far.  We were not aware that Micorsoft
broke this functionality on Windows 8.1.

> - Alternatively, is there a way to make windows 8's file explorer behave
> like windows 7's explorer and tolerate such native symlinks?

This question you have to ask Microsoft.

We could workaround this in the next Cygwin version at least for short
paths < 260 chars by omitting the \\?\ prefix in this case.  It wouldn't
be the first OS bug we have to workaround, but it's kind of annoying
even so.

I'm going to discuss this bug in the Microsoft forums[3], maybe it will
get fixed in upcoming versions of Windows again.  I don't think we will
ever see a fix for 8.1, though.


[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa363866%28v=vs.85%29.aspx
[2] http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath
[3] http://social.msdn.microsoft.com/Forums/en-US/073d02a6-1181-4694-9e50-d6a05bd80663/shellexecutew-w-symlinks-broken-on-windows-81?forum=windowsgeneraldevelopmentissues

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131205/f67206d9/attachment.sig>

More information about the Cygwin mailing list