Re: Folders become inaccessible after browsing remote locations like ftp, smb



On Thu, 2005-03-31 at 21:12 +0530, dinoop thomas wrote:
> Hi,
> 
> I come across a bug in nautilus bookmarks code while browsing through 
> remote locations like ftp, smb etc. Once the problem is seen, user will 
> not be able to rename or open folders. Please refer to bug:  
> http://bugzilla.gnome.org/show_bug.cgi?id=170761 for more details.
> 
> After evaluating,  its found that the problem occurs due to the 
> following code in nautilus-bookmark.c:nautilus_bookmark_connect_file()
> 
> if (!nautilus_bookmark_uri_known_not_to_exist (bookmark)) {
>   bookmark->details->file = nautilus_file_get (bookmark->details->uri);
>   g_assert (!nautilus_file_is_gone (bookmark->details->file));
>   g_signal_connect_object (bookmark->details->file, "changed",
>                            G_CALLBACK (bookmark_file_changed_callback), bookmark, 0);
> }
> 
> For a local file,  before updating the bookmark->details->file  field, 
> we check whether the file actually exists by calling  
> nautilus_bookmark_uri_known_not_to_exist() function . If the file is 
> deleted from trash, its bookmark will be disconnected.
> 
> But for a non local file ,  the function always returns false. So even 
> if file is removed permanently, the above code gets executed and file 
> gets recreated for a non existing URI and bookmark file field will be 
> updated. Since the file itself does not exist, nautilus will try to get 
> its information, causing an infinite loop to occur.
> 
> I am not sure how to find that a non local file is really gone and 
> disconnect its bookmark.
> 
> Tried replacing nautilus_file_get in the above code with 
> nautilus_file_get_existing, which will make sure that file is not 
> recreated for a non existing URI. It solved the bug. Is it right way to 
> fix it ? If so, I can upload a patch to bugzilla.
> 
> Kindly give your valuable advice.

I don't think the bug is in nautilus_bookmark_connect_file(). Whats
really causing the loop is the nautilus_bookmark_connect_file() call in:
	if (nautilus_file_is_gone (file)) {
		/* The file we were monitoring has been deleted,
		 * or moved in a way that we didn't notice. Make 
		 * a spanking new NautilusFile object for this 
		 * location so if a new file appears in this place 
		 * we will notice.
		 */
		nautilus_bookmark_disconnect_file (bookmark);
		nautilus_bookmark_connect_file (bookmark);
		should_emit_appearance_changed_signal = TRUE;		
        }

Does removing that call fix the problem? Then we'll cut the loop, but
we'll still re-read the information the next time someone calls e.g.
nautilus_bookmark_get_icon().

(Your patch is wrong btw. nautilus_file_get_existing() only checks for
existance of an in-memory NautilusFile object.)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a lounge-singing dishevelled waffle chef trapped in a world he never 
made. She's a strong-willed tomboy angel with the soul of a mighty warrior. 
They fight crime! 




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