You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by rb...@rkbloom.net on 2004/05/09 14:11:34 UTC

Bug in Mac OS X readdir

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.

Ryan

---------- Forwarded message ----------
Date: Sun, 9 May 2004 07:45:47 -0400
From: Josh Pieper <jj...@pobox.com>
To: Garrett Rooney <ro...@electricjellyfish.net>
Cc: C.A.T.Magic <c....@gmx.at>,
     Subversion Devel List <de...@subversion.tigris.org>
Subject: Re: [libsvn_fs_fs] 'Directory not empty' error when removing
    committed txn

Josh Pieper wrote:
> Garrett Rooney wrote:
> > No, this is on Mac OS X.  And on windows the error we get back is about
> > access denied, not about the directory not being empty.
>
> Do you think it could a symptom of the problem described here?
>
> http://www.mail-archive.com/bug-fileutils@gnu.org/msg02337.html

And now that I look a little harder, this exact same problem has been
seen in subversion before.

http://www.contactor.se/~dast/svn/archive-2003-04/0770.shtml

I think APR may need to have a workaround for OS X in order to handle
this buggy readdir implementation.

-Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org



Re: Bug in Mac OS X readdir

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
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