Subject: Re: bug#24714: delete-directory race condition

From: Eli Zaretskii <[email-masked]>
Date: Mon, 17 Oct 2016 09:19:34 +0300

> From: Glenn Morris <[email-masked]>
> Date: Sun, 16 Oct 2016 22:20:45 -0400
> 
> I believe this is due to a race condition in delete-directory.
> Emacs seems to be lacking an equivalent of "rm -rf".
> 
> (delete-directory "/tmp/foo")
> 
> will fail with "No such file or directory" if a file in /tmp/foo
> happen to be deleted by some other process in between the time that
> delete-directory calls directory-files and the time it calls delete-file.

IMO, 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.