apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garrett Rooney <roo...@electricjellyfish.net>
Subject Re: Bug in Mac OS X readdir
Date Mon, 10 May 2004 14:09:43 GMT
rbb@rkbloom.net wrote:
> There is a bug in the Mac OS X readdir implementation that is breaking
> subversion in some situations.  I don't have easy access to a box that I
> can use to re-create and fix this bug.  But, this is definately something
> APR should work-around.

For the curious, the problem is that for directories with more than a 
certain number of files in them (338 apparently) if you remove an entry 
in the directory subsequent calls to readdir do not show you all the 
entries, so if you're implementing something like 'rm -rf' by calling 
readdir in a loop and removing files as you go you end up getting errors 
about the directory you're removing not being empty.

The work around is to call rewinddir after removing each entry from the 
directory.  Unfortunately, I'm not sure if it's possible to put this 
work around into APR, I mean how are we supposed to know if it's 
necessary to call rewinddir or not?

In Subversion's case this bug comes up in our svn_io_remove_dir 
function, which is essentially just an 'rm -rf', and we can add the work 
around there because when we remove a file or directory we have access 
to the parent directory, but in the general case in APR you don't have 
access to it, so the work around is impossible.

-garrett

Mime
View raw message