As reproduced by several users in attempts to resolve the final Samba-specific part of https://bugs.launchpad.net/ubuntu/+source/foomatic-filters/+bug/60931 on irc://irc.freenode.net/#samba-os2, when printing through smbclient to printers at least on machines running OS/2 Warp 4 or eCS will cause the print jobs to fail above a certain size, as only the first e.g. 126kB (apparently machine-dependent) of each job will end up in the destination queue, even though smbclient reports the following: smb: \> print job.ps Error writing file: SUCCESS - 0 putting file job.ps as job.ps (384.1 kb/s) (average 617.6 kb/s) On OS/2 this can be traced by setting the respective printer to Hold and copy the job files out of D:\Spool\MyPSprtr\*.SPL, to diff -u them against the ones sent via smbclient. Discussion on irc://irc.freenode.net/#samba-technical indicates comparative wireshark sniffs may be needed to help resolve this issue.
The following is happening here: smbclient uses the _same_ internal function cli_write() for the cmds "put" and "print". "put" is working, "print" is failing ! The difference is, that "put" is used against a file share and "print" against a print share. On the receiving os/2 side both requests are handled by different services. The printing stuff is handled by the spooler - and this one handles the WriteAndX Response different than the peer or server service. Maybe even the "smb protocol specs" have some info about this... Beside others WriteAndX Response has 2 fields (from the wireshark display): Count Low Count High (multiply with 64K) which match the code in cli_write() as: bwritten += SVAL(cli->inbuf, smb_vwv2); bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16); "bwritten" is summing up the total number of bytes written so far. The difference between "put" and "print", as responded back from os/2: When "print" is used, os/2 uses "Count Low" as usual (bytes received), but "Count High (multiply with 64K)" is containing "the current 64k page" or some similar named stuff. Hard to explain Here my debug output: GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 0 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 1 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 2 GK: 4096 3 GK: 4096 3 GK: 4096 3 ... Chunks of 4096 bytes are passed over here. So the current summing up bwritten += SVAL(cli->inbuf, smb_vwv2); bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16); cannot work! :-) bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16); must be _ignored_ here. I temporarely commented out this line - and from now on i was able to print ebay.com.ps (TEN emailed it) and Opera also prints fine now to our os/2 warpserver 5.0 connected postscript printer! :-) BTW - during "put" file transfers the field "Count High" was always returned as zero. Cheers, Guenter
I had planned to also test this against a recent windows system, but time went out after some first checks - had to do preparations for a 8 days holidays trip... With the unmodified original v3-2-test version I got: Error writing file: NT_STATUS_OK (0,0 kb/s) (average 0,0 kb/s) But this needs more testing ... Cheers, Günter
Created attachment 3220 [details] Patch for 3.0.x. Guenter, can you try this patch for 3.0.x ? Hopefully should fix the bug. Thanks, Jeremy.
Jeremy, great - your patch fixed that os/2 printing problem. :-) Interesting enough, i never hit that one before - was only printing small ascii pages in the past (which worked). TEN told me on irc, that this one "is a very long outstanding one" - and the fix will make "many os/2 users very happy". :-) In v3-2-test some variables renaming has been done - but your patch should match, too. Cheers, Günter
Fixed in 3.0.x and 3.2 git trees Jeremy.
3.6 has this problem again.
Hi Stefan, your changes in http://git.samba.org/?p=samba.git;a=commitdiff;h=95595dd93fd04999fcf56ecaab7c29b064d021f8 look fine to me and fixes the problem! How do i add "Signed-off-by:" ? This bug can be closed. Cheers, Günter
Created attachment 7084 [details] Patches for v3-6-test This is the backport for 3.6.2 that needs review
This can be closed when the patches are in the release branches
Created attachment 7085 [details] Patches for v3-5-test
Günter, can you also give a review + for the 3.6 patch and assign this to Karolin
Hi Karolin, these patches look fine to me. Cheers, Günter
Pushed to v3-5-test and v3-6-test. Closing out bug report. Thanks!