crashed with UnboundLocalError in fetch_jobs(): local variable 'jobid' referenced before assignment

Bug #721051 reported by lent on 2011-02-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)

Bug Description

Binary package hint: system-config-printer

Crash after connecting to server running cups 1.1.23

lent@cups ~ $ cups-config --version

and then selecting a printer, pressing Control-F, selecting another printer, pressing Control-F, (repeat six times)...

The system had NOT been rebooted and I had run "apt-get -y update;apt-get -y upgrade" before starting the X-window session.

ProblemType: Crash
DistroRelease: Ubuntu 11.04
Package: system-config-printer-gnome 1.3.1+20110217-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-1.28-generic 2.6.38-rc2
Uname: Linux 2.6.38-1-generic i686
Architecture: i386
CupsErrorLog: Error: [Errno 13] Permission denied: '/var/log/cups/error_log'
Date: Thu Feb 17 20:45:29 2011
ExecutablePath: /usr/share/system-config-printer/
InstallationMedia: Ubuntu-Netbook-Remix 9.10 "Karmic Koala" - Release i386 (20091028.4)
InterpreterPath: /usr/bin/python2.7
Lpstat: Error: command ['lpstat', '-v'] failed with exit code 1: lpstat: No destinations added.
MachineType: ASUSTeK Computer INC. 1005HA
PackageArchitecture: all
Papersize: letter
ProcCmdline: /usr/bin/python /usr/share/system-config-printer/
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.38-1-generic root=UUID=cf74d3f3-d8d8-4c5c-b59d-b6be12838571 ro crashkernel=384M-2G:64M,2G-:128M
PythonArgs: ['/usr/share/system-config-printer/']
SourcePackage: system-config-printer
Title: crashed with UnboundLocalError in fetch_jobs(): local variable 'jobid' referenced before assignment
 Traceback (most recent call last):
   File "/usr/share/system-config-printer/", line 695, in fetch_jobs
     next = jobid + 1
 UnboundLocalError: local variable 'jobid' referenced before assignment
UserGroups: 02/26/2010
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 1401
dmi.board.asset.tag: To Be Filled By O.E.M. 1005HA
dmi.board.vendor: ASUSTeK Computer INC.
dmi.board.version: x.xx
dmi.chassis.asset.tag: 0x00000000
dmi.chassis.type: 10
dmi.chassis.vendor: ASUSTeK Computer INC.
dmi.chassis.version: x.x
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr1401:bd02/26/2010:svnASUSTeKComputerINC.:pn1005HA:pvrx.x:rvnASUSTeKComputerINC.:rn1005HA:rvrx.xx:cvnASUSTeKComputerINC.:ct10:cvrx.x: 1005HA
dmi.product.version: x.x
dmi.sys.vendor: ASUSTeK Computer INC.

lent (lent) wrote :
tags: removed: need-duplicate-check
lent (lent) wrote :

This is the same little netbook that Bug #711497 occurred on. :-)

Attaching current "/etc/init/cups.conf".

lent (lent) wrote :

As per Clint Byrum in the other bug, here is bash -vx of the requested commands.

visibility: private → public
Tim Waugh (twaugh) wrote :

The only way this could happen is if we don't enter this loop:

        for jobid in xrange (self.fetch_first_job_id, last_jobid + 1):

and the only way I can see of that happening is that last_jobid < self.fetch_first_job_id.

But the only way I can see that happening is if CUPS returned a job with a lower ID than we asked for, which is incorrect. I'll put in a check for this so that system-config-printer is defensive against it, but it sounds like a CUPS bug to me.

Committed as 83fb5dcafe72bf8a76ded30c268477af48a406bb.

Till Kamppeter (till-kamppeter) wrote :

Tim, I cannot find the commit which you referenced in the "master" branch. Can you attach the patch? Thanks. Or did you forget to "git push"?

Tim Waugh (twaugh) wrote :

It's in 1.2.x, just hadn't been merged yet. I've done that now.

Till Kamppeter (till-kamppeter) wrote :

Thanks, I got it now.

Changed in system-config-printer (Ubuntu):
status: New → In Progress
Changed in system-config-printer (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.3.1+20110222-0ubuntu12

system-config-printer (1.3.1+20110222-0ubuntu12) natty; urgency=low

  * debian/patches/50_avoid-traceback-when-cancelling-new-printer-dialog-after-failure.patch:
    Avoid traceback when cancelling New Printer dialog after failure.
  * debian/patches/47_monitor-py-off-by-one-error.patch: Fixed off-by-one error
    in monitor (probably also needed to fix LP: #721051).
  * debian/patches/45_monitor-py-be-defensive-on-wrong-job-ids-from-cups.patch:
    Be defensive against CUPS returning incorrect job IDs (LP: #721051).
 -- Till Kamppeter <email address hidden> Mon, 28 Mar 2011 18:11:00 +0100

Changed in system-config-printer (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers