GNOME Bugzilla – Bug 633937
smb/gvfs-copy: Error while copying file, "Invalid argument"
Last modified: 2010-11-19 17:24:26 UTC
user@desktop:~$ gvfs-copy foo.txt smb://server/share/ Error copying file foo.txt: Invalid argument As described here: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/393012 I am able to copy files to the share using smbclient, or even the cp command to ~/.gvfs/sharename. The bug only exists when using gvfs-copy. I discovered the error when trying to transfer a file to a server2008r2 share via Nautilus. * When copying to a Win7/Server2008r2 share via Nautilus: -files <48KB transfer correctly. -files >48KB transfer only the first 48KB. * Copying via 'cp' to ~/.gvfs/sharename completes successfully. * Copying via 'smbclient' completes successfully. ie: smbclient \\\\server\\share > cp foo.txt foo.txt * Copying via 'mc' completes successfully. Steps to reproduce: 1. Create a share on a Win7 or Server 2008r2 server. 2. Use Nautilus to browse to the share. 3. Copy file >48KB. Result "Invalid Argument" OR: 1. Create a share on a Win7 or Server 2008r2 server. 2. gvfs-copy foo.txt smb://server/share/ Result "Error copying file foo.txt: Invalid argument" I can not reproduce against WinXP or earlier.
This is a problem with smbclient. I downgraded to smbclient 3.4.7 from Lucid and can now copy files to smb shares. Doug.
Certainly something has changed with smbclient, but I would like to stress that the new smbclient works fine by itself. Is it not probable that smbclient made some small syntax changes to which gvfs needs to be updated? I hate to see this problem get bounced back and forth between smbclient and gvfs. I'm not savvy to how gvfs calls smbclient, so this is just a question. I can go file with smbclient as well, but I can predict their response :) .
(In reply to comment #2) > Certainly something has changed with smbclient, but I would like to stress that > the new smbclient works fine by itself. Is it not probable that smbclient made > some small syntax changes to which gvfs needs to be updated? I hate to see > this problem get bounced back and forth between smbclient and gvfs. > > I'm not savvy to how gvfs calls smbclient, so this is just a question. I can > go file with smbclient as well, but I can predict their response :) . libsmbclient != smbclient The library and the command-line program might share a lot in their names, but they're 2 different code bases.
I am corrected. Will push this back to bugs.ubuntu.
Okay. Bastien is correct. When I originally downgrade smbclient, I had downgraded the rest of samba as well including libsmbclient. However the problem IS with libsmbclient. With libsmbclient at 3.4.7, and everything else samba related including smbclient at 3.5.4, I can copy files. As soon as I upgrade libsmbclient to 3.5.4, copying fails. Downgrade libsmbclient back to 3.4.7, and copying works again.
I believe this is the same issue as bug #588391 which was in Samba.
It could be, except that bug 588391 was supposedly fixed in 3.4.1. What I am seeing is that libsmbclient 3.4.7 is fine, but 3.5.4 is not. So something has changed between 3.4.7 and 3.5.4 both of which are post 3.4.1.
So you found a regression in libsmbclient. Find out in which version of libsmbclient the problem was introduced, and then which commit introduced it. You should be able to use "git bisect" for that.
Okay. Will try to git bisect today if I get some time.
Can you run the application with a Samba debug level of 10, and attach the log either here or on the Samba bug #6649. https://bugzilla.samba.org/show_bug.cgi?id=6649 please ? I need to see why the "invalid arg" message is being triggered. You can also attach a wireshark packet trace as well (or instead of the Samba log). Thanks, Jeremy.
I attached a wireshark trace to the Samba bug. Unfortunately I didn't manage to get a samba log for that - I've set log level = 10 in smb.conf but I'm not sure how this affects a client only installation.
This is my problem too. How do you get a log when using libsmbclient with another app like gvfs-copy?
(In reply to comment #12) > This is my problem too. How do you get a log when using libsmbclient with > another app like gvfs-copy? You'd need to launch /usr/libexec/gvfsd-smb by hand. GVFS_SMB_DEBUG=10 /usr/libexec/gvfsd-smb server=192.168.1.100 share=mysharename username=username This will mount smb://192.168.1.100/mysharename as the username user, and enable log level of 10 in libsmbcient. Then you can just do a gvfs-copy in a separate terminal.
Created attachment 174213 [details] debug level 10 log of gvfsd-smb when gvfs-copy fails
I did a git bisect today. The problem first appeared between release 3.4.9 and 3.5.0. The git bisect narrowed it down to this patch. http://gitweb.samba.org/?p=abartlet/samba.git/.git;a=commit;h=6af15943c6f868d08945d0ca993506c17107fbd4 The output of gvfsd-smb is different with and without the patch. With the patch, I see smb_signing_check_pdu: out of seq. seq num 53 matches. We were expecting seq 55 smb_signing_good: BAD SIG: seq 55 SMB Signature verification failed on incoming packet! when I first try to use gvfs-copy and then on subsequent gvfs-copy's smb_signing_check_pdu: out of seq. seq num 17 matches. We were expecting seq 19 smb_signing_good: BAD SIG: seq 19 SMB Signature verification failed on incoming packet! . Without the patch I do not see the above and the copy is successful. Hope this helps.
*Extremely* helpful - thanks ! This should help us nail it pretty quickly. Jeremy.
Created attachment 174220 [details] [review] Possible patch for 3.5.x. Can you apply this patch and rebuild Samba. I think this will fix it. Jeremy.
Seems to do the trick. I applied it to 3.5.4 and at least initial testing indicates that it solves the problem. Thanks.
Great ! I'll get this into master and v3-6-test, and I'll prepare a Samba bug for inclusion in 3.5.7. Feel free to add this as a debian or Ubuntu-specific fix until we do the next release. Cheers, Jeremy.
Note that this only happens to servers requiring SMB signing, which is why we didn't catch it earlier. I'll update our test suites to ensure this can't happen again. Jeremy.
Samba bug is: https://bugzilla.samba.org/show_bug.cgi?id=7791 Fix already applied to v3-6-test and master. Awaiting review for 3.5.7 release. Jeremy.
Where can I get the test? Is on on a repo? I have no idea how to compile something sorry, hence why I am asking! But this is great news. I know a lot of Ubuntu kids have been waiting for this fix for quite some time. Thanks Jeremy :)
Fix already pushed to fc14. Can confirm smb is operating as it should. Can now copy files to, on to and from FC to my w2k3 server with SMB signing. Great work Jeremy. Big thanks!
Closing this, as the bug is in libsmbclient.