Subject: SMB symlink compatibility between Cygwin, Windows XP, and Windows 7
From: Brian Alexander <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 3 Oct 2012 19:33:55 -0500
List-Id: <cygwin.cygwin.com>

I have run into an issue when trying to create a symlink/shortcut to a 
network share (SMB) that will work between Cygwin, Windows XP, and Windows 
7.

If you set the environment variable CYGWIN=winsymlinks, you get the 
benefit that ln -s will create files that work as both Windows shortcuts, 
and Cygwin symlinks.  (Awesome!)

It seems like compatibility is broken between Windows 7 and Windows XP 
when it comes to these network links.

My setup:
xpbox is a computer running Windows XP, with cygwin installed, 
CYGWIN=winsymlinks
win7box is a computer running Windows 7, with cygwin installed, 
CYGWIN=winsymlinks
fileserver is a SMB file server, with shares called "share1" and "share2"

Here is my sequence of commands that leads to my problem:
On xpbox in a cmd window:
net use \\fileserver\share1 /user:domain\username
net use \\fileserver\share2 /user:domain\username
On xpbox in a cygwin terminal:
mkdir //fileserver/share1/folder1
ln -s //fileserver/share1/folder1 //fileserver/share2/link1

Now, when I open up \\fileserver\share2 on xpbox, I see a working shortcut 
called "link1" that gets me to \\fileserver\share1\folder1
If I run ls -l //fileserver/share2 in Cygwin, I see that Cygwin recognizes 
the link.
If I open up \\fileserver\share2 on win7box though, "link1" is a 
non-working shortcut.

More weirdness:
On xpbox in a cygwin terminal:
ln -s //fileserver/share1 //fileserver/share2/link2

link2 is recognized by Windows and Cygwin on both computers.

On win7box in a cygwin terminal:
ln -s //fileserver/share1 //fileserver/share2/link3
ln -s //fileserver/share1/folder1 //fileserver/share2/link4

link3 is not recognized by Windows XP, but works in Windows 7 and Cygwin 
on both computers.
link4 is not recognized by Windows XP, but works in Windows 7 and Cygwin 
on both computers.

If I use mkshortcut, instead of ln, then the shortcuts work on both 
Windows computers, but Cygwin does not recognize the link.

This seems like a compatibility bug in the way Cygwin is making the binary 
.lnk files.  I haven't had time to look at source code, but that will be 
my next step in figuring this out.

Anyone have any other ideas of how to make a shortcut to a SMB path that 
will work in both Windows XP and Windows 7, and is also traversable by 
cygwin?

Thanks,
Brian Alexander

--
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