After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 323016 - Add gnome_vfs_uri_resolve_symbolic_link API
Add gnome_vfs_uri_resolve_symbolic_link API
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: URI handling
2.15.x
Other All
: Urgent critical
: 2.16
Assigned To: Christian Neumair
gnome-vfs maintainers
: 323791 326352 336684 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-12-02 13:40 UTC by mannheim89
Modified: 2006-07-16 09:18 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Proposed prelimitary patch (914 bytes, patch)
2006-02-22 15:07 UTC, Christian Neumair
committed Details | Review
Proposed gnome_vfs_uri_resolve_symbolic_link implementation (5.68 KB, patch)
2006-07-15 17:04 UTC, Christian Neumair
none Details | Review
resolve_symbolic_link implementation proposal #2 (5.96 KB, patch)
2006-07-15 17:26 UTC, Christian Neumair
none Details | Review
final resolve_symbolic_link implementation (5.97 KB, patch)
2006-07-16 09:17 UTC, Christian Neumair
committed Details | Review

Description mannheim89 2005-12-02 13:40:07 UTC
Steps to reproduce:
1. Create a symlink in your home directory as follows:
      cd
      ln -s "1234:5678" funnylink
2. Open your home directory in Nautilus, in either icon or list view.
3. Select the (broken) symbolic link "funnylink" by a single left click.
4. After a short pause, Nautilus "unexpectedly quits".


Stack trace:


Other information:
A symbolic link containing a colon arises in the wild, because firefox and other
mozilla browsers use such a symlink, called "lock", in the user's profile
directory, to place a lock on the profile. The contents of this lock symlink is
the text ${MACHINE_IP}:${FIREFOX_PID} -- e.g. "127.0.0.1:4567". So this crash
can occur if a user tries to use Nautilus to delete the lock file.

The crash does not occur if the symlink contains, for example, "1234" without
the colon. The crash also does not occur if there really is a file ./"1234:5678"
so that the link is no longer broken: create such a file with "touch" in the
same directory as "funnylink", and repeat steps 2,3 above, and the crash does
not occur.
Comment 1 mannheim89 2005-12-02 14:27:52 UTC
Backtrace was generated from '/usr/bin/nautilus'

(no debugging symbols found)
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(no debugging symbols found)
`system-supplied DSO at 0xffffe000' has disappeared; keeping its
symbols.
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1225996608 (LWP 19504)]
[New Thread -1236538448 (LWP 20781)]
[New Thread -1236272208 (LWP 20780)]
[New Thread -1234826320 (LWP 20779)]
[New Thread -1233454160 (LWP 19506)]
[New Thread -1227543632 (LWP 19505)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0xffffe410 in __kernel_vsyscall ()

Thread 1 (Thread -1225996608 (LWP 19504))

  • #0 __kernel_vsyscall
  • #1 __waitpid_nocancel
    from /lib/tls/i686/cmov/libpthread.so.0
  • #2 libgnomeui_module_info_get
    from /usr/lib/libgnomeui-2.so.0
  • #3 <signal handler called>
  • #4 _gnome_vfs_uri_resolve_all_symlinks_uri
    from /usr/lib/libgnomevfs-2.so.0
  • #5 gnome_vfs_find_directory_cancellable
    from /usr/lib/libgnomevfs-2.so.0
  • #6 gnome_vfs_find_directory
    from /usr/lib/libgnomevfs-2.so.0
  • #7 eel_uri_is_trash_folder
    from /usr/lib/libeel-2.so.2
  • #8 nautilus_file_can_rename
    from /usr/lib/libnautilus-private.so.2
  • #9 fm_directory_view_get_ui_manager
  • #10 fm_directory_view_handle_text_drop
  • #11 fm_list_view_get_type
  • #12 fm_directory_view_update_menus
  • #13 fm_directory_view_freeze_updates
  • #14 g_main_context_wakeup
    from /usr/lib/libglib-2.0.so.0
  • #15 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #16 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #17 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #18 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #19 main
  • #0 __kernel_vsyscall

Comment 2 Teppo Turtiainen 2005-12-02 18:21:44 UTC
Confirmed with nautilus 2.12.1 on Ubuntu Breezy.
Comment 3 mannheim89 2005-12-03 17:46:59 UTC
Another example might shed light. 

1. If the broken symlink contains the text "file:///home/user/nosuchfile", then
there is no crash.

2. If the broken symlink contains the text "fils:///home/usr/nosuchfile", then
there is a crash. (Note, I changed "file" to "fils" here.)

So perhaps, when the symlink does not contain the ordinary unix path of an
existing file, Nautilus tries to interpret the character string as a URI if it
looks plausible; and then crashes if the URI begins with something non-standard.

Just guessing, though. I haven't looked at the source (don't feel able).
Comment 4 Martin Wehner 2005-12-10 14:50:40 UTC
Yep, 100% reproducable. Reassigning to gnome-vfs.

Backtrace was generated from '/opt/gnome-2.14/bin/nautilus'

Using host libthread_db library "/lib/libthread_db.so.1".
`shared object read from target memory' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1208661536 (LWP 3902)]
[New Thread -1210786896 (LWP 3903)]
0x00508402 in __kernel_vsyscall ()
  • #0 __kernel_vsyscall
  • #1 __waitpid_nocancel
    from /lib/libpthread.so.0
  • #2 libgnomeui_segv_handle
    at gnome-ui-init.c line 786
  • #3 <signal handler called>
  • #4 _gnome_vfs_uri_resolve_all_symlinks_uri
    at gnome-vfs-utils.c line 2017
  • #5 gnome_vfs_find_directory_cancellable
    at gnome-vfs-cancellable-ops.c line 307
  • #6 gnome_vfs_find_directory
    at gnome-vfs-find-directory.c line 63
  • #7 eel_uri_is_trash_folder
    at eel-vfs-extensions.c line 563
  • #8 nautilus_file_can_rename
    at nautilus-file.c line 905
  • #9 can_rename_file
    at fm-directory-view.c line 3643
  • #10 fm_icon_view_can_rename_file
    at fm-icon-view.c line 1382
  • #11 fm_directory_view_can_rename_file
    at fm-directory-view.c line 3113
  • #12 real_update_menus
    at fm-directory-view.c line 6969
  • #13 fm_icon_view_update_menus
    at fm-icon-view.c line 1539
  • #14 fm_directory_view_update_menus
    at fm-directory-view.c line 8502
  • #15 update_menus_timeout_callback
    at fm-directory-view.c line 2615
  • #16 g_timeout_dispatch
    at gmain.c line 3257
  • #17 IA__g_main_context_dispatch
    at gmain.c line 1913
  • #18 g_main_context_iterate
    at gmain.c line 2544
  • #19 IA__g_main_loop_run
    at gmain.c line 2748
  • #20 IA__gtk_main
    at gtkmain.c line 991
  • #21 main
    at nautilus-main.c line 435

