diff options
author | Kirill Smelkov <kirr@mns.spb.ru> | 2010-09-19 13:53:21 +0400 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-09-19 09:31:20 -0700 |
commit | 277a1b229cf1b456560a50d021e2eaf2158e5134 (patch) | |
tree | 1098dfcb844e84aee2eb4d12f0a9d6ede88f5d4b /lib/tdb/python | |
parent | c4b1971259638875317aa991b6a119b668ac03a8 (diff) | |
download | samba-277a1b229cf1b456560a50d021e2eaf2158e5134.tar.gz samba-277a1b229cf1b456560a50d021e2eaf2158e5134.tar.bz2 samba-277a1b229cf1b456560a50d021e2eaf2158e5134.zip |
pytdb: Fix repr segfault for internal db
The problem was tdb->name is NULL for TDB_INTERNAL databases, and
so it was crashing ...
#0 0xb76944f3 in strlen () from /lib/i686/cmov/libc.so.6
#1 0x0809862b in PyString_FromFormatV (format=0xb72b6a26 "Tdb('%s')", vargs=0xbfc26a94 "")
at ../Objects/stringobject.c:211
#2 0x08098888 in PyString_FromFormat (format=0xb72b6a26 "Tdb('%s')") at ../Objects/stringobject.c:358
#3 0xb72b65f2 in tdb_object_repr (self=0xb759e060) at ./pytdb.c:439
Cc: 597089@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'lib/tdb/python')
-rw-r--r-- | lib/tdb/python/tests/simple.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py index 5db824753b..258a486f91 100644 --- a/lib/tdb/python/tests/simple.py +++ b/lib/tdb/python/tests/simple.py @@ -28,6 +28,14 @@ class CloseTdbTests(TestCase): self.tdb.close() +class InternalTdbTests(TestCase): + def test_repr(self): + self.tdb = tdb.Tdb("whatever", tdb_flags=tdb.INTERNAL) + + # repr used to crash on internal db + self.assertEquals(repr(self.tdb), "Tdb('<internal>')") + + class SimpleTdbTests(TestCase): def setUp(self): |