GNOME Bugzilla – Bug 332676
symbolic links with spaces in their pathnames on ftp servers does not work
Last modified: 2008-01-03 12:09:18 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/gnome-vfs2/+bug/29485 "There are problems with ftp and symbolic links that contain spaces. To Illustrate I made the following directory: [ kjetil ~ ]$ gnomevfs-ls file:///ftp/test/ | sort 1_without_Spaces (Directory, x-directory/normal) size 4096 mode 0755 2_without_Spaces_Link1 [link: /ftp/test/1_without_Spaces ] (Directory, x-directory/normal) size 4096 mode 0755 3 without Spaces Link2 [link: /ftp/test/1_without_Spaces ] (Directory, x-directory/normal) size 4096 mode 0755 4 with Spaces (Directory, x-directory/normal) size 4096 mode 0755 5_with_Spaces_Link1 [link: /ftp/test/4 with Spaces/ ] (Directory, x-directory/normal) size 4096 mode 0755 6 with Spaces Link2 [link: /ftp/test/4 with Spaces/ ] (Directory, x-directory/normal) size 4096 mode 0755 . (Directory, x-directory/normal) size 4096 mode 0755 .. (Directory, x-directory/normal) size 4096 mode 0775 When accessing the dir via ftp I get the following: [ kjetil ~ ]$ gnomevfs-ls ftp://kjetil:****@localhost/test | sort 1_without_Spaces (Directory, x-directory/normal) size 4096 mode 0755 2_without_Spaces_Link1 [link: /test/1_without_Spaces ] (Directory, x-directory/normal) size 4096 mode 0755 3 [link: /test/1_without_Spaces ] (Directory, x-directory/normal) size 4096 mode 0755 4 with Spaces (Directory, x-directory/normal) size 4096 mode 0755 5_with_Spaces_Link1 [link: 4 ] (Symbolic Link, x-special/symlink) size 14 mode 0777 6 [link: 4 ] (Symbolic Link, x-special/symlink) size 14 mode 0777 . (Directory, x-directory/normal) size 4096 mode 0755 .. (Directory, x-directory/normal) size 4096 mode 0775 This makes the links numbered 3 and 6 (the ones with spaces in them) not work. As you can the links can point to a file containing spaces, but cannot have spaces itself. The spaces need not be in the actual filename of the link, they can be anywhere in its path. ... > What ftp server do you use? ... I used to use pureftpd, but to eliminate the ftp server from the equation i switched to vsftpd, and the problem still exists. ... > could you describe a simple way (go on the server, create "One stuff", run ...) to get the issue on dapper? ... Certainly: [ kjetil /ftp/test ]$ touch foo [ kjetil /ftp/test ]$ ln -s foo "bar baz" [ kjetil /ftp/test ]$ gnomevfs-ls ftp://kjetil:******@localhost/test . (Directory, x-directory/normal) size 4096 .. (Directory, x-directory/normal) size 4096 bar [link: /test/foo ] (Regular, application/octet-stream) size 0 foo (Regular, application/octet-stream) size 0 [ kjetil /ftp/test ]$ ncftpls -l ftp://kjetil:******@localhost:/test/ lrwxrwxrwx 1 ftp ftp 3 Feb 26 19:22 bar baz -> foo -rw-r--r-- 1 ftp ftp 0 Feb 26 19:22 foo OT: Does Malone allow pre or code tags to prevent code lines from wrapping? "
Created attachment 97517 [details] [review] Fix incorrectly ftp symlink with space in it. I confirm this bug. ftp ls output is incorrectly parsed in gnome_vfs_parse_ls_lga when there are space in symlink filenames. The filename is extracted from the p_copy string, but this string was tokenized by vfs_split_text, each column being separated by '\0' char. Hence, g_strndup only extract the first word. The same problem happen when the symlink target has spaces in it. The attached patch solves this bug because it uses the original p_pristine string instead of p_copy.