python2.3-sqlite: on importing sqlite from python, the script dies from a Segmentation fault

Bug #7539 reported by Debian Bug Importer
4
Affects Status Importance Assigned to Milestone
python-sqlite (Debian)
Fix Released
Unknown
python-sqlite (Ubuntu)
Invalid
High
Unassigned

Bug Description

Automatically imported from Debian bug report #267082 http://bugs.debian.org/267082

Revision history for this message
In , Joel Rosdahl (jrosdahl) wrote : Re: Bug#267082: python2.3-sqlite: on importing sqlite from python, the script dies from a Segmentation fault

Hi,

Thanks for the report.

alexs <email address hidden> writes:

> on importing SQLite module in python the program dies from a
> Segmentation fault. strace suggest it may be to do with the math
> module, but the math module by itself load fine.
>
> the minimum script for it to break is
>
> #!/usr/bin/python
> import sqlite

I can't reproduce this.

However, I recognize the error; I've seen it before. It happened when
I was packaging the newest version (2.0.5) of python-egenix-*. After
installing the new packages, python-sqlite segfaulted exactly like it
did for you. After removing python2.3-egenix-mxdatetime, it started
working again, so it seems to be connected to PySQLite's use of
mxDateTime. But I was able to work around the problem (without knowing
the exact cause of it) in python-egenix-*, so the 2.0.5-1 packages
seem to work OK.

Here is a demo build of python2.3-egenix-mx{tools,datetime} that makes
python-sqlite crash in the above mentioned way:

    http://joel.rosdahl.net/tmp/python2.3-egenix-mxtools_2.0.5-1+segfaultdemo_i386.deb
    http://joel.rosdahl.net/tmp/python2.3-egenix-mxdatetime_2.0.5-1+segfaultdemo_i386.deb

So: Do you by any chance have python2.3-egenix-mxdatetime installed,
and if so, what version? Or a local build of it?

Does the sqlite module start working again if you apply the following
patch?

======================================================================
--- /usr/lib/python2.3/site-packages/sqlite/main.py~ 2004-07-04 00:24:18.000000000 +0200
+++ /usr/lib/python2.3/site-packages/sqlite/main.py 2004-08-20 19:31:51.000000000 +0200
@@ -4,11 +4,12 @@
 import copy, new, sys, weakref
 from types import *

-try:
- from mx import DateTime
- have_datetime = 1
-except ImportError:
- have_datetime = 0
+#try:
+# from mx import DateTime
+# have_datetime = 1
+#except ImportError:
+# have_datetime = 0
+have_datetime = 0

 if have_datetime:
     # Make the required Date/Time constructor visable in the PySQLite module.
======================================================================

        Joel

--
Joel Rosdahl <email address hidden>
Key BB845E97; fingerprint 9F4B D780 6EF4 5700 778D 8B22 0064 F9FF BB84 5E97

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Automatically imported from Debian bug report #267082 http://bugs.debian.org/267082

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <20040820153658.9FEC3508F98D@localhost>
Date: Fri, 20 Aug 2004 16:36:58 +0100
From: alexs <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: python2.3-sqlite: on importing sqlite from python, the script dies from a Segmentation fault

Package: python2.3-sqlite
Version: 0.5.1-1
Severity: critical
Justification: breaks unrelated software

on importing SQLite module in python the program dies from a Segmentation
fault. strace suggest it may be to do with the math module, but the math
module by itself load fine.

the minimum script for it to break is

#!/usr/bin/python
import sqlite

the last couple of line in the strace are,

