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 660077 - FTP copy fails with G_FILE_COPY_NOFOLLOW_SYMLINKS
FTP copy fails with G_FILE_COPY_NOFOLLOW_SYMLINKS
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: ftp backend
unspecified
Other Linux
: Normal minor
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-25 19:24 UTC by Thomas Jollans
Modified: 2015-02-03 22:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ftp: Implement G_FILE_COPY_NOFOLLOW_SYMLINKS (3.48 KB, patch)
2015-02-01 16:03 UTC, Ross Lagerwall
reviewed Details | Review
ftp: Implement G_FILE_COPY_NOFOLLOW_SYMLINKS (1.75 KB, patch)
2015-02-02 22:57 UTC, Ross Lagerwall
committed Details | Review

Description Thomas Jollans 2011-09-25 19:24:15 UTC
When copying files from an SFTP mount, GVfs appears to ignore the G_FILE_COPY_NOFOLLOW_SYMLINKS flag. While an identical symlink should be created at the destination, the link target is copied, or the operation fails if the target is a directory, or doesn't exist at all. When copying a symlink from the local file system to an SFTP host, I get the desired behaviour (symlink at destination)

Let me demonstrate using the gvfs command line tools. magrathea:/home/thomas/test/example_link is a symbolic link pointing to a directory. 

0:pts/1:~/tmp% gvfs-ls -nl sftp://magrathea/home/thomas/test       
example_link	8	(symlink)
0:pts/1:~/tmp% gvfs-copy -P sftp://magrathea/home/thomas/test/example_link .
Error copying file sftp://magrathea/home/thomas/test/example_link: Can't recursively copy directory
1:pts/1:~/tmp%
Comment 1 Thomas Jollans 2011-09-25 19:33:38 UTC
I just realised this also applies to the FTP backend. The archive backend behaves as expected.
Comment 2 Ross Lagerwall 2013-11-04 18:02:26 UTC
With the gvfs from latest git, this works correctly for sftp.

With ftp, I get this:
Error copying file ftp://ross@localhost/Public/link: Insufficient permissions
Comment 3 Ross Lagerwall 2015-02-01 16:03:21 UTC
Created attachment 295890 [details] [review]
ftp: Implement G_FILE_COPY_NOFOLLOW_SYMLINKS
Comment 4 Ondrej Holy 2015-02-02 16:04:35 UTC
Review of attachment 295890 [details] [review]:

::: daemon/gvfsbackendftp.c
@@ +1607,3 @@
+      if (g_file_info_get_is_symlink (info))
+        {
+          pull_copy_symlink (&task,

Wouldn't be better to fail with G_IO_ERROR_NOT_SUPPORTED and let file_copy_fallback to create symlink for us?
Comment 5 Ross Lagerwall 2015-02-02 22:57:07 UTC
Created attachment 295986 [details] [review]
ftp: Implement G_FILE_COPY_NOFOLLOW_SYMLINKS
Comment 6 Ross Lagerwall 2015-02-02 22:57:29 UTC
(In reply to comment #4)
> Review of attachment 295890 [details] [review]:
> 
> ::: daemon/gvfsbackendftp.c
> @@ +1607,3 @@
> +      if (g_file_info_get_is_symlink (info))
> +        {
> +          pull_copy_symlink (&task,
> 
> Wouldn't be better to fail with G_IO_ERROR_NOT_SUPPORTED and let
> file_copy_fallback to create symlink for us?

I suppose that is simpler...
Comment 7 Ondrej Holy 2015-02-03 11:31:51 UTC
Review of attachment 295986 [details] [review]:

Looks good!
Comment 8 Ross Lagerwall 2015-02-03 22:14:20 UTC
Pushed to master as ac81dee. Thanks for the review.