Bug#912993: printer-driver-cups-pdf: creates wrong filename using short title
I'm on Debian testing with package printer-driver-cups-pdf version 3.0.1-14.
I get broken output file names as well, and I think it is an upstream bug.
Here is my configuration as dumped by cups-pdf:
------------------------------ snip ------------------------------
Thu Mar 9 14:50:11 2023 [DEBUG] *** Final Configuration ***
Thu Mar 9 14:50:11 2023 [DEBUG] AnonDirName = "/var/spool/cups-pdf/ANONYMOUS"
Thu Mar 9 14:50:11 2023 [DEBUG] AnonUser = "nobody"
Thu Mar 9 14:50:11 2023 [DEBUG] GhostScript = "/usr/bin/gs"
Thu Mar 9 14:50:11 2023 [DEBUG] GSCall = "%s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c -f %s"
Thu Mar 9 14:50:11 2023 [DEBUG] Grp = "lpadmin"
Thu Mar 9 14:50:11 2023 [DEBUG] GSTmp = "TMPDIR=/var/tmp"
Thu Mar 9 14:50:11 2023 [DEBUG] Log = "/var/log/cups"
Thu Mar 9 14:50:11 2023 [DEBUG] PDFVer = "1.2"
Thu Mar 9 14:50:11 2023 [DEBUG] PostProcessing = ""
Thu Mar 9 14:50:11 2023 [DEBUG] Out = "${HOME}/tmp/transfer/print"
Thu Mar 9 14:50:11 2023 [DEBUG] Spool = "/var/spool/cups-pdf/SPOOL"
Thu Mar 9 14:50:11 2023 [DEBUG] UserPrefix = ""
Thu Mar 9 14:50:11 2023 [DEBUG] RemovePrefix = ""
Thu Mar 9 14:50:11 2023 [DEBUG] OutExtension = "pdf"
Thu Mar 9 14:50:11 2023 [DEBUG] Cut = 3
Thu Mar 9 14:50:11 2023 [DEBUG] Truncate = 64
Thu Mar 9 14:50:11 2023 [DEBUG] DirPrefix = 0
Thu Mar 9 14:50:11 2023 [DEBUG] Label = 2
Thu Mar 9 14:50:11 2023 [DEBUG] LogType = 7
Thu Mar 9 14:50:11 2023 [DEBUG] LowerCase = 1
Thu Mar 9 14:50:11 2023 [DEBUG] TitlePref = 0
Thu Mar 9 14:50:11 2023 [DEBUG] DecodeHexStrings = 1
Thu Mar 9 14:50:11 2023 [DEBUG] FixNewlines = 0
Thu Mar 9 14:50:11 2023 [DEBUG] AllowUnsafeOptions = 0
Thu Mar 9 14:50:11 2023 [DEBUG] AnonUMask = 0000
Thu Mar 9 14:50:11 2023 [DEBUG] UserUMask = 0077
Thu Mar 9 14:50:11 2023 [DEBUG] *** End of Configuration ***
------------------------------ snip ------------------------------
A few lines later in the log file I get these really suspicious entries:
------------------------------ snip ------------------------------
Thu Mar 9 14:50:11 2023 [DEBUG] found title in ps code: cups-pdf.c
idt/tmp/transfer/print
Thu Mar 9 14:50:11 2023 [DEBUG] found end of postscript code: %%EOF
------------------------------ snip ------------------------------
Note that newline ("cups-pdf.c***\n***idt/tmp/transfer/print") is part of
the first log line!
So IMHO there is something wrong with this block from cups-pdf.c:
------------------------------ snip ------------------------------
if (sscanf(buffer, "%%%%Title: %"TBUFSIZE"c", title)==1) {
log_event(CPDEBUG, "found title in ps code: %s", title);
is_title=1;
}
------------------------------ snip ------------------------------
Can it be that the result in variable title needs to be zero-terminated?
Reply to: