This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New symlinks.



 Hallo!

 Anny comments to the patter outline below the quote?

On Tue, 27 Feb 2001, Christopher Faylor wrote:
> On Tue, Feb 27, 2001 at 05:17:30PM +0100, Corinna Vinschen wrote:
> >On Tue, Feb 27, 2001 at 10:40:26AM -0500, Christopher Faylor wrote:
> >> I *really* don't think that the .lnk extension should show up when
> >> doing an "ls -l" as was suggested in another post.

> >> I am, as always, more concerned about supporting this feature in
> >> the long run.  If allowing foo.lnk to be referenced explicitly causes
> >> even one person confusion, I don't think that it is worth it.  It
> >> is certainly non-UNIX behavior.

> >I think it's correct behaviour. Cygwin doesn't show the .lnk
> >suffix by itself but nevertheless, to return a `file not found'
> >on `ls foo.lnk' wouldn't be correct. It's simply the truth:
> >The file `foo.lnk' exists and is a symlink.

> Again, it is surprising behavior.  Such a file would not exist on UNIX.
> I personally think that we should hide implementation details like
> "Oh yeah, we added a .lnk extension to all of our symbolic links"
> from the user.  There is no reason for them to know or care about
> this detail.


 Exactly. So How should it work?

 (Pseudo-code)
 ("filename" refers to posix-name, filehaeder referes to content of
  Win-File "filename.lnk" or Win-File "filename", which ever exist)

 (l)stat() : if ( (filename =="*.lnk") && (fileheader != shortcut))
               return fileinfo
            else if ( (filename =="*.lnk") && (fileheader == shortcut))
               return ENOENT
            else if ( (filename !="*.lnk") && (fileheader == shortcut))
               return (link)fileinfo (process as symlink)
            else
               return return fileinfo

 open() : same pattern

 dirent() : if ( (filename =="*.lnk") && (fileheader == shortcut))
              ignore file
            else
              list file


 In short:

 Let existing Win-name be "foo.lnk":

 posix-
 name   | valid shortcut | not shortcut
 -------+----------------+-----------------
 foo    | process as     |  ENOENT
        |   symlink      |
 -------+----------------+-----------------
 foo.lnk|   ENOENT       | return fileinfo/
        |                |  filehandle

 Let existing Win-name be "foo":

 posix-
 name   | valid shortcut | not shortcut
 -------+----------------+-----------------
 foo    | process as     | return fileinfo/
        |   symlink      |  filehandle
 -------+----------------+-----------------
 foo.lnk|   ENOENT       | ENOENT
        |                |


 There is no existing file with Win-name "foo" or "foo.lnk":

 Process as usual e.g. return ENOENT or create file of given
 name and extension

 (I hope, I do not mixed things here ...)

 Problem:
 What to do, if there is both: a file with Win-Name "foo and
 a file with Win-Name "foo.lnk" ?

 If none of it is a valid shortcut, then that is no problem at all.
 both are stat() and open() able.

 If "foo.lnk" is a valid shortcut, then I would say the real
 file "foo" should win. That is, the shortcut would be invisible.
 This is consistent with Unix, where you cant have a file and a
 symlink of the same name in one directory.


   Bjoern

-- 
+---------------------------------------------------------------------+
| Dipl.-Phys. Bjoern Kahl +++ AG Embedded Systems and Robotics (RESY) |
| Informatics Faculty +++ Building 48 +++ University of Kaiserslautern|
| phone: +49-631-205-2654 +++ www: http://resy.informatik.uni-kl.de   |
+---------------------------------------------------------------------+


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]