Bug 214134

Summary: system-config-printer crashes if bad DeviceURI line
Product: [Fedora] Fedora Reporter: Alvaro Prieto <alvaro>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 0.7.35-1.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-09 17:17:20 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: 207681    

Description Alvaro Prieto 2006-11-06 03:55:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.7) Gecko/20061027 Fedora/1.5.0.7-8.fc6 Firefox/1.5.0.7

Description of problem:
By mistake, I tried adding printer in (ppd?) without it actually being installed. The program crashed halfway through and wouldn't start again.
I ran in console and it came out with these errors:

/usr/share/system-config-printer/system-config-printer.py:130: GtkWarning: Failed to set text from markup due to error parsing markup: Erreur à la ligne 1 caractère 34 : L'élément « p » a été fermé, mais l'élément actuellement ouvert est « b »
  self.xml = gtk.glade.XML(glade_file, domain = domain)

(system-config-printer.py:3337): libgnomevfs-WARNING **: Failed to open session DBUS connection: Unable to determine the address of the message bus (try 'man dbus-launch' and 'man dbus-daemon' for help)
Volume monitoring will not work.
Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 2459, in ?
    main()
  File "/usr/share/system-config-printer/system-config-printer.py", line 2450, in main
    mainwindow = GUI()
  File "/usr/share/system-config-printer/system-config-printer.py", line 310, in __init__
    self.populateList()
  File "/usr/share/system-config-printer/system-config-printer.py", line 389, in populateList
    self.printers = cupshelpers.getPrinters(self.cups)
  File "/usr/share/system-config-printer/cupshelpers.py", line 213, in getPrinters
    printers_conf = PrintersConf(connection)
  File "/usr/share/system-config-printer/cupshelpers.py", line 293, in __init__
    self.parse(self.fetch('/admin/conf/printers.conf'), 'Printer')
  File "/usr/share/system-config-printer/cupshelpers.py", line 321, in parse
    self.device_uris[current_printer] = words[1]
IndexError: list index out of range

Version-Release number of selected component (if applicable):
system-config-printer 0.7.32

How reproducible:
Always


Steps to Reproduce:
1. Run system-config-network (click on new printer)
2. press forward and select "Other"
3. without entering device URI, press forward
4. Select HP printer from database
5. Select OfficeJet 5600, press Forward
6. Press apply

Actual Results:
(system-config-printer.py:3930): libgnomevfs-WARNING **: Failed to open session DBUS connection: Unable to determine the address of the message bus (try 'man dbus-launch' and 'man dbus-daemon' for help)
Volume monitoring will not work.
Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 2459, in ?
    main()
  File "/usr/share/system-config-printer/system-config-printer.py", line 2450, in main
    mainwindow = GUI()
  File "/usr/share/system-config-printer/system-config-printer.py", line 310, in __init__
    self.populateList()
  File "/usr/share/system-config-printer/system-config-printer.py", line 389, in populateList
    self.printers = cupshelpers.getPrinters(self.cups)
  File "/usr/share/system-config-printer/cupshelpers.py", line 213, in getPrinters
    printers_conf = PrintersConf(connection)
  File "/usr/share/system-config-printer/cupshelpers.py", line 293, in __init__
    self.parse(self.fetch('/admin/conf/printers.conf'), 'Printer')
  File "/usr/share/system-config-printer/cupshelpers.py", line 321, in parse
    self.device_uris[current_printer] = words[1]
IndexError: list index out of range


Expected Results:


Additional info:
The main problem is that you can't edit any printers after.
Here's how to fix it:

Go to /etc/cups/ppd/
Delete the printer.ppd file (printer being the name you gave to the printer)

Got to /etc/cups/printers.conf
Delete the <printer> </printer> you added and everything inside. (or just delete the whole file.)

Comment 1 Tim Waugh 2006-11-06 09:56:32 UTC
Thanks for the report!

Fixed in CVS.  The actual problem was that you hadn't added a device URI for the
printer -- it was just blank.  I've fixed the printers.conf parser to handle
that gracefully.

Comment 2 Tim Waugh 2006-11-07 14:09:57 UTC
Please try this test update when it gets pushed to the mirrors:

https://www.redhat.com/archives/fedora-test-list/2006-November/msg00134.html

You will be able to update to this package using:

  yum --enablerepo=updates-testing update 'system-config-printer*'

Comment 3 Fedora Update System 2006-11-09 17:03:46 UTC
Fixed in update: system-config-printer-0.7.35-1.fc6