Add support for creating native windows symlinks

Russell Davis
Sun Dec 4 07:07:00 GMT 2011

This was discussed before here:

These were the reasons given for not using native symlinks to create
cygwin symlinks, along with my responses:

- By default, only administrators have the right to create native
  symlinks.  Admins running with restricted permissions under UAC don't
  have this right.

This is true, however the feature can be made optional through the
CYGWIN environment variable (just like winsymlinks). For users that
can add the permission or disable UAC, the use of native symlinks is a
huge step towards making cygwin more unified with the rest of Windows.

- When creating a native symlink, you have to define if this symlink
  points to a file or a directory.  This makes no sense given that
  symlinks often are created before the target they point to.

Also true. However, the type only matters for Windows' usage of the
symlink -- cygwin already treats both the types the same. For example,
if a native symlink of type `file` actually points to a directory, it
will still work fine inside cygwin. It won't work for Win32 programs
that try to access it, but that's still no worse than the status quo
-- Win32 programs already can't use cygwin symlinks.

Since cygwin already supports reading of native symlinks, I was able
to add support for this with a fairly small change. Some edge cases
probably still need to be handled (disabling for older versions of
windows and unsupported file systems), but I wanted to get this out
there for review. The patch is attached.

Russell Davis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: symlinks.patch
Type: application/octet-stream
Size: 4959 bytes
Desc: not available
URL: <>

More information about the Cygwin-patches mailing list