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 633937 - smb/gvfs-copy: Error while copying file, "Invalid argument"
smb/gvfs-copy: Error while copying file, "Invalid argument"
Status: RESOLVED NOTGNOME
Product: gvfs
Classification: Core
Component: smb backend
1.6.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2010-11-03 19:07 UTC by ben selinger
Modified: 2010-11-19 17:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
debug level 10 log of gvfsd-smb when gvfs-copy fails (173.73 KB, text/plain)
2010-11-10 19:27 UTC, Doug Rintoul
  Details
Possible patch for 3.5.x. (902 bytes, patch)
2010-11-11 00:04 UTC, Jeremy Allison
none Details | Review

Description ben selinger 2010-11-03 19:07:50 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.
Comment 1 Doug Rintoul 2010-11-04 18:26:33 UTC
This is a problem with smbclient. I downgraded to smbclient 3.4.7 from Lucid and can now copy files to smb shares.

Doug.
Comment 2 ben selinger 2010-11-04 19:36:03 UTC
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 :) .
Comment 3 Bastien Nocera 2010-11-04 19:42:56 UTC
(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.
Comment 4 ben selinger 2010-11-04 20:51:49 UTC
I am corrected.  Will push this back to bugs.ubuntu.
Comment 5 Doug Rintoul 2010-11-04 21:13:37 UTC
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.
Comment 6 Oded Arbel 2010-11-08 07:54:15 UTC
I believe this is the same issue as bug #588391 which was in Samba.
Comment 7 Doug Rintoul 2010-11-08 17:13:00 UTC
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.
Comment 8 Bastien Nocera 2010-11-08 17:15:15 UTC
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.
Comment 9 Doug Rintoul 2010-11-08 17:23:03 UTC
Okay. Will try to git bisect today if I get some time.
Comment 10 Jeremy Allison 2010-11-09 00:07:17 UTC
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.
Comment 11 Oded Arbel 2010-11-09 08:56:38 UTC
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.
Comment 12 Doug Rintoul 2010-11-10 17:46:17 UTC
This is my problem too. How do you get a log when using libsmbclient with another app like gvfs-copy?
Comment 13 Bastien Nocera 2010-11-10 18:03:58 UTC
(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.
Comment 14 Doug Rintoul 2010-11-10 19:27:51 UTC
Created attachment 174213 [details]
debug level 10 log of gvfsd-smb when gvfs-copy fails
Comment 15 Doug Rintoul 2010-11-10 22:52:14 UTC
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.
Comment 16 Jeremy Allison 2010-11-10 23:18:11 UTC
*Extremely* helpful - thanks ! This should help us nail it pretty quickly.

Jeremy.
Comment 17 Jeremy Allison 2010-11-11 00:04:20 UTC
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.
Comment 18 Doug Rintoul 2010-11-11 00:23:11 UTC
Seems to do the trick. I applied it to 3.5.4 and at least initial testing indicates that it solves the problem. 

Thanks.
Comment 19 Jeremy Allison 2010-11-11 00:26:37 UTC
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.
Comment 20 Jeremy Allison 2010-11-11 00:27:31 UTC
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.
Comment 21 Jeremy Allison 2010-11-11 17:47:46 UTC
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.
Comment 22 James Bos 2010-11-14 13:52:23 UTC
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 :)
Comment 23 James Bos 2010-11-19 17:10:23 UTC
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!
Comment 24 Bastien Nocera 2010-11-19 17:24:26 UTC
Closing this, as the bug is in libsmbclient.