Web lists-archives.com

Re: FW: [Mingw-msys] How do I recreate the MSYS distribution?




Bob Paddock wrote:

> XP, and presumably Vista, do have symbolic links, they are called
> 'Junctions
> Points'.

[ all of the below refers to pre-Vista, since they added some actual
symlink goo there ]

It's somewhat misleading to say that Windows has symbolic links when
referring to NTFS junctions, because they work on directories only, not
files, which is a significant limitation.  Another limitation is that
the target of a junction cannot be a relative path, only an absolute
path, so you cannot achieve the semantic equivalent of "ln -s
../dir/file foo".  Sure, you can make an absolute path out of
"../dir/file" but that is not the same; for example:

$ mkdir -p base1/sub1 base1/sub2 base2/sub1

$ echo "file1" >base1/sub1/file

$ echo "file2" >base2/sub1/file

$ (cd base1/sub2 && ln -s ../sub1/file symlink)

$ cat base1/sub2/symlink
file1

$ mv base1/sub2 base2

$ cat base2/sub2/symlink
file2

This demonstrates that the link itself contains a relative path that
moves with the link, not a fixed absolute target.

The linked article talks about the fact that you can use NTFS links for
files to work around the fact that junctions are for directories only,
but this is also misleading because NTFS links are not symbolic; they
link files by inode not by name.  Hard link != soft link, e.g.:

$ echo "one" > one; echo "two" > two

$ ln -s one symlink

$ cat symlink
one

$ mv one one_orig; mv two one

$ cat symlink
two

If you try that with NTFS hard links you get "one" as the final output
because the link follows the rename of its target since they are really
referring to the same file, rather than the filename that the file had.

All of the above are reasons why you cannot simply say "Windows has
symbolic links."  It does not.  They are not the same.  You can kind of
sort of see how things might line up if you squint, but they really have
totally different semantics.

Brian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys