durin42 added a comment.

  From the list:
  
  On Sep 1, 2017, at 02:16, Adrian Buehlmann <adr...@cadifra.com> wrote:
  
  > Ugh. Can I reply to a phabricator notification by email?
  > 
  > Adding gregory.sz...@gmail.com manually, as I'm not sure replaying to
  >  those nasty phabricator emails is going to work...
  > 
  >> On 2017-09-01 00:32, indygreg (Gregory Szorc) wrote:
  >>  indygreg created this revision.
  >>  Herald added a subscriber: mercurial-devel.
  >>  Herald added a reviewer: hg-reviewers.
  > 
  > [...]
  > 
  >> - if os.path.isdir(f):
  >> - # use EPERM because it is POSIX prescribed value, even though
  >> - # unlink(2) on directories returns EISDIR on Linux
  >> - raise IOError(errno.EPERM,
  >> - "Unlinking directory not permitted: '%s'" % f) +    # If the path 
doesn't exist, raise that exception. +    # If it is a directory, emulate POSIX 
behavior. +    try: +        st = os.stat(f) +        if 
stat.S_ISDIR(st.st_mode): +            # use EPERM because it is POSIX 
prescribed value, even though +            # unlink(2) on directories returns 
EISDIR on Linux +            raise IOError(errno.EPERM, +                       
   "Unlinking directory not permitted: '%s'" % f) +    except OSError as e: +   
     if e.errno == errno.ENOENT: +            raise + +    # In the common 
case, a normal unlink will work. Try that first and fall +    # back to more 
complexity if and only if we need to. +    try: +        os.unlink(f) +        
return +    except (IOError, OSError) as e: +        pass
  >>   1. POSIX allows to unlink and rename open files. Windows has serious
  >>   2. problems with doing that:
  > 
  > Do you get an error at all, if a file, which is in open state, is unlinked?
  > 
  > My fear is: You won't get an error, but instead the filename is blocked
  >  by the file being held in place by the other process, until the other
  >  process closes it. Which means: You already lost the game.
  > 
  > Which would explain why we didn't do things like you propose here.
  > 
  > See also
  > 
  >   https://www.mercurial-scm.org/wiki/UnlinkingFilesOnWindows
  >    
  > 
  > (specifically, heading 2)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D588

To: indygreg, #hg-reviewers, quark
Cc: durin42, quark, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to