Bug#696241: gnome-control-center fails to add printer, says "HP-Color-LaserJet-CP1515n" is not a valid printer name.

Kjö Hansi Glaz kjo at a4nancy.net.eu.org
Fri Jan 11 19:19:24 UTC 2013


forcemerge 696241 695131 
reassign 696241 cups-pk-helper 0.2.3-2
thanks

Hi,

> gnome-control-center fails to add my network printer. After finishing
> the configuration wizard, I'm getting the following error message (see
> also the attached screenshot):
> 
> 	Failed to add new printer.
> 
> Here's the relevant part of the ~/.xsession-errors file: [...]
> 
> 	(gnome-control-center:16609): printers-cc-panel-WARNING **: "HP-Color-LaserJet-CP1515n" is not a valid printer name.

I found that the message "\"%s\" is not a valid printer name." comes
from the cups-pk-helper function _cph_cups_is_printer_name_valid
(cups-pk-helper-0.2.3/src/cups.c:397).

The printer name is validated by the function
_cph_cups_is_printer_name_valid_internal
(cups-pk-helper-0.2.3/src/cups.c:327), which doesn't allow dash.

However, printers added through the CUPS web interface or
system-config-printer have dash in their default names. The function
refuses names that cups actually allows.

I build a cups-pk-helper package with the following patch applied and it
fixes the bugs I experienced:

--- cups-pk-helper-0.2.3.orig/src/cups.c
+++ cups-pk-helper-0.2.3/src/cups.c
@@ -347,7 +347,7 @@ _cph_cups_is_printer_name_valid_internal
                 return FALSE;
 
         for (i = 0; i < len; i++) {
-                if (!g_ascii_isalnum (name[i]) && name[i] != '_')
+                if (!g_ascii_isalnum (name[i]) && name[i] != '_' && name[i] != '-')
                         return FALSE;
         }

Cheers,

Kjö



More information about the pkg-gnome-maintainers mailing list