[Bug 15665] gnome-cups-manager creates printers with invalid names

bugzilla-daemon at bugzilla.ubuntu.com bugzilla-daemon at bugzilla.ubuntu.com
Thu Sep 22 10:49:40 UTC 2005


Please do not reply to this email.  You can add comments at
http://bugzilla.ubuntu.com/show_bug.cgi?id=15665
Ubuntu | gnome-cups-manager


ebichete at yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1




------- Additional Comments From ebichete at yahoo.com  2005-09-22 11:49 UTC -------
Okay, I tracked this down to the file
"gnome-cups-manager/gnome-cups-add/add-printer.c".

The problem is in the function "driver_page_next".

Look at the section beginning with the comment "/* strip out the spaces */". 

The 'for' loop correctly removes the spaces from the name but the next chunk of
code (that
searches for an existing printer with the same name) free the string containing
our de-spaced
name if it finds an existing printer with that name.

An appropriate pseudo-patch follows:

<       while (NULL != g_list_find_custom (existing, name,
(GCompareFunc)strcasecmp )) {
<               g_free (name);
<               name = g_strdup_printf ("%s-%d", ppd->model, ++i);
<       }
---
>
>       if (NULL != g_list_find_custom (existing, name, (GCompareFunc)strcasecmp
)) {
>               char * name_prefix = name;
>
>               /* combine name_prefix with numeric suffixes until we find an
unused name */
>               for (;;) { /* FORever */
>                       name = g_strdup_printf ("%s-%d", name_prefix, ++i);
>                       if (NULL != g_list_find_custom (existing, name,
(GCompareFunc)strcasecmp ))
>                               break;
>
>                        g_free(name);
>               }
>       }

Sorry, this is not a proper patch, I don't have a development environment set up
on my box.


-- 
Configure bugmail: http://bugzilla.ubuntu.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.




More information about the desktop-bugs mailing list