arx-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Arx-users] Fwd: Errors in the mirror command ? (Segmentation errors


From: Walter Landry
Subject: Re: [Arx-users] Fwd: Errors in the mirror command ? (Segmentation errors too)
Date: Tue, 18 Jan 2005 22:57:44 -0500 (EST)

Marc Recht <address@hidden> wrote:
> > Hmm.  Looking through the code for gnome-vfs and boost, the only real
> > difference is that gnome-vfs uses POSIX "unlink" and "rmdir", while
> > boost uses Ansi C "remove".  So I tried replacing the call to "remove"
> 
> gnome-vfs also uses thread-safe functions (eg. readdir_r).

Aha!  That is the hint I needed.  The problem is that boost reads
directories and deletes entries along the way.  If it finds a
directory, it immediately recurses into that directory.  However,
boost uses readdir, which on some platforms (including OS X,
apparently) uses a static data area that can be overwritten on each
call to readdir.  This messes up the original directory iteration,
ending up with some entries not being deleted.

The solution is to not immediately recurse, but to first read all of
the entries and put subdirectories into a list.  Once that is done,
then recurse.  I have implemented it in boost.1.32,5, and both "get"
and "merge" work on OS X with fink.

I had already implemented something like this for gvfs::remove_all,
which is why replacing that call worked.  The unlink/rmdir/remove
stuff was just a red herring.

Thanks,
Walter






reply via email to

[Prev in Thread] Current Thread [Next in Thread]