Comment 5 Christian Neumair 2005-12-10 15:17:30 UTC
Looks like the recent change to use gnome_vfs_uri_append_string makes GnomeVFS
interpret the contents of the appended string as URI, i.e. it tries to do URI
chaining.
Comment 6 Christian Kirbach 2005-12-15 10:33:12 UTC
*** Bug 323791 has been marked as a duplicate of this bug. ***
Comment 7 Christian Kirbach 2005-12-15 10:35:32 UTC
I have just seen this as well. Gnome 2.12.3cvs

there is a broken link that I selected in Nautilus. I wonder why it was shown in 
the first place.

lrwxrwxrwx  1 nazgul nazgul        15 2005-05-26 16:37 st -> ST: Enterprise/

Then it crashed in gnome-vfs. After restart Nautilus does *not* display the
broken link.

So, it is most likely the colon in the name.
Comment 8 Baybal Ni 2005-12-16 04:16:18 UTC
All gvfs based programs crashes with similar errorz(gtk file chooser...)
Comment 9 Sebastien Bacher 2006-01-09 23:31:27 UTC
*** Bug 326352 has been marked as a duplicate of this bug. ***
Comment 10 Christian Kirbach 2006-01-21 02:31:07 UTC
I cannot reproduce this any more with latest 2.13cvs and 2.12.3

Teppo, Martin: can you confirm that as well?
Comment 11 Martin Wehner 2006-01-21 13:14:46 UTC
Still crashes for me on HEAD.
Comment 12 Christian Kirbach 2006-01-23 00:44:54 UTC
Martin can you please tell the steps you performed to cause a crash?
Comment 13 Martin Wehner 2006-02-21 20:57:22 UTC
1. ln -s "1234:5678" funnylink
2. click funnylink
Comment 14 Christian Neumair 2006-02-22 15:07:46 UTC
Created attachment 59933 [details] [review]
Proposed prelimitary patch

gnome_vfs_uri_resolve_relative seems to interpret the ":" as a hint that this is an absolute URI. RFC 2396 claims that

This "generic URI" syntax consists of a sequence of four main components:

      <scheme>://<authority><path>?<query>

   each of which, except <scheme>, may be absent from a particular URI.
   For example, some URI schemes do not allow an <authority> component,
   and others do not use a <query> component.

So this seems to be wrong. I'm not sure how else we're meant to discover URIs, since our GnomeVFS URIs *always* have a scheme. Maybe we should also escape the culprit characters from the symlink name.

The attached patch at least tries to abort when gnome_vfs_uri_resolve_relative returns NULL and return what we have up to this point. I'm not sure whether setting an error is the right thing to do, but when we have multiple subsequent resolution the returned URI might not be that bad after all.
Comment 15 Alexander Larsson 2006-03-03 09:26:57 UTC
I'm commiting Christians patch to avoid crashes in 2.14. However, I'm keeping this bug open because we're still doing the wrong thing here. We really shouldn't be using gnome_vfs_uri_resolve_relative, as its never right to treat the symlink value as a uri. Implementing a resolve_symlink() call should be very easy, but lets do that in the next cycle.
Comment 16 Karsten Bräckelmann 2006-03-31 03:54:51 UTC
*** Bug 336684 has been marked as a duplicate of this bug. ***
Comment 17 Christian Neumair 2006-07-15 17:04:54 UTC
Created attachment 68969 [details] [review]
Proposed gnome_vfs_uri_resolve_symbolic_link implementation

The attached patch adds public API for resolving symlinks and updates the docs accordingly.
Comment 18 Christian Kellner 2006-07-15 17:25:21 UTC
Despite the missing Since: line it looks good to me.
Comment 19 Christian Neumair 2006-07-15 17:26:28 UTC
Created attachment 68970 [details] [review]
resolve_symbolic_link implementation proposal #2

This one also contains the "Since: 2.16" note in the docs and makes the private helper robust against NULL paths. Thanks to Christian Kellner for pointing this out.
Comment 20 Christian Neumair 2006-07-15 17:27:27 UTC
Updating version.
Comment 21 Christian Neumair 2006-07-16 09:17:52 UTC
Created attachment 68987 [details] [review]
final resolve_symbolic_link implementation

I've committed the attached patch which has slightly different semantics to the last one:

The resolve_symlink helper expects non-NULL arguments (and asserts them), and we make sure that it isn't called with NULL.