[haiku-bugs] Re: [Haiku] #8321: Symbolic link is followed when replacing a file!

  • From: "anevilyak" <trac@xxxxxxxxxxxx>
  • Date: Sat, 11 Feb 2012 01:52:27 -0000

#8321: Symbolic link is followed when replacing a file!
---------------------------------------+----------------------------
   Reporter:  Pete                     |      Owner:  korli
       Type:  bug                      |     Status:  new
   Priority:  normal                   |  Milestone:  R1
  Component:  Applications/StyledEdit  |    Version:  R1/Development
 Resolution:                           |   Keywords:
 Blocked By:                           |   Blocking:
Has a Patch:  0                        |   Platform:  All
---------------------------------------+----------------------------

Comment (by anevilyak):

 Replying to [comment:5 Pete]:
 > OK -- glad that you think it not quite right, too.  I don't see it as
 the application's job to fix it, though.  Shouldn't this be the
 FilePanel's responsibility?  Having the alert give a choice of replacing
 either the link itself or the file it references might be the best route.

 No, it's the application. All the file panel does is select a file, it's
 in no way responsible for the subsequent modifications, and it does in
 fact give back a reference to the symbolic link. However, under normal
 circumstances, when one opens a file, the filesystem API calls deal with
 following the link and opening its target implicitly, as this allows apps
 to transparently work with symlinks without any extra work. In the case of
 an overwrite, what one normally does is open the file with a truncate
 flag, and then start writing the new contents. However, if the target is a
 symlink, this obviously doesn't quite result in the desired behavior, so
 the app does have to be smart enough to detect that situation when being
 asked to save/overwrite.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/8321#comment:6>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: