Re: Fragile GnomeVFSXfer copying code - suggestions?



Am Donnerstag, den 20.04.2006, 17:09 +0200 schrieb Alexander Larsson:
> On Fri, 2006-03-24 at 11:14 +0100, Christian Neumair wrote:
> > I've found the current Xfer code to be very fragile when copying, and
> > doing an overwrite.
> > 
> > When you move a directory, and force to overwrite an existing one, the
> > directory is removed before the move process begins, i.e. it is really
> > replaced.
> > 
> > When copying, the Xfer code however tries to merge the old directory
> > entries with the new ones, overwriting only conflicting ones.
> > 
> > The current code checks for conflicts using
> > gnome_vfs_directory_visit_uri (invoked from
> > handle_merged_directory_name_conflicts), which visits the directory
> > non-recursively (cf. gnome-vfs-directory.c:directory_visit_internal,
> > recursive is always FALSE). Whenever it encounters two directories, it
> > does not bail on conflict, the code obviously originally was meant to
> > merge the whole old with the whole new hierarchy recursively.
> > 
> > So when you had a directory like
> > 
> > /target/foo/bar
> > 
> > and copy from a directory like
> > 
> > /source/foo/bar
> 
> Are you sure this is what happens?
> handle_merged_directory_name_conflicts calls
> gnome_vfs_directory_visit_uri() with handle_merged_name_conflict_visit
> as callback, and that sets *recurse to true unless that would cause a
> loop, so it should be doing a recursive visit.

Yes, you are right. The general weakness of the current code is that it
completely visits the source directories during preflight, but doesn't
handle errors properly that occur during the transfer. I wonder why we
don't shift the whole conflict handling to the transfer.

I also don't think the current code consistently puts forward a clear
idea of GNOME_VFS_XFER_USE_UNIQUE_NAMES.
For instance, overwrite_mode is expected to be
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY in copy_items as a prerequisite for
a duplication query of the progress callback.

-- 
Christian Neumair <chris gnome-de org>




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