[darcs-devel] [patch1749] fix in patch index: use removeFile, not ... (and 6 more)

Ganesh Sittampalam bugs at darcs.net
Tue Nov 20 06:22:22 UTC 2018


Ganesh Sittampalam <ganesh at earth.li> added the comment:

On 20/11/2018 03:48, Ben Franksen wrote:
> 
> Ben Franksen <ben.franksen at online.de> added the comment:
> 
>>>  * fix in patch index: use removeFile, not 
>> removeDirectoryRecursive to remove noPatchIndex
>>
>>> -   removeDirectoryRecursive (repodir </> darcsdir </> 
>> noPatchIndex) `catch` \(_ :: IOError) -> return ()
>>> +   removeFile (repodir </> darcsdir </> noPatchIndex) `catch` \(_ 
>> :: IOError) -> return ()
>>
>> Fine. Might be nice to make the catch more limited than any IOError, 
>> or to check for problems up-front.
> 
> Checking for problematic conditions up front is prone to race
> conditions. This is why it is generally recommended to just run the
> action and catch errors. We could print a warning to stderr, though,
> instead of completely ignoring the error.
> 
> Do you have a suggestion to what kind of IO errors to limit the catch?

Yes, good point re races. Given my subsequent discovery about
isPermissionError on Windows I can't suggest anything with confidence.
Printing to stderr sounds good.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1749>
__________________________________


More information about the darcs-devel mailing list