Merge lp:~xnox/ubuntuone-client/fix-apport into lp:ubuntuone-client

Proposed by Dimitri John Ledkov
Status: Rejected
Rejected by: dobey
Proposed branch: lp:~xnox/ubuntuone-client/fix-apport
Merge into: lp:ubuntuone-client
Diff against target: 14 lines (+4/-0)
1 file modified
data/source_ubuntuone-client.py (+4/-0)
To merge this branch: bzr merge lp:~xnox/ubuntuone-client/fix-apport
Reviewer Review Type Date Requested Status
dobey (community) Disapprove
Ubuntu One hackers Pending
Review via email: mp+145754@code.launchpad.net

Commit message

- Make apport hook python 2 and 3 compatible. (LP: #1098128)

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

This needs to go into 4-2 and 4-0 stable branches & there also an associated packaging change needed, as the binary package that ships this hook needs to depend on python3-dirspec.

Please note that apport in quantal & raring is running package hooks using python3.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
dobey (dobey) wrote :

What is this specific change supposed to accomplish exactly?

Is there an API change in the newer apports that requires attach_file_if_exists() arguments to not be bytes now?

review: Needs Information
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Apport in quantal and running runs as python3.
First the approt hook fails with dirspec import error, as python3-dirspec is not installed.
In python3, dirspec returns bytes and os.path.join doesn't allow mixing bytes and strings in path components.

$ python3 -c "import os; os.path.join(b'somebytes', 'somestring')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.3/posixpath.py", line 92, in join
    "components.") from None
TypeError: Can't mix strings and bytes in path components.

This is to fix apport hook, cause currently apport hook fails in Quantal & Raring. Thus no bug reports filed from quantal/raring have any data that is meant to be collected by this hook.

Revision history for this message
dobey (dobey) wrote :

I don't think this is the right way to fix this then. Paths should always be bytes, unless being converted for display.

review: Disapprove

Unmerged revisions

1382. By Dimitri John Ledkov

Make apport hook python 2 and 3 compatible.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/source_ubuntuone-client.py'
2--- data/source_ubuntuone-client.py 2012-06-21 19:19:44 +0000
3+++ data/source_ubuntuone-client.py 2013-01-31 00:16:21 +0000
4@@ -35,6 +35,10 @@
5 import os.path
6 from dirspec.basedir import xdg_cache_home, xdg_config_home
7
8+if not isinstance(xdg_cache_home, str):
9+ xdg_cache_home = xdg_cache_home.decode('utf-8')
10+ xdg_config_home = xdg_config_home.decode('utf-8')
11+
12 # Paths where things we might want live
13 u1_log_path = os.path.join(xdg_cache_home, "ubuntuone", "log")
14 u1_user_config_path = os.path.join(xdg_config_home, "ubuntuone")

Subscribers

People subscribed via source and target branches