[Bug 1039484] Re: Accents in sources.list breaks do-release-upgrade
Colin Watson
cjwatson at canonical.com
Thu Sep 27 00:04:34 UTC 2012
entry.comment is str in both Python 2 and Python 3; a reasonable choice
given API constraints, although if you were doing it from scratch you'd
probably make it unicode in Python 2 and str in Python 3 (henceforth
"text"). It's important to distinguish between a byte string that
contains UTF-8-encoded Unicode characters and the Python 2 unicode type.
You can tell the difference by printing it using repr().
The release upgrader sets _() up to be a gettext function that returns
"text". This will work fine in Python 3, but in Python 2 this means
that we need to take a little more care to combine that with
entry.comment. I suggest something like this:
add_comment = " " + _("disabled on upgrade to %s") % self.toDist
if isinstance(entry.comment, bytes):
entry.comment += add_comment.encode("UTF-8")
else:
entry.comment += add_comment
** Package changed: python-apt (Ubuntu Quantal) => ubuntu-release-
upgrader (Ubuntu Quantal)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-apt in Ubuntu.
https://bugs.launchpad.net/bugs/1039484
Title:
Accents in sources.list breaks do-release-upgrade
Status in “ubuntu-release-upgrader” package in Ubuntu:
In Progress
Status in “ubuntu-release-upgrader” source package in Quantal:
In Progress
Bug description:
Description: Ubuntu 12.04.1 LTS
Release: 12.04
update-manager:
Installed: 1:0.156.14.9
In my sources.list I had some lines with an accent ("í" in "Víctor"),
like this one:
deb https://XXXX@private-ppa.launchpad.net/XXX precise main #Personal
access of Víctor R. Ruiz (vrruiz)
Doing an "upgrade-manager -d" and clicking for upgrade to Quantal (do-
release-upgrade), I repeatedly got this error:
WARNING: Failed to read mirror file
Traceback (most recent call last):
File "/tmp/update-manager-ir3uWg/quantal", line 10, in <module>
sys.exit(main())
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeMain.py", line 235, in main
if app.run():
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 1736, in run
return self.fullUpgrade()
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 1638, in fullUpgrade
if not self.updateSourcesList():
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 711, in updateSourcesList
if not self.rewriteSourcesList(mirror_check=True):
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 686, in rewriteSourcesList
entry.comment += " " + _("disabled on upgrade to %s") % self.toDist
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)
Error in sys.excepthook:
Traceback (most recent call last):
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeViewGtk3.py", line 475, in _handleException
apport_crash(type, value, tb)
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeApport.py", line 47, in apport_crash
_apport_append_logfiles(report)
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeApport.py", line 28, in _apport_append_logfiles
report[f.replace(".","").replace("-","")] = (open(f), )
File "/usr/lib/python2.7/dist-packages/problem_report.py", line 509, in __setitem__
assert k.replace('.', '').replace('-', '').replace('_', '').isalnum()
AssertionError
Original exception was:
Traceback (most recent call last):
File "/tmp/update-manager-ir3uWg/quantal", line 10, in <module>
sys.exit(main())
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeMain.py", line 235, in main
if app.run():
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 1736, in run
return self.fullUpgrade()
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 1638, in fullUpgrade
if not self.updateSourcesList():
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 711, in updateSourcesList
if not self.rewriteSourcesList(mirror_check=True):
File "/tmp/update-manager-ir3uWg/DistUpgrade/DistUpgradeController.py", line 686, in rewriteSourcesList
entry.comment += " " + _("disabled on upgrade to %s") % self.toDist
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)
The error was gone when I modified sources.list and replaced the
accent with an ASCII character ("í" -> "i").
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1039484/+subscriptions
More information about the foundations-bugs
mailing list