[cups.bugs] [LOW] STR #3160: mime rules using multiple negated (NOT) statements will not be parsed correctly

Nik Svoboda nsvobo1 at lsu.edu
Wed Apr 8 11:10:37 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

A mime rule set that has the following conditions will not be parsed
correctly:

*includes a series of statements negated with the NOT operator
*the series of statements are connected with the AND operator
*the series of statements is at the beginning of the ruleset
*[more than one of the statments is true (flipped to false after the
negation)] OR [The first statment resolves as false (flipped to true after
the negation)]

   As an example, here is the header for a PS file coming from a printer
driver:
**************************
<1B>%-12345X at PJL JOB NAME="PDF File.pdf"
@PJL SET STRINGCODESET=UTF8
**************************

   I varied the ruleset for the postscript type and monitored what CUPS
found the type to be. The following is the generic postscript rule which
correctly determines this print job as postscript:
**************************
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")))
***********************

   I added in rules as contains(0,1024," .. ") to look for "@PJL" and "JOB
NAME" that should prevent the rule from determining this file as
postscript. The strings "random string not here" and "random string also
not here" are also added in as dummy lines. Any combination of these
negated lines AND'ed together should prevent the job from being typed as
postscript. However, the job is incorrectly found as postscript in the
conditions listed above.

   Examples of rulesets that correctly determine this job as text/plain
are attached as "correct.txt". Examples that incorrectly determine this
job as postscript are attached as "incorrect.txt".

Link: http://www.cups.org/str.php?L3160
Version: 1.3.8
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: correct.txt
URL: <https://lists.cups.org/pipermail/cups/attachments/20090408/03c4c790/attachment.txt>


More information about the cups mailing list