Processed: Re: Bug#588348: offlineimap: Looses mails if PYTHONOPTIMIZE is set

2010-07-11 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

> tags 588348 + patch
Bug #588348 [offlineimap] offlineimap: Looses mails if PYTHONOPTIMIZE is set
Added tag(s) patch.
> thanks
Stopping processing here.

Please contact me if you need assistance.
-- 
588348: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588348
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


-- 
To UNSUBSCRIBE, email to debian-qa-packages-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.127887524413496.transcr...@bugs.debian.org



Bug#588348: offlineimap: Looses mails if PYTHONOPTIMIZE is set

2010-07-11 Thread Jakub Wilk

tags 588348 + patch
thanks

* Sascha Silbe , 
2010-07-07, 12:17:

offlineimap calls critical code paths only via assert.


I attach an ugly, untested work-around for this bug.

--
Jakub Wilk
diff -Nru offlineimap-6.2.0.2/bin/offlineimap offlineimap-6.2.0.3/bin/offlineimap
--- offlineimap-6.2.0.2/bin/offlineimap	2009-08-12 22:25:27.0 +0200
+++ offlineimap-6.2.0.3/bin/offlineimap	2010-07-11 19:14:21.0 +0200
@@ -17,5 +17,16 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
+import os
+import sys
+
+try:
+assert 0
+except AssertionError:
+pass
+else:
+os.putenv('PYTHONOPTIMIZE', '')
+os.execv('/usr/bin/python', ['python'] + sys.argv)
+
 from offlineimap import init
 init.startup('6.2.0')
diff -Nru offlineimap-6.2.0.2/offlineimap.py offlineimap-6.2.0.3/offlineimap.py
--- offlineimap-6.2.0.2/offlineimap.py	2009-08-12 22:25:27.0 +0200
+++ offlineimap-6.2.0.3/offlineimap.py	2010-07-11 19:14:23.0 +0200
@@ -17,5 +17,16 @@
 #along with this program; if not, write to the Free Software
 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+import os
+import sys
+
+try:
+assert 0
+except AssertionError:
+pass
+else:
+os.putenv('PYTHONOPTIMIZE', '')
+os.execv('/usr/bin/python', ['python'] + sys.argv)
+
 from offlineimap import init
 init.startup('6.2.0')


signature.asc
Description: Digital signature


Bug#588348: offlineimap: Looses mails if PYTHONOPTIMIZE is set

2010-07-07 Thread Sascha Silbe
Package: offlineimap
Version: 6.2.0.2
Severity: critical
Justification: causes serious data loss


offlineimap calls critical code paths only via assert.
If PYTHONOPTIMIZE is set, python will - besides other optimisations - ignore 
all assert statements.
In combination, this caused my entire "sent" folder to get lost as I tried to 
sync it with a courier-imap server (on which the folder had just been created).

I had reported a similar issue in 2008 (Bug #80: improper use of assert 
statement), though at that time it just duplicated mails instead of loosing 
them.

(Python) upstream considers assert a mere debugging tool. See e.g. "Language 
Reference" section 6.3, first paragraph:

> Assert statements are a convenient way to insert debugging assertions into a 
> program:

The same section also explains that enabling optimization will cause assert 
statements not to be evaluated.

Thus this is definitely a bug in offlineimap. assert should not be used to 
invoke regular code paths.


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.31.6-xo1.5-2-00377-g7f5e423 (PREEMPT)
Locale: LANG=en_US, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages offlineimap depends on:
ii  python2.6.5-5An interactive high-level object-o
ii  python-support1.0.8  automated rebuilding support for P

offlineimap recommends no packages.

Versions of packages offlineimap suggests:
pn  python-kerberos(no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-qa-packages-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20100707121724.3733.81230.report...@xo15-sascha.sascha.silbe.org