Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

PPD line length checking is overly strict #2662

Closed
michaelrsweet opened this Issue Jan 9, 2008 · 2 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Jan 9, 2008

Version: 1.3.5
CUPS.org User: twaugh.redhat

Some existing PPDs have lines (comments) longer than the allowed line length of 255 characters. CUPS could be a little more tolerant of this particular mistake.

Original bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=405061

Suggested patch, to make the line length check part of the 'strict' conformance checks rather than the default 'relaxed', attached.

Collaborator

michaelrsweet commented Jan 9, 2008

CUPS.org User: mike

This will not be changed.

The PPD spec has been out for many years, and the 255 character limit is common to CUPS, the old LaserWriter (Mac OS 9 and earlier), and all Windows PostScript drivers (at least).

Allowing long lines will just cause problems, and we already have to deal with too many poorly-crafted PPD files.

Finally, the bug was in Foomatic, and it has been fixed. There is no reason to "fix" CUPS by breaking basic PPD format parsing and potentially causing problems with other consumers of those PPD files.

Collaborator

michaelrsweet commented Jan 9, 2008

"cups-strict-ppd-line-length.patch":

diff -up cups-1.3.5/cups/ppd.c~ cups-1.3.5/cups/ppd.c
--- cups-1.3.5/cups/ppd.c~ 2007-11-30 19:29:50.000000000 +0000
+++ cups-1.3.5/cups/ppd.c 2008-01-09 12:08:48.000000000 +0000
@@ -2801,7 +2801,7 @@ ppd_read(cups_file_t fp, / I - Fil
*lineptr++ = ch;
col ++;

  • if (col > (PPD_MAX_LINE - 1))

  • if (col > (PPD_MAX_LINE - 1) && cg->ppd_conform == PPD_CONFORM_STRICT)
    {
    /*
    * Line is too long...
    @@ -2868,7 +2868,7 @@ ppd_read(cups_file_t fp, / I - Fil
    {
    col ++;

  • if (col > (PPD_MAX_LINE - 1))
    
  • if (col > (PPD_MAX_LINE - 1) && cg->ppd_conform == PPD_CONFORM_STRICT)
    

    {
    /*
    * Line is too long...
    @@ -2931,7 +2931,7 @@ ppd_read(cups_file_t fp, / I - Fil
    {
    col ++;

  • if (col > (PPD_MAX_LINE - 1))
    
  • if (col > (PPD_MAX_LINE - 1) && cg->ppd_conform == PPD_CONFORM_STRICT)
    

    {
    /*
    * Line is too long...

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment