Incorrect LPSTAT_PATTERN with french locale

Bug #1970589 reported by Jef Mathiot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
Confirmed
Undecided
Unassigned

Bug Description

The `/usr/share/hplip/base/queues.py` Python script uses the `lpstat -v` command to list CUPS printers registered on the system.

The issue is that the lpstat utility, when used with a french locale, adds an extra space in the output before the colon :

```
matériel pour HP_Smart_Tank_Plus_550_series_XXXXXX_ : implicitclass://HP_Smart_Tank_Plus_550_series_XXXXXX_/
matériel pour Smart_Tank_Plus_550 : hp:/net/Smart_Tank_Plus_550_series?ip=XXX.XXX.XXX.XXX
```

Hence the discovery of CUPS printers on french-locale (and possibly other locales as well) systems is completely broken.

Fix (HPLIP 3.22.2 on an Ubuntu 20.04 box):

Replace the line 54 of queues.py with:

```
LPSTAT_PATTERN = re.compile(r"""(\S*)(\s)?: (.*)""", re.IGNORECASE)
```

Changed in hplip:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.