Bug 625502

Summary: [abrt] system-config-printer-1.2.3-3.fc13: system-config-printer.py:3151:rename_printer:AttributeError: 'NoneType' object has no attribute 'setAccepting'
Product: [Fedora] Fedora Reporter: Ben Liblit <liblit>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: dweb98, enricop, hidoufr, jpopelka, michaelmeskenazi, pingou, simon, theophanis_kontogiannis, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard: abrt_hash:03d0e6a4
Fixed In Version: system-config-printer-1.2.5-6.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 636523 (view as bug list) Environment:
Last Closed: 2010-11-22 22:14:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 636523    
Attachments:
Description Flags
File: backtrace
none
double-renaming none

Description Ben Liblit 2010-08-19 16:24:02 UTC
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'

Comment 1 Ben Liblit 2010-08-19 16:24:04 UTC
Created an attachment (id=439729)
File: backtrace

Comment 4 Jiri Popelka 2010-09-20 10:37:54 UTC
*** Bug 612315 has been marked as a duplicate of this bug. ***

Comment 5 Jiri Popelka 2010-09-20 10:38:03 UTC
*** Bug 635538 has been marked as a duplicate of this bug. ***

Comment 6 Jiri Popelka 2010-09-21 14:31:30 UTC
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.

Comment 7 Jiri Popelka 2010-09-21 14:56:03 UTC
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

Comment 8 Tim Waugh 2010-09-22 10:16:13 UTC
I think A is best.  Let's follow the example of how cupsd behaves.

Comment 10 Tim Waugh 2010-09-22 14:22:50 UTC
There's also the very real possibility of the queue actually being deleted (by another user) in the mean time, so we'll have to deal with that too by checking whether self.printer == None after the call to self.duplicate_printer().

Comment 14 Fedora Update System 2010-10-13 14:47:00 UTC
system-config-printer-1.2.5-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/system-config-printer-1.2.5-1.fc14

Comment 15 Fedora Update System 2010-10-13 14:54:44 UTC
system-config-printer-1.2.5-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/system-config-printer-1.2.5-1.fc13

Comment 16 Fedora Update System 2010-10-14 06:23:59 UTC
system-config-printer-1.2.5-1.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/system-config-printer-1.2.5-1.fc13

Comment 17 Tim Waugh 2010-10-28 12:08:18 UTC
*** Bug 647340 has been marked as a duplicate of this bug. ***

Comment 18 simon 2010-10-31 07:52:21 UTC
Package: system-config-printer-1.2.4-2.fc14
Architecture: x86_64
OS Release: Fedora release 14 (Laughlin)


How to reproduce
-----
1. 
2.
3.


Comment
-----
Attempted to rename a printer putting parenthesis in the name

Comment 19 Tim Waugh 2010-11-05 15:10:30 UTC
*** Bug 650226 has been marked as a duplicate of this bug. ***

Comment 20 Theophanis Kontogiannis 2010-11-06 21:12:43 UTC
Package: system-config-printer-1.2.4-2.fc14
Architecture: x86_64
OS Release: Fedora release 14 (Laughlin)


Comment
-----
Changed the last part of the printer name from _fax to _FAX...

Comment 21 Hamidou Dia 2010-11-11 03:09:52 UTC
Package: system-config-printer-1.2.4-2.fc14
Architecture: i686
OS Release: Fedora release 14 (Laughlin)


How to reproduce
-----
It happened when playing around with the rename button trying to reproduce in the bugzilla ticket that
you Tim forwarded to the Compiz maintainer Adel.

Regards.

Comment 22 Fedora Update System 2010-11-16 23:23:07 UTC
system-config-printer-1.2.5-6.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2010-11-22 22:12:48 UTC
system-config-printer-1.2.5-6.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.