Skip to content

ppdc decimal separator is locale-dependent (dot or comma) #1263

@ValdikSS

Description

@ValdikSS

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"
  1. Run with Russian locale: LC_NUMERIC=ru_RU.UTF-8 ./ppdc -v -I ../data/ -d ppd-test simple.drv
  2. Check ImageableArea:

*ImageableArea Letter/US Letter: "0 0 612 792"

  1. Run with US locale: LC_NUMERIC=en_US.UTF-8 ./ppdc -v -I ../data/ -d ppd-test simple.drv
  2. 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)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions