BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.21k stars 106 forks source link

contents_first(false) still calls readdir before emitting the parent directory #168

Open UhhhWaitWhat opened 1 year ago

UhhhWaitWhat commented 1 year ago

I tried to implement a recursive chmod using walkdir (linux only). Sadly, the parent directory seems to be emitted by the iterator AFTER the call to readdir was done. This means that, if the parent directory originally has no read/execute permissions, the walker does not descend further, even though it could after I changed the parents permissions.

I'm not sure I would classify this as a bug, but I just wasted about 30 minutes trying to figure out why my code doesn't work, so a line of documentation specifying this behaviour might be useful.

BurntSushi commented 1 year ago

I think I would probably classify this as a bug? In particular, it seems like your use case would be a good one to support.

Fixing this might be a bit gnarly though.