You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Artem Egorkine <ar...@gmail.com> on 2006/07/05 15:31:40 UTC

[PATCH] Better workaround for systems with broken readdir

Hi,

I can now confirm that readdir() of FreeBSD-6.1RC is broken just like
that of MacOS X, see
http://subversion.tigris.org/issues/show_bug.cgi?id=1896 for more
discussion.

Forcefuly applying the MacOS workaround as described in that issue
fixes the problem on FreeBSD. The problem with the workaround is that
a call to rewinddir() after deleting every file makes
svn_io_remove_dir() quite slow.

As I proposed in http://svn.haxx.se/dev/archive-2006-06/0694.shtml
thread, here is in my oppinion a better solution:

  1. readdir()
 2. if there's nothing to delete, we're done
 3. delete everything
  4. rewinddir()
  5. goto 1

Please find a patch attached that does exactly that. It is
unconditional of MacOS or FreeBSD. The overhead on an OS without the
bug is one rewinddir() and two readdir()s, which is not much. The
benefit, however, is that we'll never have to face the problem ever
again even when we encounter other systems that a similar problem is
found on.

[[[
Rewind directory after something has been deleted from it to work around
operating systems with broken readdir that may skip files in such
circumstances.

* subversion/libsvn_subr/io.c
  (svn_io_remove_dir): Rewind directory after something has been deleted.
]]]

Regards,
  Artem Egorkine

Re: [PATCH] Better workaround for systems with broken readdir

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 7/5/06, Artem Egorkine <ar...@gmail.com> wrote:
> Hi,
>
> I can now confirm that readdir() of FreeBSD-6.1RC is broken just like
> that of MacOS X, see
> http://subversion.tigris.org/issues/show_bug.cgi?id=1896 for more
> discussion.
>
> Forcefuly applying the MacOS workaround as described in that issue
> fixes the problem on FreeBSD. The problem with the workaround is that
> a call to rewinddir() after deleting every file makes
> svn_io_remove_dir() quite slow.
>
> As I proposed in http://svn.haxx.se/dev/archive-2006-06/0694.shtml
> thread, here is in my oppinion a better solution:
>
>   1. readdir()
>  2. if there's nothing to delete, we're done
>  3. delete everything
>   4. rewinddir()
>   5. goto 1
>
> Please find a patch attached that does exactly that. It is
> unconditional of MacOS or FreeBSD. The overhead on an OS without the
> bug is one rewinddir() and two readdir()s, which is not much. The
> benefit, however, is that we'll never have to face the problem ever
> again even when we encounter other systems that a similar problem is
> found on.

This seems fine to me, committed in r20459, with a few formatting tweaks.

Thanks!

-garrett

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