Serious brokeness of treating .lnk files as symlinks

Andrej Borsenkow Andrej.Borsenkow@mow.siemens.ru
Sat May 26 01:38:00 GMT 2001


>
> A more serious problem is that if I use tar to archive .lnk
> files, they are
> not restored properly. They started as 'fat' links, and get restored as
> 'skinny' links. This new behaviour means that no cygwin tool will
> be able to
> handle backing up .lnk files properly.
>

I am afraid there is no solution without breaking compatibility. On Unix
symlink does not have any "contents" except the file name it points to. So,
tar saves just this filename. This allows tar archive to be moved to any
other compliant system. If you tar your files on Cygwin and restore them on
Unix you get identical filesystem structure including symlinks.

Saving additional information about symlink would mean extending tar format.
Such format is no more compatible with normal tar. It needs own magic number
to distinguish from normal tar. It cannot be restored on another system
anymore. It is a lot of work that is not limited to just additional open()
flag.

> My preferred solution would be to add a flag to the open() call, say
> O_LNKISFILE, which prevents the treating of a .lnk file as a symlink. This
> flag should be used by cp -d and tar to ensure correct behaviour
> when handling
> .lnk files.
>

cp case is different. I believe, cp should by default behave as you
descrived - if it is told to preserve symlink, it should preserve them -
exactly.

>
> Desktop/Bash2.lnk -> %USERPROFILE%\bash.bat
>
> cygwin doesn't understand this, and so complains the file doesn't
> exist

> This problem should be cured by the O_LNKISFILE flag as well.
>

Not that I understand. That problem has nothing to do with any flag. I did
not know that it is supported by Windows, but if it is, Cygwin should
support it as well by default. IIRC it was stressed that new symlinks are
compatible with Windows shortcuts.

-andrej


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list