[Patches] [ python-Patches-1408584 ] Corrupt Berkeley DB using Modify bsddb.dbtables
SourceForge.net
noreply at sourceforge.net
Thu Jun 8 07:18:04 CEST 2006
Patches item #1408584, was opened at 2006-01-17 14:55
Message generated for change (Comment added) made by greg
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1408584&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.5
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: jross (j_ross)
Assigned to: Gregory P. Smith (greg)
Summary: Corrupt Berkeley DB using Modify bsddb.dbtables
Initial Comment:
OS: Windows 2000/Windows XP/Debian-based Linux
w/2.6.10 Kernel
When the Modify function from the dbtables.py module
is called on Berkeley DB it corrupts the file showing
an error caused by Line 445 of dbtables.py.
----------------------------------------------------------------------
>Comment By: Gregory P. Smith (greg)
Date: 2006-06-07 22:18
Message:
Logged In: YES
user_id=413
fixed in SVN 46736 for python 2.5.
honestly people should just use sqlite3 instead of dbtables.
----------------------------------------------------------------------
Comment By: jross (j_ross)
Date: 2006-01-19 15:07
Message:
Logged In: YES
user_id=1429720
Very nice .. yes using a bare exception causes the expected
TypeError exception. I tried this in Python 2.4 and without
any changes it correctly raises TypeError.
I checked the differences between the 2.3 dbtables and 2.4
and there are no significant changes (i.e. the Modify
catches the same exceptions) so it's got to be somewhere
else.
I've uploaded a simple test case that creates a database,
does an Insert and then attempts the Modify with a string
which corrupts the DB in Python 2.3.
----------------------------------------------------------------------
Comment By: Jim Jewett (jimjjewett)
Date: 2006-01-19 14:35
Message:
Logged In: YES
user_id=764593
Correct, the values in the dictionaries should be callables
(usually a function) which take the old value and return the
new.
That said, the test case would still be useful, because
(1) calling a string should raise a TypeError
(2) making a mistake should not corrupt the database.
Perhaps the first except clause (which triggers a rollback)
needs to be a bare except? I'm guess the same is true of
some of the other abort() lines...
----------------------------------------------------------------------
Comment By: jross (j_ross)
Date: 2006-01-19 10:11
Message:
Logged In: YES
user_id=1429720
I'm new to Python so this may be the problem, does the
dbtables.Modify function require a function in the
mappings. i.e. tdb.Modify('mytable', conditions=
{'ID':dbtables.ExactCond('1')}, mappings={'ID':FUNCTION})
where the function returns the new value? (not mappings=
{'ID':'newvalue'})
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2006-01-17 22:14
Message:
Logged In: YES
user_id=33168
Can you create a test case for this? What is the trigger?
Just calling the function/method? Do you know if this
affects Python 2.4 and HEAD? What version of Berkeley DB?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1408584&group_id=5470
More information about the Patches
mailing list