Subject: bug#24714: delete-directory race condition

From: Glenn Morris <[email-masked]>
Date: Tue, 18 Oct 2016 12:50:32 -0400

Andreas Schwab wrote:

> That is ok.  The operation cannot successfully be completed in this case.
>
>> Frankly I don't see how Emacs's delete-directory can work reliably as
>> currently implemented.
>
> A property it shares with any other operation recursing on directories,
> in Emacs or elsewhere.

That's interesting. I'd assumed there was a "Right Way" to do it, and
that it would be whatever coreutil's rm did. If not then we are back to:

> delete-directory should simply catch ENOENT errors and ignore them
> when it deletes files and subdirectories under the "recursive" option.
> Other errors should signal an error as they do now.

This doesn't seem possible without changes at the C level.
Should there be a standard Lisp error for ENOENT?
Currently report_file_errno only does EEXIST -> file_already_exists.

Or should delete-file get a FORCE argument akin to "rm -f"?