[cups] debugging file auto-typing

pipitas pipitas at gmail.com
Thu Feb 14 14:38:21 PST 2019

On Thu, Feb 14, 2019 at 8:34 PM Tim Mooney <Tim.Mooney at ndsu.edu> wrote:

> In regard to: Re: [cups] debugging file auto-typing, Zdenek Dohnal said
> (at...:
> Thanks for the response, Zdenek.
> > I would look into /var/spool/cups for files starting with 'd' and check
> > their file type. It will get you initial idea what filetype goes to CUPS.
> That I'm familiar with.  I've saved the data file for one of the problem
> print jobs in question.
> These jobs are coming from a print rendering service for mobile devices,
> so the job has already had format conversion done by that service.  My
> expectation is that the auto-typing code should have both
>         application/pdf
>         application/vnd.cups-raw
> as matching file types (pdf because the document extension is .pdf).

Maybe I misunderstand your description...
In /var/spool/cups the files starting with 'd' never have a .pdf extension.
What follows the 'd' always is the current job ID (a number) and it has
not any extension.
These files represent exactly the print data as is received by CUPS from
its client, byte by byte.
So maybe you REALLY should start your debugging exactly here, just
as Zdenek proposed.

You can copy that 'dNNNNNN' file to a place in user space.
Then look at its first few lies in a good editor.
If it starts with '%PDF-' you can add a .pdf extension and open it in your
favorite PDF viewer.
If it's no PDF, try other standard methods to identify its real mime type.
If you cannot identify the mime type, try to apply the PDF-typing rules
(there are not that many) from /usr/share/cups/*.types manually to the
file(s) to find out why CUPS auto-types them as PDF.

I do not think that gdb, ltrace and friends are even needed to debug this...

More information about the cups mailing list