Doing unlink() during readdir() on FreeBSD makes it skip some directory entries: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=57696
Easily reproducible with
$ mkdir foo && touch foo/{1..256}
$ bfs foo -delete
bfs: error: foo: Directory not empty.
$ bfs foo -delete
$
However, find, rm, etc. seem to work around it. truss indicates that they fully read the directory before starting to remove files. That means we have some workarounds:
$ mkdir foo && touch foo/{1..256}
$ ./bfs -S dfs foo -delete
$ mkdir foo && touch foo/{1..256}
$ ./bfs -s foo -delete
$
But it would be nice if plain bfs worked too.
Doing
unlink()duringreaddir()on FreeBSD makes it skip some directory entries: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=57696Easily reproducible with
$ mkdir foo && touch foo/{1..256} $ bfs foo -delete bfs: error: foo: Directory not empty. $ bfs foo -delete $However,
find,rm, etc. seem to work around it.trussindicates that they fully read the directory before starting to remove files. That means we have some workarounds:But it would be nice if plain
bfsworked too.