odd behavior of symlinks on Win XP SP2

Corinna Vinschen corinna-cygwin@cygwin.com
Sat Jan 15 13:35:00 GMT 2005

On Jan 14 20:05, Igor Pechtchanski wrote:
> On Fri, 14 Jan 2005, Jeff.Hodges wrote:
> > Mostly these are symlinks to directories which I use to more
> > conveniently traipse around my filesystem. This was true of all my
> > cygwin install/upgrades on Win2k from say 1999 thru 2004. The native Win
> > filesystem has been NTFS in all cases, fwiw.

2001.  The shortcuts have been added to Cygwin in 2001.

> > 1. cygwin-created (via "ln -s") symlinks/shortcuts pointing to a
> > directory are displayed in windows file dialogs with the windows default
> > "funky file" icon (I dunno what it's actual name is) rather than the
> > windows folder icon as used to be the case on win2k/cygwin.
> > 
> > 2. cygwin-created (via "ln -s") symlinks/shortcuts pointing to a
> > directory are displayed in some windows file-open or file-save dialogs,
> > but not in others. On win2k/cygwin, they were always displayed and
> > always behaved exactly like windows-created shortcuts pointing to a
> > directory. In terms of how they are behaving on WinXP/cygwin..
> >
> > 2.1. In the cases where they *are* displayed in windows file-open or
> > file-save dialogs, e.g. using windows version of OpenOffice 1.1.3, the
> > program in question attempts to either open the symlink/shortcut file
> > itself or overwrite it, respectively.
> >
> > 2.2. In the cases where they "are not* displayed in the windows dialog
> > (whether open or save), e.g. as done by Firefox 1.0 in the file-save
> > case, well, the symlink/shortcut simply isn't listed in the dialog, when
> > on win2k/cygwin they were displayed (and behaved) just fine.
> Hmm, interesting.  I've never noticed this, but your mail prompted me to
> look on my own machine.  And, lo and behold, on a plain WinXP SP1 (note,
> no SP2) I get the same behavior.

But they work in Windows Explorer, nevertheless.  We're not in control
of the icon used by Windows.  As soon as we do, the shortcut is not a
Cygwin shortcut anymore and it's saved by tar as a file rather than a

> I've noticed this.  Further, after a quick look at the structure of the
> symlinks[*] shows that the shortcuts created by WinXP have much more stuff
> in them (513 bytes vs. 115 bytes), and they seem to have most of the stuff
> (comments and paths) in Unicode.  I suspect that WinXP doesn't really deal
> well with non-Unicode shortcuts.
> Perhaps an update to Cygwin's symlink() implementation is in order?  The
> one that's there now actually has the structure of a Windows symlink
> hard-coded in (which apparently fails on XP).  See path.cc in
> src/winsup/cygwin.  <http://cygwin.com/acronyms/#PTC>.

It has been done so for speed.  And it doesn't really fail.  The shortcut
is still a shortcut in Windows Explorer.  I'm wondering if it's really 
the Unicodeness of the shortcut which makes the difference.  Usually
shortcuts generated in Windows Explorer are much longer anyway.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

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