Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

cupstestppd does not report bad *JobPatchFile PPD syntax #3421

Closed

Description

@michaelrsweet

Version: 1.3.9
CUPS.org User: chap

[scope: only tested on RHEL, but the reported issue isn't obviously
OS specific.]

Hi,

According to p. 73 of TN 5003, the PPD syntax for *JobPatchFile is
*JobPatchFile: int: "invocation"

So, in my attempt to work around the packedarray bug in our
newest HP printer, I added this line to the PPD:

*JobPatchFile: 0: "/setpacking { pop //false setpacking } bind def "

cupstestppd liked the syntax, but what pstops actually put into
the file was:

0: /setpacking { pop //false setpacking } bind def

which of course incurs a PostScript undefined. Apparently pstops
doesn't parse the *JobPatchFile syntax into a separate int and
invocation string. (Probably treating it like *PatchFile, which
doesn't have the extra int argument.)

I was able to work around the problem by writing deliberately
incorrect syntax leaving off the int:

*JobPatchFile: "/setpacking { pop //false setpacking } bind def "

cupstestppd still likes it, and now pstops puts the right string
into the file. But it would be nice if the correct syntax worked
too.

Thanks,
Chapman Flack

Activity

  1. michaelrsweet commented on Nov 19, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Actually, look closer: there is no colon after JobPatchFile, and the description specifies that the int is an OptionKeyword.

  2. michaelrsweet commented on Nov 19, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: chap

    I'll get my glasses checked, those colons are harder and harder to see.
    Unforced error on my part, sorry. If I use

    *JobPatchFile 0: "/setpacking { pop //false setpacking } bind def "

    it does work. (It goes in the file with %%BeginFeature: *JobPatchFile 1
    instead of 0, but it works, which is the part I really cared about.)

    Should my second wrong attempt, where I left the int completely off, maybe have been dinged by cupstestppd? I.e., am I right that the int being syntactically OptionKeyword doesn't make it optional in the sense of not having to be there, and that the following nonterminal, InvocationValue, can only occur "where there is an option keyword present"? That's a tiny point though.

    Sorry for my hasty conclusion yesterday.
    -Chap

  3. michaelrsweet commented on Nov 19, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Reopening as a bug against cupstestppd then...

  4. michaelrsweet commented on Nov 20, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Hmm, there is a check in cupstestppd to make sure we don't have a double-quote in the string (which would indicate a malformed JobPatchFile value). Doing some more testing...

  5. michaelrsweet commented on Nov 20, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Fixed in Subversion repository.

    Turns out the check in cupstestppd was not enough; I've added checks in ppdOpen* for this instead.

  6. michaelrsweet commented on Nov 20, 2009

    @michaelrsweet
    ContributorAuthor

    "str3421.patch":

    Index: cups/test.ppd

    --- cups/test.ppd (revision 8897)
    +++ cups/test.ppd (working copy)
    @@ -39,7 +39,7 @@
    _Throughput: "1"
    *LandscapeOrientation: Plus90
    *TTRasterizer: Type42
    -_cupsFilter: "application/vnd.cups-raster - 0"
    +*cupsFilter: "application/vnd.cups-raster 0 -"
    *RequiresPageRegion All: True

    *% These constraints are used to test ppdConflicts() and cupsResolveConflicts()

    Index: cups/ppd.c

    --- cups/ppd.c (revision 8897)
    +++ cups/ppd.c (working copy)
    @@ -352,11 +352,13 @@
    _("Illegal option keyword string"),
    _("Illegal translation string"),
    _("Illegal whitespace character"),

    •     _("Bad custom parameter")
      
    •     _("Bad custom parameter"),
      
    •     _("Missing option keyword"),
      
    •     _("Bad value string")
      };
      
    • if (status < PPD_OK || status > PPD_ILLEGAL_WHITESPACE)
    • if (status < PPD_OK || status >= PPD_MAX_STATUS)
      return (_cupsLangString(cupsLangDefault(), _("Unknown")));
      else
      return (_cupsLangString(cupsLangDefault(), messages[status]));
      @@ -1177,6 +1179,37 @@
      }
      else if (!strcmp(keyword, "JobPatchFile"))
      {
    • /*
      
    •  \* CUPS STR #3421: Check for "*JobPatchFile: int: string"
      
    •  */
      
    •  if (isdigit(*string & 255))
      
    •  {
      
    •    for (sptr = string + 1; isdigit(*sptr & 255); sptr ++);
      
    •    if (*sptr == ':')
      
    •    {
      
    •     /*
      
    •      \* Found "*JobPatchFile: int: string"...
      
    •      */
      
    •      cg->ppd_status = PPD_BAD_VALUE;
      
    • goto error;
      
    •    }
      
    •  }
      
    •  if (!name[0])
      
    •  {
      
    •   /*
      
    •    \* Found "*JobPatchFile: string"...
      
    •    */
      
    •    cg->ppd_status = PPD_MISSING_OPTION_KEYWORD;
      
    • goto error;
    •  }
      
      • if (ppd->patches == NULL)
        ppd->patches = strdup(string);
        else
        Index: cups/ppd.h
        ===================================================================
        --- cups/ppd.h (revision 8897)
        +++ cups/ppd.h (working copy)
        @@ -115,7 +115,10 @@
        PPD_ILLEGAL_OPTION_KEYWORD, /* Illegal option keyword string /
        PPD_ILLEGAL_TRANSLATION, /
        Illegal translation string /
        PPD_ILLEGAL_WHITESPACE, /
        Illegal whitespace character */
    • PPD_BAD_CUSTOM_PARAM /* Bad custom parameter */
    • PPD_BAD_CUSTOM_PARAM, /* Bad custom parameter */
    • PPD_MISSING_OPTION_KEYWORD, /* Missing option keyword */
    • PPD_BAD_VALUE, /* Bad value string */
    • PPD_MAX_STATUS /* @Private@ */
      } ppd_status_t;

    enum ppd_conform_e /**** Conformance Levels @SInCE CUPS 1.1.19/Mac OS X 10.3@ ****/

  7. added this to the Stable milestone on Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions