apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.94k stars 464 forks source link

cups-driverd truncates Device IDs to 127 characters #3871

Closed michaelrsweet closed 13 years ago

michaelrsweet commented 13 years ago

Version: 1.5-current CUPS.org User: twaugh.redhat

Device IDs reported by PPD files are truncated to 128 characters (in load_drivers()), which is very restrictive. Consider this real world example for instance:

MFG:Hewlett-Packard;MDL:HP LaserJet 2100 Series;CMD:PJL,MLC,PCL,PCLXL,POSTSCRIPT;DES:Hewlett-Packard LaserJet 2100 Series;

This is already 122 characters. Imagine if the CLASS field had been included, as suggested in IEEE 1284:

CLS:PRINTER;MFG:Hewlett-Packard;MDL:HP LaserJet 2100 Series;CMD:PJL,MLC,PCL,PCLXL,POSTSCRIPT;DES:Hewlett-Packard LaserJet 2100 Series;

This would be 135 characters, so 8 of them would be lost (7 over-length, plus another to make room for a terminating nul). As the fields can be listed in any order, this information could be vital for matching devices to drivers.

Please increase this limit to something more reasonable, such as 256 -- which is what is used in load_ppds().

michaelrsweet commented 13 years ago

CUPS.org User: mike

This is a feature request until there is actually a PPD that is affected by this.

PPD files generally only include those 1284 keys that are needed for device selection. Increasing the size means bumping the storage format and forcing a regeneration of the PPD cache for potentially thousands of files, so this isn't something we are going to do in a patch release unless absolutely necessary.

michaelrsweet commented 13 years ago

CUPS.org User: twaugh.redhat

Are you sure it means changing the storage format? As I mentioned, load_ppds() already uses a limit of 256 characters, and that seems to be the storage format limit.

michaelrsweet commented 13 years ago

CUPS.org User: mike

OK, agreed - I looked at the code again and the (deprecated) driver interface program path is the only place we limit device IDs to 127 characters. Moving back to a P2 bug for CUPS 1.5...

michaelrsweet commented 13 years ago

CUPS.org User: mike

Fixed in Subversion repository.

michaelrsweet commented 13 years ago

"str3871.patch":

Index: scheduler/cups-driverd.cxx

--- scheduler/cups-driverd.cxx (revision 9862) +++ scheduler/cups-driverd.cxx (working copy) @@ -1525,7 +1525,7 @@ name[512], /* ppd-name / make[128], / ppd-make _/ make_andmodel[128], / ppd-make-and-model */