Steps to reproduce:
1. Upgrade to Samba 4.8.x from 4.7.x.
2. Print to an SMB print URI.
smbspool prints a usage message and returns 1, causing print to fail.
Revert commit a55ef12 , which appears to be intended as a cosmetic change to the usage error message, but which actually breaks the way smbspool handles arguments when called by CUPS as a backend (i.e. with the URI in argv).
I have tested this fix and printing via CUPS is restored.
Error log from CUPS:
D [30/Apr/2018:15:51:36 -0500] [Job 812] Usage: smb://myprintserver/myprintername [DEVICE_URI] job-id user title copies options [file]
D [30/Apr/2018:15:51:36 -0500] [Job 812] The DEVICE_URI environment variable can also contain the
D [30/Apr/2018:15:51:36 -0500] [Job 812] destination printer:
D [30/Apr/2018:15:51:36 -0500] [Job 812] smb://[username:password@][workgroup/]server[:port]/printer
D [30/Apr/2018:15:51:36 -0500] [Job 812] PID 11223 (/usr/lib/cups/backend/smb) stopped with status 1.
I [30/Apr/2018:15:51:36 -0500] [Job 812] Backend returned status 1 (failed)
D [30/Apr/2018:15:51:36 -0500] Discarding unused job-state-changed event...
I [30/Apr/2018:15:51:36 -0500] [Job 812] Printer stopped due to backend errors; please consult the error_log file for details.
Looks like this is a pretty straightforward regression.
@Andreas: are you okay with the proposed revert here?
Which arguments is cups passing to smbspool?
Downstream duplicate: https://bugzilla.suse.com/show_bug.cgi?id=1089278
The command is called like that:
D [02/May/2018:15:31:08 +0200] [Job 116] /usr/lib/cups/backend/smb 116 root Test Page 1 job-uuid=urn:uuid:a387858e-714d-3239-5ca8-ec9443c94039 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1525267867 time-at-processing=1525267867
This means it is called like that:
DEVICE_URI=smb://localhost/printer bin/smbspool 116 root "Test Page" 1 "job-uuid=urn:uuid:a387858e-714d-3239-5ca8-ec9443c94039 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1525267867 time-at-processing=1525267867"
So the argv calculations are wrong. I'm fixing it and writing tests.
Created attachment 14175 [details]
patch for master
Thanks. The patch looks good to me. I pushed it to autobuild
djpohly: please confirm that Andreas's patch (https://bugzilla.samba.org/attachment.cgi?id=14175) works in your environment.
I can verify smb:// printing works again with the patch applied to samba git.
Note that CUPS does pass the device URI as argv (not argv!) as well as in $DEVICE_URI, so don't expect the usage printf to display "smbspool" or any such sensible thing in the wild. The backend(7) man page isn't clear as to whether backends are required to parse argv or may rely on $DEVICE_URI always being set.
Thanks a lot Devin, for your thorough bisect work in particular!
Created attachment 14182 [details]
patch for 4.8
Created attachment 14183 [details]
patch for 4.8
Comment on attachment 14183 [details]
patch for 4.8
Karolin, please add to 4.8. Thanks.
(In reply to Andreas Schneider from comment #13)
Pushed to autobuild-v4-8-test.
(In reply to Karolin Seeger from comment #14)
Pushed to v4-8-test.
Closing out bug report.