Bug 5452 - smbclient "put" always creates zero byte sized files at destination
smbclient "put" always creates zero byte sized files at destination
Product: Samba 3.2
Classification: Unclassified
Component: Client tools
x86 Linux
: P3 major
: ---
Assigned To: Jeremy Allison
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2008-05-08 21:52 UTC by Kai Engert
Modified: 2008-05-20 02:28 UTC (History)
2 users (show)

See Also:

Patch (477 bytes, patch)
2008-05-09 00:09 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Engert 2008-05-08 21:52:11 UTC
Fedora 9 (preview)
package version samba-client-3.2.0-1.pre3.9.fc9.i386

Windows XP SP3, Intel Laptop, 32 bit

I use
  smbclient '//' -U kaie
  put hello

"hello" is a file of size "6 bytes", containing "hello".

Actual behavior:
smbclient prints:
  smb: \> put hello
  putting file hello as \hello (0,0 kb/s) (average 0,0 kb/s)
and the destination gets a zero bytes file

Expected behavior:
get the correct file at the destination

I tested with different files, always zero bytes.

Additional info:
Same server, same client commands, same input file, but using a Fedora 8 client (version 3.0.28a) it works fine!

It's independent of the input file, I always get zero bytes.

I did a network trace with wireshark (thanks to Andrew Bartlet for helping), he looked at it, and he concluded, it's a good trace for sending a zero byte file.

I did an strace, I see smbclient does a state64, it gets the expected file size (6 bytes), it successfully opens that file, but never reads from it! It does something other actions, but then closes the file.

Thanks to Simo Sorce who reproduced this bug with latest samba code.
Comment 1 Jeremy Allison 2008-05-09 00:09:38 UTC
Created attachment 3282 [details]

A bugfix for the xfile code
that caused x_fopen not to be buffered correctly due to x_setvbuf
failing due to an x_flush check failing.
Comment 2 Jeremy Allison 2008-05-09 00:27:00 UTC
Please confirm this fixes the bug (it does here) and I'll close it out. Thanks,
Comment 3 Kai Engert 2008-05-19 16:17:25 UTC
Thanks for the fix.

I've updated my Fedora 9 system to a more recent RPM package, which included the patch, built by Gunther, and it fixed the problem for me.
Comment 4 Karolin Seeger 2008-05-20 02:28:48 UTC
Fix confirmed by reporter.
Marking bug report as fixed.