Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeDirectoryRecursive can throw an exception if a file vanishes before it removes it #60

Closed
joeyh opened this issue Oct 18, 2016 · 2 comments
Assignees
Labels
type: a-bug The described behavior is not working as intended.
Milestone

Comments

@joeyh
Copy link

joeyh commented Oct 18, 2016

> removeDirectoryRecursive "/tmp/d"
Exception: /tmp/d/zzzzz: removeDirectoryRecursive: does not exist (No such file or directory)

Here /tmp/d/ contained a directory foo (with many subdirectories so it took some time to delete), and a subsequent file zzzzzz. Immediately after pressing enter in ghci, I launched a rm zzzzzz. So getDirectoryContents included the file, but it was gone by the time removeFile ran.

I feel that this is a surprising failure mode, and one that would be very easy to recover from, making uses of removeDirectoryRecursive more robust. If removeFile throws an exception due to the file no longer existing, removeDirectoryRecursive could continue with removing the rest of the directory and not propagate the exception.

(Testing rm -rf (on linux) in similar circumstances, I found that it skips over files that have already been deleted by something else, rather than failing.)

Rufflewind added a commit to Rufflewind/directory that referenced this issue Oct 19, 2016
@Rufflewind
Copy link
Member

Rufflewind commented Oct 19, 2016

See if this fixes your issue: Rufflewind@491b9cc

@Rufflewind Rufflewind added the type: a-bug The described behavior is not working as intended. label Oct 19, 2016
@Rufflewind Rufflewind self-assigned this Oct 19, 2016
@Rufflewind Rufflewind added this to the 1.2.7.1 milestone Oct 19, 2016
Rufflewind added a commit to Rufflewind/directory that referenced this issue Oct 19, 2016
Rufflewind added a commit to Rufflewind/directory that referenced this issue Oct 19, 2016
Rufflewind added a commit to Rufflewind/directory that referenced this issue Oct 19, 2016
@Rufflewind
Copy link
Member

Rufflewind commented Nov 1, 2016

This should be fixed by 1a5edff .

Feel free to re-open the issue if you still encounter problems. Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: a-bug The described behavior is not working as intended.
Projects
None yet
Development

No branches or pull requests

2 participants