RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 636523 - Printer queue is deleted when renaming to name which differs only in size of characters
Summary: Printer queue is deleted when renaming to name which differs only in size of ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: system-config-printer
Version: 6.1
Hardware: i686
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Tim Waugh
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On: 625502
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-09-22 13:27 UTC by Jiri Popelka
Modified: 2011-12-06 15:32 UTC (History)
4 users (show)

Fixed In Version: system-config-printer-1.1.16-18.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 625502
Environment:
Last Closed: 2011-12-06 15:32:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1638 0 normal SHIPPED_LIVE system-config-printer bug fix update 2011-12-06 00:50:40 UTC

Description Jiri Popelka 2010-09-22 13:27:16 UTC
+++ This bug was initially created as a clone of Bug #625502 +++

abrt version: 1.1.13
architecture: i686
cmdline: python /usr/share/system-config-printer/system-config-printer.py
component: system-config-printer
executable: /usr/share/system-config-printer/system-config-printer.py
kernel: 2.6.33.6-147.2.4.fc13.i686
package: system-config-printer-1.2.3-3.fc13
reason: system-config-printer.py:3151:rename_printer:AttributeError: 'NoneType' object has no attribute 'setAccepting'
release: Fedora release 13 (Goddard)
time: 1282235009
uid: 500

backtrace
-----
system-config-printer.py:3151:rename_printer:AttributeError: 'NoneType' object has no attribute 'setAccepting'

Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 3085, in printer_name_edited
    self.rename_printer (name, newname)
  File "/usr/share/system-config-printer/system-config-printer.py", line 3151, in rename_printer
    self.printer.setAccepting (True)
AttributeError: 'NoneType' object has no attribute 'setAccepting'

Local variables in innermost frame:
new_name: 'c6'
self: <__main__.GUI instance at 0x8867bcc>
rejecting: False
old_name: u'C6'

--- Additional comment from liblit on 2010-08-19 18:24:04 CEST ---

Created an attachment (id=439729)
File: backtrace

--- Additional comment from jpopelka on 2010-08-20 13:36:00 CEST ---

Not sure how this could happen. 

The code preceding the crash is:

        rejecting = self.printer.rejecting
        if not rejecting:
            try:
                self.printer.setAccepting (False)
                if not self.is_rename_possible (old_name):
                    [...]
                    return
            except cups.IPPError, (e, msg):
                [...]
                return

        if self.duplicate_printer (new_name):
            [...]
            return

        # Restore rejecting state.
        if not rejecting:
            try:
                self.printer.setAccepting (True)  <- here the self.printer suddenly has None value.

The only possibility is that self.duplicate_printer() changed the self.printer value to None. But investigating the self.duplicate_printer() it doesn't look so.
NEEDS MORE DIGGING.

--- Additional comment from twaugh on 2010-08-20 14:00:35 CEST ---

I think it must be this:

During save_printer, we fall into the "printer was deleted in the mean time" part and so call populateList().  At the end of that function we have:

        if (self.printer != None and
            self.printer.name not in self.printers.keys ()):
            # The printer we're editing has been deleted.
            self.PrinterPropertiesDialog.response (gtk.RESPONSE_CANCEL)

...which does this:

        if ((response == gtk.RESPONSE_OK and not failed) or
            response == gtk.RESPONSE_CANCEL):
            self.printer = None
            dialog.hide ()

--- Additional comment from jpopelka on 2010-09-21 16:31:30 CEST ---

Steps to reproduce:
1) rename printer queue where the new name differs
    only in size (lower/upper case) of some characters.
    E.g. C6 -> c6 (comment #0)

When s-c-p renames queue, it first makes a new one with the new name,
copies attributes and deletes the old one.
Problem is that CUPS-Add-Modify-Printer operation is case-insensitive in sense
that when it discovers that adding printer already exists (ignoring case) it modifies the existing one.
For looking up/comparing strcasecmp() is used, see. scheduler/printers.c:compare_printers().

In our case it means that when s-c-p tries to add a new printer in save_printer(), there's actually no adding
happening because there's already one with the same name (ignoring case) existing.
And at the end of save_printer() we discover that the printer with new name (case sensitive) doesn't exist
and populateList() does self.printer=None.

--- Additional comment from jpopelka on 2010-09-21 16:56:03 CEST ---

Created attachment 448714 [details]
double-renaming

Possibilities
A) Do not rename when the new name differs only in size
   (lower/upper case) of some characters.
    def rename_printer (self, old_name, new_name):
-        if old_name == new_name:
+        if old_name.lower() == new_name.lower():
            return

B) Double-rename (old_name->random_name, random_name->new_name)
   (see attached patch)

C) Some dialog with warning

--- Additional comment from twaugh on 2010-09-22 12:16:13 CEST ---

I think A is best.  Let's follow the example of how cupsd behaves.

--- Additional comment from jpopelka on 2010-09-22 15:10:37 CEST ---

http://git.fedorahosted.org/git/?p=system-config-printer.git;a=commitdiff;h=332fdc86be253a3b91720f64685ed2507b308184

Comment 2 Suzanne Logcher 2011-02-15 21:43:06 UTC
This issue was proposed for RHEL 6.1 FasTrack but did not get resolved in time.
It has been moved to RHEL 6.2 FasTrack.

Comment 9 errata-xmlrpc 2011-12-06 15:32:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1638.html


Note You need to log in before you can comment on or make changes to this bug.