Merge lp:~brunonova/software-properties/lp1381050_2 into lp:software-properties
| Status: | Needs review |
|---|---|
| Proposed branch: | lp:~brunonova/software-properties/lp1381050_2 |
| Merge into: | lp:software-properties |
| Diff against target: |
16 lines (+3/-2) 1 file modified
softwareproperties/SoftwareProperties.py (+3/-2) |
| To merge this branch: | bzr merge lp:~brunonova/software-properties/lp1381050_2 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Brian Murray | 2015-07-13 | Needs Fixing on 2015-09-02 | |
| Michael Vogt | 2015-08-12 | Pending | |
|
Review via email:
|
|||
Description of the Change
This should fix LP: #1381050.
This change was already proposed and accepted (https:/
As mentioned in my last comment in the bug report, I think that the software-
This patch forces the path to be handled in UTF-8, fixing the bug (tested).
Michael Vogt reviewed the other merge requests, so he's free to review this one as well. :)
| Bruno Nova (brunonova) wrote : | # |
I just booted the Wily Daily Live ISO, patched the system SoftwarePropert
It worked! The key was added successfully.
Why didn't it work for you? 'path.encode(
Did you test this on a system without UTF-8 support?
Any ideas?
I think the code of the method should be all inside of the try...except method, so that the method always returns and the GUI can show an error message, instead of failing silently. The 'except' block should also print the stack trace.
This won't fix the bug, but is an improvement I think.
| Brian Murray (brian-murray) wrote : | # |
Sorry, for the delay in response. I tried as you've suggested booting a Wily Daily Live ISO and and patched /usr/lib/
I did boot with English (US). Are you booting with a different language?
| Bruno Nova (brunonova) wrote : | # |
Yes, I'm booting in Portuguese.
I'm running out of ideas.
Is any UTF-8 locale available in English by default? It probably is.
We'll probably need someone who understands more about this Python filename encoding/decoding stuff.
| Bruno Nova (brunonova) wrote : | # |
@Brian, I now booted the daily live ISO in English, applied the patch, and tried adding a key with an accented character, and it worked. No error occurred.
What's going on here? What am I doing different from you? :S
- 939. By Bruno Nova on 2015-09-29
-
Ensure that True/False is returned in add_key method in SoftwarePropert
ies.py
| Bruno Nova (brunonova) wrote : | # |
I've added a commit.
The "try:" line was moved to the top, putting the entire body of the method inside of a try...except block.
That way, when this encoding exception is raised, the GUI will report an error (it wasn't doing this).
Though it will also probably suppress exception tracebacks in the console/log.
I did nothing to try to fix the error that Brian reported, and I don't think I can fix it.
But it works for me at least! So, if someone else other than me confirms that this fix works for them, maybe the fix should be accepted (and a new bug opened for that error)?
A partial fix is better than no fix (usually), and I don't think there is regression potential. Except maybe if the system has no UTF-8 support and locales (can that happen?).
Unmerged revisions
- 939. By Bruno Nova on 2015-09-29
-
Ensure that True/False is returned in add_key method in SoftwarePropert
ies.py - 938. By Bruno Nova on 2015-07-13
-
Actually fix LP: #1381050

I've tested the change provided in Wily and it doesn't seem to fix the Traceback for me. Here is a result of trying import the key from the related bug report:
ipdb> n .DBusException: org.freedesktop .DBus.Python. UnicodeEncodeEr ror: Traceback (most recent call last): python3/ dist-packages/ dbus/service. py", line 707, in _message_cb method( self, *args, **keywords) python3/ dist-packages/ softwarepropert ies/dbus/ SoftwarePropert iesDBus. py", line 288, in AddKey python3/ dist-packages/ softwarepropert ies/SoftwarePro perties. py", line 804, in add_key "utf-8" ) python3. 4/genericpath. py", line 19, in exists
dbus.exceptions
File "/usr/lib/
retval = candidate_
File "/usr/lib/
return self.add_key(path)
File "/usr/lib/
path = path.encode(
File "/usr/lib/
os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xed' in position 58: ordinal not in range(128)