GNOME Bugzilla – Bug 660077
FTP copy fails with G_FILE_COPY_NOFOLLOW_SYMLINKS
Last modified: 2015-02-03 22:14:33 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%
I just realised this also applies to the FTP backend. The archive backend behaves as expected.
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
Created attachment 295890 [details] [review] ftp: Implement G_FILE_COPY_NOFOLLOW_SYMLINKS
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?
Created attachment 295986 [details] [review] ftp: Implement G_FILE_COPY_NOFOLLOW_SYMLINKS
(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...
Review of attachment 295986 [details] [review]: Looks good!
Pushed to master as ac81dee. Thanks for the review.