Alien-Build icon indicating copy to clipboard operation
Alien-Build copied to clipboard

MSYS / cygwin symlinks

Open hakonhagland opened this issue 4 years ago • 5 comments

This fixes issue #213 on my machine.

hakonhagland avatar Jan 22 '21 14:01 hakonhagland

Also note that MSYS2 can emulate symbolic links in at least three ways (see this blog for more information). For example:

$ touch a.txt
# Create a symbolic link:
$ MSYS=winsymlinks:nativestrict ln -s a.txt b.txt
# Create a .lnk shortcut file:
$ MSYS=winsymlinks ln -s a.txt c.txt
# Emulate symbolic links by copying the file:
$ MSYS= ln -s a.txt d.txt
$ ls -l
total 4.0K
-rw-r--r-- 1 hakon hakon 0 Jan 22 20:54 a.txt
lrwxrwxrwx 1 hakon hakon 5 Jan 22 20:54 b.txt -> a.txt
lrwxrwxrwx 1 hakon hakon 5 Jan 22 20:55 c.txt -> a.txt
-rw-r--r-- 1 hakon hakon 0 Jan 22 20:54 d.txt

Maybe we also need to check the content of the MSYS environment variable to distinguish between the cases?

hakonhagland avatar Jan 22 '21 20:01 hakonhagland

MSYS=winsymlinks:nativestrict ln -s a.txt b.txt

I added a new commit that I hope is more accurate, in that it tests for this case specifically on Cygwin and MSYS2

hakonhagland avatar Jan 23 '21 21:01 hakonhagland

This patch seems invasive for a $^O eq 'msys' which is an unofficial fork of Perl which as far as I can tell is only really useful for running autoconf.

plicease avatar Apr 03 '21 11:04 plicease

I think this is close. Aside from a couple of very minor nits mentioned above, I would like to keep the original simple one-statement call to symlink on UNIX and only delve into the msys/cygwin logic if we are on that platform.

plicease avatar Jun 30 '21 22:06 plicease

Thanks for the comments! In the meantime I have found some more accurate information about the behavior of symlinks on Windows when working on this issue. Unfortunately it is quite complicated. The plan is to come back to this PR later and update it..

hakonhagland avatar Jun 30 '21 22:06 hakonhagland