stat64("/usr/lib/python2.3/lib-tk/math", 0xbfffa760) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.3/lib-tk/math.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.3/lib-tk/mathmodule.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.3/lib-tk/math.py", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.3/lib-tk/math.pyc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/python2.3/lib-dynload/math", 0xbfffa760) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.3/lib-dynload/math.so", O_RDONLY|O_LARGEFILE) = 7
fstat64(7, {st_mode=S_IFREG|0644, st_size=16368, ...}) = 0
open("/usr/lib/python2.3/lib-dynload/math.so", O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\21"..., 512) = 512
fstat64(8, {st_mode=S_IFREG|0644, st_size=16368, ...}) = 0
old_mmap(NULL, 15332, PROT_READ|PROT_EXEC, MAP_PRIVATE, 8, 0) = 0x40297000
old_mmap(0x4029a000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 8, 0x3000) = 0x4029a000
close(8) = 0
close(7) = 0
gettimeofday({1093015779, 680336}, NULL) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (1000, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-lock
Locale: LANG=C, LC_CTYPE=C

Versions of packages python2.3-sqlite depends on:
ii libc6 2.3.2.ds1-13 GNU C Library: Shared libraries an
ii libsqlite0 2.8.13-3 SQLite shared library
ii python2.3 2.3.4-5 An interactive high-level object-o

-- no debconf information

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Fri, 20 Aug 2004 19:35:00 +0200
From: Joel Rosdahl <email address hidden>
To: alexs <email address hidden>
Cc: <email address hidden>
Subject: Re: Bug#267082: python2.3-sqlite: on importing sqlite from python,
 the script dies from a Segmentation fault

Hi,

Thanks for the report.

alexs <email address hidden> writes:

> on importing SQLite module in python the program dies from a
> Segmentation fault. strace suggest it may be to do with the math
> module, but the math module by itself load fine.
>
> the minimum script for it to break is
>
> #!/usr/bin/python
> import sqlite

I can't reproduce this.

However, I recognize the error; I've seen it before. It happened when
I was packaging the newest version (2.0.5) of python-egenix-*. After
installing the new packages, python-sqlite segfaulted exactly like it
did for you. After removing python2.3-egenix-mxdatetime, it started
working again, so it seems to be connected to PySQLite's use of
mxDateTime. But I was able to work around the problem (without knowing
the exact cause of it) in python-egenix-*, so the 2.0.5-1 packages
seem to work OK.

Here is a demo build of python2.3-egenix-mx{tools,datetime} that makes
python-sqlite crash in the above mentioned way:

    http://joel.rosdahl.net/tmp/python2.3-egenix-mxtools_2.0.5-1+segfaultdemo_i386.deb
    http://joel.rosdahl.net/tmp/python2.3-egenix-mxdatetime_2.0.5-1+segfaultdemo_i386.deb

So: Do you by any chance have python2.3-egenix-mxdatetime installed,
and if so, what version? Or a local build of it?

Does the sqlite module start working again if you apply the following
patch?

======================================================================
--- /usr/lib/python2.3/site-packages/sqlite/main.py~ 2004-07-04 00:24:18.000000000 +0200
+++ /usr/lib/python2.3/site-packages/sqlite/main.py 2004-08-20 19:31:51.000000000 +0200
@@ -4,11 +4,12 @@
 import copy, new, sys, weakref
 from types import *

-try:
- from mx import DateTime
- have_datetime = 1
-except ImportError:
- have_datetime = 0
+#try:
+# from mx import DateTime
+# have_datetime = 1
+#except ImportError:
+# have_datetime = 0
+have_datetime = 0

 if have_datetime:
     # Make the required Date/Time constructor visable in the PySQLite module.
======================================================================

        Joel

--
Joel Rosdahl <email address hidden>
Key BB845E97; fingerprint 9F4B D780 6EF4 5700 778D 8B22 0064 F9FF BB84 5E97

Revision history for this message
In , Joel Rosdahl (jrosdahl) wrote :

Alex Sayle <email address hidden> writes:

> I got rid of my local install of egenix-mx and sqlite now works
> fine, I then install python2.3-egenix-mxdatetime and
> python2.3-egenix-tools and sqlite is still working. It must of been
> something to do with my local build of egenix-mx.
>
> Thanks for your help

Great! Closing the bug.

        Joel

--
Joel Rosdahl <email address hidden>
Key BB845E97; fingerprint 9F4B D780 6EF4 5700 778D 8B22 0064 F9FF BB84 5E97

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Mon, 23 Aug 2004 15:21:01 +0200
From: Joel Rosdahl <email address hidden>
To: Alex Sayle <email address hidden>
Cc: <email address hidden>
Subject: Re: Bug#267082: python2.3-sqlite: on importing sqlite from python,
 the script dies from a Segmentation fault

Alex Sayle <email address hidden> writes:

> I got rid of my local install of egenix-mx and sqlite now works
> fine, I then install python2.3-egenix-mxdatetime and
> python2.3-egenix-tools and sqlite is still working. It must of been
> something to do with my local build of egenix-mx.
>
> Thanks for your help

Great! Closing the bug.

        Joel

--
Joel Rosdahl <email address hidden>
Key BB845E97; fingerprint 9F4B D780 6EF4 5700 778D 8B22 0064 F9FF BB84 5E97

Revision history for this message
Matt Zimmerman (mdz) wrote :

Seems to work fine with the versions in Warty

Setting up python-egenix-mxdatetime (2.0.5-1) ...
root@mizar:/# python
Python 2.3.4 (#2, Aug 13 2004, 00:36:58)
[GCC 3.3.4 (Debian 1:3.3.4-5ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite
>>>

Changed in python-sqlite:
status: Unknown → 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.