GNOME Bugzilla – Bug 599354
gvfsd-smb copies directory as empty file (sles10 cifsd)
Last modified: 2014-05-31 20:00:48 UTC
Created attachment 146067 [details] cifsd server log during nautilus copy of "/resources/folder/" Originally posted on launchpad https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/288951 Problem occurs ubuntu 9.04 (i386 & amd64) & 9.10 beta (i386 & amd64) (1.4.1-0ubuntu1) When copying a directory from a gvfs smb mount , destination is created as an empty file with the same name as src directory Both nautilus copy and gvfs-copy create an empty file with the name of the src directory However using: "cp -r ~/.gvfs/share\ on\ server/folder /tmp" it does work correctly smb share is on a novell sles10 server (novell patches applied as of 1 october 09) Have no problem with other samba shares - only seems to be with novells cifsd . It might be their broken implementation, however there is no problems when copying folders using cp or when share is mounted using mount.cifs so I am not too sure Please let me know if there is any further information I can provide at all.
This happens with a newly installed Ubuntu 9.10 as well when trying to copy from a disk connected to an Apple Airport Extreme Base Station (bought January 2010). The Airport has been set up to share the disks with the Airport password, but with guest access on (r+w). Ubuntu sees the disks under the Airport's name in Network, and can copy files from and to the disk without problems, but when trying to copy a folder from the disk, Nautilus pops up an error saying that the folder could not be copied (reason being "No such file or directory"). After telling Nautilus to skip the folder, in the receiving folder an empty file with the directory's name is created. This can potentially lead to data loss (as it did in my case), because if there already is a folder with that name in the target dir, Nautilus asks if you want to merge, but due to this error, it does not merge, but instead _removes_ the target directory and replaces it with an empty file. Copying from the command line with cp -r '~/.gvfs/hddname on router.local/...' '~/somedir' works without problems, as Mick K said. I would attach a log of some kind, but I'm not sure how to do that.
I have investigated the issue with Novell's cifsd that comes with OES 2 and OES 11. Unexpectedly, they allow directories to be opened as files which then allows Nautilus to "copy" the directory. In OES 2, it just acts like an empty file. In OES 11, it allows the directory to be opened but then gives a permission denied error when trying to issue a read.
After investigating further, this appears to be a server bug. A wireshark trace shows that FILE_NON_DIRECTORY_FILE is correctly being sent to the server which requires the server to fail when opening a directory. But Novell's cifsd is not failing and instead opening the directory...
Reopening, since this also seems to affect Apple's new (and broken) smbdx. Hopefully we can get libsmbclient to make a workaround rather than having a workaround in gvfs.
https://bugzilla.samba.org/show_bug.cgi?id=10587
Can you get me a trace on this ? The workaround would be to detect the open coming back with an attribute FILE_DIRECTORY, and then having the libsmbclient close the returned handle and return -1,ENOTDIR in that that. But I really need to see the wire traces first. Jeremy.
This has now been fixed upstream: see 2900dfa5b928e..b2ce2441a35e of Samba's master branch. Thanks
*** Bug 515963 has been marked as a duplicate of this bug. ***