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 153679 - sftp symlink support is broken
sftp symlink support is broken
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: ssh/sftp
2.15.x
Other Linux
: High critical
: ---
Assigned To: Christian Neumair
gnome-vfs maintainers
: 153066 166799 167224 168798 300455 301546 302402 308585 310632 312711 313115 318983 325028 332763 336618 (view as bug list)
Depends on:
Blocks: 334888
 
 
Reported: 2004-09-24 22:09 UTC by Sebastien Bacher
Modified: 2006-06-20 16:34 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Proposed patch (against HEAD). (3.12 KB, patch)
2005-05-10 12:07 UTC, Christian Neumair
needs-work Details | Review
Proposed patch (27.93 KB, patch)
2006-03-17 21:10 UTC, Christian Neumair
reviewed Details | Review

Description Sebastien Bacher 2004-09-24 22:09:35 UTC
Something is wrong with symlinks in sftp://:

* cd /tmp
* mkdir test
* ln -s test link-test
* $ gnomevfs-ls file:///tmp | grep link-test
link-test        [link: /tmp/test ]     (Directory, x-directory/normal) size
4096       mode 2755
$ gnomevfs-ls sftp://localhost/tmp | grep link-test
link-test        [link: (null) ]        (Symbolic Link, x-special/symlink)     
size 4  mode 120755

Apparently the first result is fine, the second is not.

As a result with nautilus the symlink is display as default file icon instead of
a folder one.
It breaks also the new gtk fileselector which return an error when you try to
follow the link.

(This is with gnome-vfs 2.8.1)
Comment 1 Christophe Fergeau 2004-09-24 22:20:42 UTC
The fact that [link: (null)] is really bad: this means the symlink_name isn't
set in GnomeVFSFileInfo, and this causes crash in gnome-vfs-xfer.c when trying
to copy a directory containing a symlink because it doesn't expect this field to
be NULL on a symlink.
Comment 2 Martin Wehner 2005-03-01 00:44:27 UTC
*** Bug 166799 has been marked as a duplicate of this bug. ***
Comment 3 Martin Wehner 2005-03-01 00:46:32 UTC
Here are the juicy bits of the resulting crash (easy to reproduce if you copy a
directory with symlinks in it from an sftp mount):

  • #3 <signal handler called>
  • #4 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #5 raise
    from /lib/tls/libc.so.6
  • #6 abort
    from /lib/tls/libc.so.6
  • #7 IA__g_logv
  • #8 IA__g_log
  • #9 IA__g_assert_warning
    at gmessages.c line 547
  • #10 do_create_symbolic_link
    at file-method.c line 1936
  • #11 gnome_vfs_create_symbolic_link_cancellable
    at gnome-vfs-cancellable-ops.c line 368
  • #12 gnome_vfs_create_symbolic_link
    at gnome-vfs-ops.c line 516
  • #13 copy_symlink
    at gnome-vfs-xfer.c line 1403
  • #14 copy_directory
    at gnome-vfs-xfer.c line 1652
  • #15 copy_items
    at gnome-vfs-xfer.c line 1795
  • #16 gnome_vfs_xfer_uri_internal
    at gnome-vfs-xfer.c line 2528
  • #17 _gnome_vfs_xfer_private
    at gnome-vfs-xfer.c line 2614
  • #18 _gnome_vfs_job_execute
    at gnome-vfs-job.c line 1552
  • #19 thread_routine
    at gnome-vfs-job-slave.c line 64
  • #20 thread_entry
    at gnome-vfs-thread-pool.c line 186
  • #21 g_thread_create_proxy
    at gthread.c line 561
  • #22 start_thread
    from /lib/tls/libpthread.so.0
  • #23 clone
    from /lib/tls/libc.so.6

Comment 4 Martin Wehner 2005-03-01 01:03:54 UTC
The sftp method never executes SSH2_FXP_READLINK and so doesn't set
symlink_name. Instead it does SSH2_FXP_REALPATH in do_get_file_info() when
FOLLOW_LINKS is set, which doesn't look right to me either.
Comment 5 Martin Wehner 2005-03-01 01:45:01 UTC
*** Bug 167224 has been marked as a duplicate of this bug. ***
Comment 6 Martin Wehner 2005-03-01 01:59:44 UTC
*** Bug 168798 has been marked as a duplicate of this bug. ***
Comment 7 Christian Kirbach 2005-03-01 11:32:42 UTC
Thanks for tracking it down to symlinks, Sebastien and thanks Martin for 
detecting the duplicate.
I was just about to look into it.
Comment 8 Christian Neumair 2005-05-09 18:13:56 UTC
*** Bug 300455 has been marked as a duplicate of this bug. ***
Comment 9 Christian Neumair 2005-05-09 19:34:44 UTC
*** Bug 153066 has been marked as a duplicate of this bug. ***
Comment 10 Christian Neumair 2005-05-10 12:07:06 UTC
Created attachment 46283 [details] [review]
Proposed patch (against HEAD).

