GNOME Bugzilla – Bug 519743
Nautilus crashes on weird GFileInfos
Last modified: 2017-08-29 05:40:32 UTC
(Sorry for being somewhat vague in the bug report, but I only just remembered it.) While hacking on symlink support for gvfs-ftp, I noticed that Nautilus crashes when G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET is set on a GFileInfo, but G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK is not, I think it was asserting nautilus_file_is_symlink() and failing. Either this is a bug in Nautilus, which shouldn't crash or in the GFileInfo documentation, which should tell you that specific attributes must only appear in pairs.
Created attachment 111396 [details] [review] nautilus-filetype-symlink-fix.patch Additional check to accept not completely valid file info. Another way would be to always check and set G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK flag when setting G_FILE_ATTRIBUTE_STANDARD_TYPE attribute with value G_FILE_TYPE_SYMBOLIC_LINK, however as long as we can set GFileInfo attributes directly, several tests on different places would be needed.
The whole symlink handling code is a big strange in places, most particularly we're seeing crashes like the following in Ubuntu (currently private lp bug 227145, SSH backend related):
+ Trace 198802
This crash is especially bizarre considering the code path through update_info_internal to modify_link_hash_table to nautilus_file_get_symbolic_link_target_uri which finally causes us to crash. There's an easy hack to avoid the crash here (return from the modify_link_hashtable call if we get a NULL from nautilus_file_get_symbolic_link_target_uri(), yet the nautilus_file_is_symbolic_link(file) returns TRUE, but this would be a really dirty hack considering the bad state was propagated this far into this section of the code. And we really need to throw in some better error checking through this entire path so that it will at least not crash and complain loudly on bad GFileInfos.
I guess this is still an issue. Can we get that patch reviewed?
*** Bug 559548 has been marked as a duplicate of this bug. ***
Please note, the duplicate bug has a different structure coming from an older Nautilus, but presumably the same cause; somehow we're inserting a bad symlink into the hash table. Apparently this issue predates the GIO transition, though.
Would this be obsolete then?
Reopening as I don't see any open non-developer issue. I guess this is OBSOLETE though. So if a nautilus maintainer could jump in and comment on that, it'd be nice.
Mass component change due to BZ cleanup, sorry for the noise.
What's the easiest way to reproduce this?
As this is a bug about the protocol spoken by gio, I suppose it requires writing or modifying source code to trigger. You could for example remove the line that calls g_file_info_set_is_symlink() - say at http://git.gnome.org/browse/gvfs/tree/daemon/gvfsftpdircache.c#n667 and then use that.
I'm not sure this is longer the case, can anyone reproduce?
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you are still able to reproduce. Thanks!