TypeError in python wrapper, caused by swig change

Bug #584997 reported by Mark Ellis
46
This bug affects 6 people
Affects Status Importance Assigned to Milestone
opensync
New
Unknown
opensync (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned

Bug Description

SWIG 1.3.37 introduced, rightly or wrongly, some changes in the way python is handled. This causes a crippling TypeError in python-opensync built with later versions of swig, such as the package in 10.04 lucid. The following patch will fix this problem, it will work ok with any version but is only required in builds on lucid. Please apply, python-opensync is crippled without this.

---
Description: Fix for change in SWIG after 1.3.36
 Upstream 0.2x branch is essentially unmaintained.
Forwarded: no
Author: Mark Ellis <email address hidden>
Last-Update: 2010-05-24

diff -Nurp opensync-0.22.orig/wrapper/opensync.i opensync-0.22/wrapper/opensync.i
--- opensync-0.22.orig/wrapper/opensync.i 2007-03-27 12:49:09.000000000 +0100
+++ opensync-0.22/wrapper/opensync.i 2010-05-21 18:36:46.857447188 +0100
@@ -82,7 +82,7 @@ typedef struct {} OSyncHashTable;
 %extend OSyncChange {
  OSyncChange(PyObject *obj=NULL) {
   OSyncChange *change = NULL;
- if (obj)
+ if ((obj) && (obj != Py_None))
    change = (OSyncChange *)PyCObject_AsVoidPtr(obj);
   else
    change = osync_change_new();

Revision history for this message
Mark Ellis (mark-mpellis) wrote :
tags: added: patch
Revision history for this message
roger3000 (roger3000) wrote :

Hi,

I take the liberty to explain a bit further the how-to circumvent this bug with the above mentioned patch:
1. Download the attached document.
2. Using Lucid, type in Terminal:
cd /usr/share/pyshared
3. Finally type:
patch -Np0 -i /PATH/TO/PATCH/opensync-swig-fix-postbuild.diff

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

To clarify, the first patch is for the source, the second is a hack to an already installed binary package on lucid

Changed in opensync (Ubuntu):
status: New → Confirmed
Revision history for this message
Thomas (t.c) wrote :

It has something to do with that?

http://www.opensync.org/ticket/1131

I hit it, when I was running opensync with msynctool

Traceback (most recent call last):
  File "/usr/lib/opensync/python-plugins/synce-opensync-plugin-2x.py", line 174, in get_changeinfo
    change.uid = array.array('B',guid).tostring()
  File "/usr/lib/pymodules/python2.6/opensync.py", line 192, in set_uid
Received an entry <email address hidden> with data of size 4 from member 2 (evo2-sync). Changetype ADDED
    def set_uid(self, *args): return _opensync.OSyncChange_set_uid(self, *args)
TypeError: in method 'OSyncChange_set_uid', argument 1 of type 'OSyncChange *'

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

Thomas C, that is exactly what it is. Unfortunately, I seem to be unable to comment on the bug in the opensync tracker.

Revision history for this message
Nigel Babu (nigelbabu) wrote :

I've linked up the upstream bug. Could you forward this patch upstream too? Upstream bug tracker seems to have a patch that seems to be working too.

tags: added: patch-needswork
removed: patch
Changed in opensync (Ubuntu):
status: Confirmed → Triaged
Changed in opensync:
status: Unknown → New
Revision history for this message
Mark Ellis (mark-mpellis) wrote :

Upstream is irrelevant, 0.2x branch of opensync is no longer under development, and 0.3x does not use the same construct.

Revision history for this message
Nigel Babu (nigelbabu) wrote :

In that case, this might warrant an SRU to Lucid. Can you take a look at https://wiki.ubuntu.com/StableReleaseUpdates?

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

Aha, I was wondering how to make this happen. Going away, will definitely look into this as soon as I can.

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

This regression makes the opensync python plugin virtually unusable. Any sync that has modifications originating in a python based opensync plugin will result in a TypeError exception and a premature end to the sync. At this point any sync with this sync group becomes impossible.

The problem will not be addressed upstream because development on the 0.2x branch has ended in favour of the, as yet not release ready, 0.3x branch. Fixes to the 0.2x branch will be required at distribution level until 0.3x/0.40 is ready for release. The above patch is suitable in this case.

TEST CASE:
Using a Windows Mobile device and the synce packages, create an opensync sync group containing the synce-opensync-plugin and another opensync plugin, eg. the evolution plugin
$ msynctool --addgroup test
$ msynctool --addmember test evo2-sync
$ msynctool --addmember synce-opensync-plugin
$ msynctool --configure test 1
$ synce-create-partnership test Contacts

Create a new contact on either side, and perform a sync.

$ msynctool --sync test

Modify the contact on the device (the plugin that uses the python wrapper, modifications from the other side work ok), and run another sync.

$ msynctool --sync test

This will fail with a TypeError.

Revision history for this message
Mark Ellis (mark-mpellis) wrote :
Revision history for this message
Mark Ellis (mark-mpellis) wrote :

Uploaded 0.22-4ubuntu0.1 to lucid-proposed

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

subscribed ubuntu-sponsors

Revision history for this message
Martin Pitt (pitti) wrote :

SRU ack

Revision history for this message
Stefano Rivera (stefanor) wrote :

According to previous comments, this doesn't affect maverick

Changed in opensync (Ubuntu):
status: Triaged → Fix Released
Changed in opensync (Ubuntu Lucid):
status: New → Fix Committed
Revision history for this message
Mark Ellis (mark-mpellis) wrote :

Whose comments ?

Maverick has replaced most of the 0.22 branch of opensync with 0.39, which indeed does not use this construct and doesn't have this particular problem.

opensync 0.39 is a development branch that upstream does not consider ready for production release

0.22 is old and imperfect, but works, is a stable release, and has a major regression in an LTS release that this patch fixes.

Changed in opensync (Ubuntu Lucid):
status: Fix Committed → Incomplete
Revision history for this message
Stefano Rivera (stefanor) wrote :

> Whose comments ?

Your own comments, #7. And you just repeated that this doesn't affect maverick.

> has a major regression in an LTS release that this patch fixes

Then why did you mark Lucid as incomplete?

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

My apologies, I misinterpreted that as "it doesn't affect maverick so it must be fixed already". That's what you get from trying to do this while away on holiday :)

Changed in opensync (Ubuntu Lucid):
status: Incomplete → Fix Committed
Revision history for this message
John Dong (jdong) wrote :

ACK from SRU team for the patch in -proposed

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted opensync into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Rolf Leggewie (r0lf) wrote :

I'd like to test to verify the -proposed package but I don't see a Test case. Please provide one.

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

See comment 10

Revision history for this message
Martin Pitt (pitti) wrote :

Any testers of the lucid-proposed package? As this has been in -proposed for nearly half a year, I'll remove the proposed package soon if there is no feedback. Thank you!

Revision history for this message
Mark Ellis (mark-mpellis) wrote :

Well it works great for me, but I guess that's expected :)

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package opensync - 0.22-4ubuntu0.1

---------------
opensync (0.22-4ubuntu0.1) lucid-proposed; urgency=low

  * debian/{control,rules}: add quilt patching
  * debian/patches/python-swig-change.diff: change to python wrapper
    swig source to compensate for SWIG change from 1.3.37, causing a
    python TypeError exception; regression from Karmic (LP: #584997)
 -- Mark Ellis <email address hidden> Thu, 02 Sep 2010 16:53:56 +0200

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.