[Bug 1120322] Re: update-manager crashed with UnboundLocalError in show_diff(): local variable 'line_number' referenced before assignment
Barry Warsaw
1120322 at bugs.launchpad.net
Thu Feb 28 20:03:52 UTC 2013
The odd part is that I'm not sure how to get difflib to produce a diff that
doesn't start with the three lines:
--- blah
+++ blah
@@ blah
to trigger the bug. This is clearly unexpected in the code (hence the
UnboundLocalError in the first place) and it it definitely not covered in the
test suite. Hand crafting a call such as this does not trigger the bug:
$ PYTHONPATH=. python3
>>> from aptdaemon.gtk3widgets import DiffView
>>> dv = DiffView()
>>> dv.show_diff('/etc/passwd', '/etc/group')
Without a test, a fix is mostly just conjecture. I think the best thing
to do is to set `line_number = 0` outside the loop. This might give you
nonsense but it'll avoid a crash. I thought about setting it to None
outside the loop, but then the += will still crash, just with a
different one (perhaps we should force that and output some debugging to
better see what's happening, but otoh is it worth it?)
I will attach a branch momentarily.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to aptdaemon in Ubuntu.
https://bugs.launchpad.net/bugs/1120322
Title:
update-manager crashed with UnboundLocalError in show_diff(): local
variable 'line_number' referenced before assignment
Status in Aptdaemon:
Confirmed
Status in “aptdaemon” package in Ubuntu:
Triaged
Status in “aptdaemon” source package in Precise:
Triaged
Bug description:
At the same time as the crash appeared, I got a box for Keep/Renew Steam config file.
I was however no able to click on either Keep/Renew.
ProblemType: Crash
DistroRelease: Ubuntu 13.04
Package: update-manager 1:0.181
ProcVersionSignature: Ubuntu 3.8.0-4.8-generic 3.8.0-rc6
Uname: Linux 3.8.0-4-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.8-0ubuntu4
Architecture: amd64
Date: Sat Feb 9 14:05:09 2013
ExecutablePath: /usr/bin/update-manager
GsettingsChanges:
b'com.ubuntu.update-manager' b'first-run' b'false'
b'com.ubuntu.update-manager' b'launch-time' b'1360363834'
b'com.ubuntu.update-manager' b'show-details' b'true'
b'com.ubuntu.update-manager' b'window-height' b'625'
b'com.ubuntu.update-manager' b'window-width' b'591'
InstallationDate: Installed on 2012-08-22 (170 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
InterpreterPath: /usr/bin/python3.3
MarkForUpload: True
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/bin/update-manager
ProcEnviron:
LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:en
PATH=(custom, no user)
XDG_RUNTIME_DIR=<set>
LANG=nb_NO.UTF-8
SHELL=/bin/bash
PythonArgs: ['/usr/bin/update-manager']
SourcePackage: update-manager
Title: update-manager crashed with UnboundLocalError in show_diff(): local variable 'line_number' referenced before assignment
UpgradeStatus: Upgraded to raring on 2013-01-22 (18 days ago)
UserGroups: adm cdrom dialout dip lpadmin plugdev sambashare sudo tty
To manage notifications about this bug go to:
https://bugs.launchpad.net/aptdaemon/+bug/1120322/+subscriptions
More information about the foundations-bugs
mailing list