bug: hard links to soft links do not work

Igor Pechtchanski pechtcha@cs.nyu.edu
Thu Aug 1 14:14:00 GMT 2002


On Thu, 1 Aug 2002, Randall R Schulz wrote:

> My hunch is that a patch gratefully accepted for this situation would be an
> addition to the "ln" command that detected when the target was a Windows
> shortcut-based Cygwin symlink and in that case supplied the ".lnk"
> extension if it was not already present in the specified new link name.

Just a minor comment - a ".lnk" should actually be added to the new link
name even if it is present (i.e., "aaa.lnk" should become "aaa.lnk.lnk"),
as the intent would be that the ".lnk" would be part of the visible name,
and if the file becomes a symbolic link, the ".lnk" would be lost.
It's not even 2c, it's <1c, but why not?.. ;-)
	Igor

On Thu, 1 Aug 2002, Randall R Schulz wrote:

> Sam,
>
> The hard link to the symlink is made somewhat "blindly" in that the ".lnk"
> suffix that indicates that the link target is itself a symlink is not
> automatically added to the newly created hard link. Since the
> interpretation of a file's contents as a symbolic link is not based on any
> content signature (such as, say, a magic number) but rather only by the
> extension, a hard link without the ".lnk" (or, equivalently, a shortcut
> file renamed to omit the ".lnk" extension) will not be interpreted as a
> symbolic link.
>
> Thus the binary junk you saw was the shortcut / symlink contents themselves.
>
> At the end of the series of commands you gave (using an NTFS file system,
> of course), this is the result (note the "inode" numbers in the left column):
>
> % ll -i foo 1 2 3
> 6537940 -rw-rw-r--    2 RSchulz  None            4 Aug  1 12:34 1
> 10863326 lrwxrwxrwx    2 RSchulz  None           82 Aug  1 12:34 2 -> 1
> 10863326 -r-xr-xr-x    2 RSchulz  None           82 Aug  1 12:34 3*
> 6537940 -rw-rw-r--    2 RSchulz  None            4 Aug  1 12:34 foo
>
> My hunch is that a patch gratefully accepted for this situation would be an
> addition to the "ln" command that detected when the target was a Windows
> shortcut-based Cygwin symlink and in that case supplied the ".lnk"
> extension if it was not already present in the specified new link name.
>
> Randal Schulz
> Mountain View, CA USA
>
>
> At 11:19 2002-08-01, Sam Steingold wrote:
> >cygwin does not handle hard and soft links together:
> >
> >$ echo "foo" > foo
> >$ ln foo 1
> >$ cat 1
> >foo                             ; GOOD!
> >$ ln -s 1 2
> >$ cat 2
> >foo                             ; GOOD!
> >$ ln 2 3
> >$ cat 3
> ><some binary data instead of "foo">
> >$
> >
> >I.e., hard links to soft links do not work.
> >
> >--
> >Sam Steingold
>
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list