This is the mail archive of the
mailing list for the Cygwin project.
Native symbolic links to non-existent targets (possible bug?)
- From: Brian Ericson <bericson at ptc dot com>
- To: <cygwin at cygwin dot com>
- Date: Mon, 29 Sep 2014 22:21:00 -0500
- Subject: Native symbolic links to non-existent targets (possible bug?)
- Authentication-results: sourceware.org; auth=none
Cygwin appears to ignore "winsymlinks:native" when asked to create a
symbolic link to a non-existent target, reverting to its "magic header"
This can be demonstrated via the following examples (using a Cygwin shell):
echo hello > aaa
ln -s aaa bbb
ln -s xxx yyy
"notepad bbb" will show "hello", but "notepad yyy" produces "ãçææ
ãïxxx ". "bbb" is a native symbolic link, "yyy" is not. (This can
also be confirmed using "dir" (cmd.exe /c dir from within Cygwin) or
looking for the curved arrow glyph in the folder explorer.)
Note that this is in contrast to mklink (using a command prompt):
echo hello > aaaa
mklink bbbb aaaa
mklink yyyy xxxx
In this case, both mklink commands succeed; "notepad bbbb" works as
expected, and "notepad yyyy" pops up an alert with "Cannot find the yyyy
file. Do you want to create a new file?", which makes sense (it even
writes to xxxx if you say "yes").
Also, mklink-created symbolic links to non-existent targets appear to
work (just as they do on *nix) when the non-existent target is created:
echo hello again > xxxx
The result is now "hello again".
I initially stumbled upon this discrepancy in the following real-world
git init foo
git add .gitignore
git commit -m 'first commit'
git checkout -b links
mkdir -p a/b
echo hello > a/file_in_a
ln -s ../file_in_a a/b/link_to_file_in_a
git add a
git commit -m 'Added symbolic link'
At this point, we have a valid, native symbolic link, which can be
confirmed using notepad as before:
We run into problems, however, when we do the following:
git checkout master && git checkout links
Git will create the symbolic link *before* it creates the target, and
the result is a non-native file. "notepad a/b/link_to_file_in_a" now
produces "ãçææãï../file_in_a ".
Shouldn't Cygwin honor "winsymlinks:native" even with the target does
I'm using Cygwin 6.1.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple