currently samba (ab)uses the smbjob field of the print job structure to pass the job ID to the CUPS backend. As this field is declared bool, and bool maps to _Bool on C99 compatible implementations, the job ID is demoted to the range of _Bool (i.e. 0 or 1), causing all print jobs to start with smbprn.00000001 and mixup of the jobs when the Queue is parsed. The attached patch fixes it.
Created attachment 5532 [details] Patch that takes the job ID from the spool file name
Looks correct. The abuse was from older Samba code where we used our own defined BOOL which was defined as an "int". Jeremy.
Ok, I've looked at this carefully, and I think I'd like to rewrite it to use the existing function we have in printing/printing.c called: print_parse_jobid(char *filename) Modified patch to follow.... Jeremy.
Created attachment 5546 [details] Bouncing fingers on a google shuttle led me to submit this prematurely :-).
Created attachment 5547 [details] Patch I've applied to master. I think this is the correct fix. It causes cups_job_submit to use print_parse_jobid(), which I've moved into printing/lpq_parse.c (to allow the link to work). It turns out the old print_parse_jobid() was *broken*, in that the pjob filename was set as an absolute path - not relative to the sharename (due to it not going through the VFS calls). This meant that the original code doing a strncmp on the first part of the filename would always fail - it starts with a "/", not the relative pathname of PRINT_SPOOL_PREFIX ("smbprn."). This fix could fix some other mysterious printing bugs - probably the ones Guenther noticed where job control fails on non-cups backends. Jeremy.
Created attachment 5548 [details] git-am format patch for 3.5.2 and 3.4.8 Guenther please review and pass to Karolin if you're happy. Jeremy.
Created attachment 5549 [details] git am patch for 3.5.x and 3.4.x Replacement fix - includes the removal of the setting of the smbjob bool as well as the rewrite of print_parse_jobid. Guenther please check then reassign to Karolin for inclusion. Jeremy.
Pinging Guenther for review (user reporting this on the mailing list). CC:ing Karolin so this doesn't get missed for 3.5.x and 3.4.x. Jeremy.
Comment on attachment 5549 [details] git am patch for 3.5.x and 3.4.x Requesting review from Metze in case Guenther is busy. Jeremy.
Just as a note: The original implementation (matching only at the beginning of the string) was working fine for lpd queues to parse the document filename, because traditionally, these file names were listed without paths, so parsing the queue entry names worked.
Comment on attachment 5549 [details] git am patch for 3.5.x and 3.4.x looks good
Karolin, please pick for the next releases
Pushed to both branches. Closing out bug report. Thanks!