This patch should at least improve symlink handling. Besides it IMHO fixes a
potential "real_path" leak.
- Do we have to care for circular symlinks INSIDE the modules?
- Do we have to recursively resolve symlinks?
Comment 11 Christian Neumair 2005-05-11 15:29:14 UTC
Comment on attachment 46283 [details] [review]
Proposed patch (against HEAD).

Hrm doesn't seem to work properly.
Comment 12 Martin Wehner 2005-06-22 19:05:11 UTC
*** Bug 308585 has been marked as a duplicate of this bug. ***
Comment 13 Martin Wehner 2005-08-05 18:07:08 UTC
*** Bug 301546 has been marked as a duplicate of this bug. ***
Comment 14 Teppo Turtiainen 2005-08-06 08:19:11 UTC
*** Bug 312711 has been marked as a duplicate of this bug. ***
Comment 15 Sebastien Bacher 2005-08-11 09:33:33 UTC
*** Bug 313115 has been marked as a duplicate of this bug. ***
Comment 16 Christian Kirbach 2005-08-11 10:54:47 UTC
any news on a revised patch?
Comment 17 Christian Kirbach 2005-09-01 21:22:45 UTC
*** Bug 302402 has been marked as a duplicate of this bug. ***
Comment 18 Christian Kellner 2005-09-09 03:46:34 UTC
Working on that one ...
Comment 19 Christian Kirbach 2005-09-14 08:19:56 UTC
latest duplicate is 2.11.x , adjusting version fields
Comment 20 Martin Wehner 2005-11-06 15:14:08 UTC
*** Bug 310632 has been marked as a duplicate of this bug. ***
Comment 21 Sebastien Bacher 2006-01-03 14:27:15 UTC
*** Bug 325028 has been marked as a duplicate of this bug. ***
Comment 22 Martin Wehner 2006-01-26 21:41:22 UTC
*** Bug 308585 has been marked as a duplicate of this bug. ***
Comment 23 Christian Neumair 2006-02-23 15:52:40 UTC
> Working on that one ...

Ping.
Comment 24 Sergej Kotliar 2006-02-27 17:35:37 UTC
*** Bug 332763 has been marked as a duplicate of this bug. ***
Comment 25 Sergej Kotliar 2006-02-27 17:37:28 UTC
The latest duplicate above had a slightly different stack trace, but described the same problem as this bug. If it can be useful check out the stack trace in bug 332763
Comment 26 Christian Neumair 2006-03-02 10:57:16 UTC
Looks like sftp never sets the symlink name (how does one get the file name belonging to a handle, btw.?), and the xfer code assumes that if the file type is GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK, the symlink name is automatically valid, which is not the case.
Comment 27 Christian Neumair 2006-03-17 21:10:08 UTC
Created attachment 61461 [details] [review]
Proposed patch

Discussion:

http://mail.gnome.org/archives/gnome-vfs-list/2006-March/msg00025.html
Comment 28 Aaron Gyes 2006-03-19 21:58:27 UTC
This patch works great for me. Thank you.
Comment 29 Fabio Bonelli 2006-04-03 00:17:01 UTC
*** Bug 318983 has been marked as a duplicate of this bug. ***
Comment 30 Fabio Bonelli 2006-04-03 00:17:16 UTC
*** Bug 336618 has been marked as a duplicate of this bug. ***
Comment 31 Daniel Holbach 2006-04-07 18:54:20 UTC
May I ask, what the situation is regarding this patch? Could it be something for GNOME 2.14.1 or is it deemed to be 2.15 material?
Comment 32 Christian Neumair 2006-06-20 16:34:37 UTC
A patch based on attachment 61461 [details] [review] was committed to GnomeVFS 2.15 [1], it is not very well-tested though. What are you waiting for? :)

[1] http://mail.gnome.org/archives/gnome-vfs-list/2006-April/msg00021.html