Re: Should find_directory() canonicalize all symlinks?



On Thu, 2005-07-07 at 20:38 -0500, Federico Mena Quintero wrote:
> Hi,
> 
> I'm debugging an interesting problem in Nautilus (please bear with me; I
> think the problem is in gnome-vfs).  The summary is this:
> 
> 1. You mount a network volume under /foo/mountpoint.  Once mounted, you
> don't have write permission to /foo/mountpoint, but you have permission
> under /foo/mountpoint/subdir.
> 
> 2. Create a symlink from /foo/mountpoint to /home/federico/shortcut
> 
> 3. Tell Nautilus to visit /home/federico/shortcut/subdir.  Select a file
> inside there, and move it to the trash.  Nautilus does nothing.
> 
> 4. Now, tell Nautilus to visit /foo/mountpoint/subdir directly instead
> of going through the symlink.  Try to move a file inside there to the
> trash.  Nautilus tells you that it can't move the file to the trash, and
> would you like to delete it permanently.  If you tell it to do that, the
> file gets deleted permanently.
> 
> Different things happen for cases 3 and 4 when I'm right here:
> 
> trash_callback
>   trash_or_delete_selected_files
>     trash_or_delete_files
>         trash_or_delete_files_common
>           can_move_uri_to_trash
>             gnome_vfs_find_directory
>               gnome_vfs_find_directory_cancellable (
>                  near_uri="file:///home/federico/shortcut/subdir",
>                  GNOME_VFS_DIRECTORY_KIND_TRASH)
> 
> In case 3, can_move_uri_to_trash() returns TRUE because it tries to use
> my ~/.Trash, and succeeds.
>
> In case 4, can_move_uri_to_trash() returns FALSE because
> gnome_vfs_find_directory_cancellable() gets
> near_uri="/foo/mountpoint/subdir".  It finds the root directory of that
> volume in file-method.c:find_disk_top_directory(), which
> is /foo/mountpoint.  Then it tries to
> create /foo/mountpoint/.Trash-federico and fails because I don't have
> write permission there.
> 
> Looking at gnome_vfs_find_directory_cancellable(), I saw that it does
> nothing to near_uri if it is non-NULL.  If near_uri is NULL, however,
> the function takes your home directory and canonicalizes all symlinks to
> it.
> 
> My question is:  why doesn't gnome_vfs_find_directory_cancellable()
> canonicalize the near_uri unconditionally?  It would take care of my
> trash problem, and it looks like the right thing to do in general.

Yes, that sounds right. In fact, the canonicalization was introduced to
fix a problem like this that garret had, because his home directory was
a symlink.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a superhumanly strong Amish werewolf who knows the secret of the alien 
invasion. She's a radical insomniac research scientist who dreams of becoming 
Elvis. They fight crime! 




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