[Pkg-cups-devel] Bug#497671: cups: porky workaround

Tanguy Ortolo tanguy+debian at ortolo.eu
Fri Aug 21 15:10:42 UTC 2009


Package: cups
Version: 1.3.8-1+lenny6
Followup-For: Bug #497671

I found a theoretical way to work around this problem: making CUPS
identify files sent via Samba as PostScript with integrated printing
parameters, that is, application/vnd.cups-postscript.

Indeed, there is at least a difference between regular PostScript and
PostScript that has been treated by CUPS:
%cupsJobTicket: …

So, this </etc/cups/mime.types> setting *should* let CUPS differentiate
both:
application/postscript      (ai eps ps string(0,%!) string(0,<04>%!) \
                             contains(0,128,<1B>%-12345X) + \
                             (contains(0,4096,"LANGUAGE=POSTSCRIPT") \
                              contains(0,4096,"LANGUAGE = Postscript") \
                              contains(0,4096,"LANGUAGE = PostScript") \
                              contains(0,4096,"LANGUAGE = POSTSCRIPT") \
                              (contains(0,4096,<0a>%!) + \
                               !contains(0,4096,"ENTER LANGUAGE")))) 
                            !contains(0,1024,"%cupsJobTicket:")
application/vnd.cups-postscript string(0,%!) + contains(0,1024,"%cupsJobTicket: ")

BUT… CUPS simple *ignores* the content of the application/postscript
definition: as long as it is defined, and whatever it contains, CUPS
seems to use its own (hardcoded?) definition. Consequently, CUPS-treated
PostScript is still identified as application/postscript, even if it
does contains “%cupsJobTicket:”.

So, there is still a porky, practical workaround: not to define
application/postscript, but application/vnd.noncups-postscript (for
instance), that is not subject to CUPS's internal definition:
application/vnc.noncups-postscript      (ai eps ps string(0,%!) string(0,<04>%!) \
                                         contains(0,128,<1B>%-12345X) + \
                                         (contains(0,4096,"LANGUAGE=POSTSCRIPT") \
                                          contains(0,4096,"LANGUAGE = Postscript") \
                                          contains(0,4096,"LANGUAGE = PostScript") \
                                          contains(0,4096,"LANGUAGE = POSTSCRIPT") \
                                          (contains(0,4096,<0a>%!) + \
                                           !contains(0,4096,"ENTER LANGUAGE")))) 
                                        !contains(0,1024,"%cupsJobTicket:")

Then, one has to add application/vnc.noncups-postscript support in
</etc/cups/mime.convs>, so that CUPS can handle this regular PostScript:
application/vnd.noncups-postscript      application/vnd.cups-postscript 66      pstops

To me, this solution looks awful but, as far as I could test it, it
works.

Regards,

-- 
Tanguy Ortolo

-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.27.10-grsec-xxxx-grs-ipv6-32 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash





More information about the Pkg-cups-devel mailing list