Re: [boost] Some Boost.Filesystem problems

At 04:42 PM 12/12/2004, Ben Hutchings wrote:
I noticed that Boost.Filesystem doesn't use readdir_r to iterate over directories, even if it is available, making that non-thread-safe. There is a comment to this effect in operations_posix_windows.cpp.
I've attached a patch that I believe will allow it to detect whether readdir_r is available and to use it iff it is. I have only tested this on Linux with g++ 3.3, but I tried deliberately breaking the declaration of readdir_r and verified that the code continues to work without it.
Interesting approach! I guess the alternative is hand configuration, and that isn't very attractive. So let me take a look at your patch in detail and get back to you.
On a visual inspection some time back I also noted that there's no special handling for empty root directories on Windows. The problem with these is that while even an empty directory normally has entries for "." and "..", so that FindFirstFile can return something, root directories on FAT volumes (and I think NTFS as well) do not have these and Windows doesn't fake them, so FindFirstFile on an empty root returns INVALID_HANDLE_VALUE. Note that this only applies to real root directories, not to the roots of drives that are mapped to sub-directories using subst or file sharing. I never got round to checking whether the Boost code actually handles this or not, as I only use Windows at work and we don't use Boost.Filesystem there. Perhaps someone could check that out?
I've got some code that should serve to check that out. I'll let you know.
Unfortunately it's impractical to test automatically, as empty volumes are hard to generate on demand!
That's one of the difficulties of the library; there are quite a few test cases which are difficult and/or expensive to create on demand for testing. Thanks for you help, --Beman
participants (1)
-
Beman Dawes