Describe the bug
ppdc PPD file compiler fails to parse the HWMargins (and possibly other) floating point data when . is used as a separator on a system where locale uses , as a separator, and vice versa.
HWMargins 12.5 12.5 12.5 12.5 in the .drv file would be handled as 0 0 0 0 when ppdc is run with LC_NUMERIC=ru_RU.UTF-8 (comma separator), resulting in incorrect ImageableArea in the final ppd file.
To Reproduce
Use this minimal .drv file:
Manufacturer "Test"
Version "1.0.0"
#include <font.defs>
Font *
HWMargins 12.5 12.5 12.5 12.5
#include <media.defs>
*MediaSize Letter
MediaSize Legal
MediaSize A4
*Resolution k 1 0 0 0 "600dpi/600 DPI"
ModelName "TEST-01"
PCFileName "test01.ppd"
- Run with Russian locale:
LC_NUMERIC=ru_RU.UTF-8 ./ppdc -v -I ../data/ -d ppd-test simple.drv
- Check
ImageableArea:
*ImageableArea Letter/US Letter: "0 0 612 792"
- Run with US locale:
LC_NUMERIC=en_US.UTF-8 ./ppdc -v -I ../data/ -d ppd-test simple.drv
- Check
ImageableArea:
*ImageableArea Letter/US Letter: "12.5 12.5 599.5 779.5"
Expected behavior
ppdc should not be locale-dependent, should give the same result on any locale.
I assume that all .drv files use dot as a separator, so it should be sufficient to force either US or C locale.
System Information:
Tested on CUPS 2.4.2, CUPS 2.4.13, current git master (7765ca9)
Describe the bug
ppdcPPD file compiler fails to parse theHWMargins(and possibly other) floating point data when.is used as a separator on a system where locale uses,as a separator, and vice versa.HWMargins 12.5 12.5 12.5 12.5in the .drv file would be handled as0 0 0 0whenppdcis run withLC_NUMERIC=ru_RU.UTF-8(comma separator), resulting in incorrectImageableAreain the final ppd file.To Reproduce
Use this minimal .drv file:
LC_NUMERIC=ru_RU.UTF-8 ./ppdc -v -I ../data/ -d ppd-test simple.drvImageableArea:*ImageableArea Letter/US Letter: "0 0 612 792"LC_NUMERIC=en_US.UTF-8 ./ppdc -v -I ../data/ -d ppd-test simple.drvImageableArea:*ImageableArea Letter/US Letter: "12.5 12.5 599.5 779.5"Expected behavior
ppdcshould not be locale-dependent, should give the same result on any locale.I assume that all .drv files use dot as a separator, so it should be sufficient to force either US or C locale.
System Information:
Tested on CUPS 2.4.2, CUPS 2.4.13, current git master (7765ca9)