Issue1408584
Created on 2006-01-17 22:55 by j_ross, last changed 2006-06-08 05:18 by gregory.p.smith.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
dbtables.py.diff
|
j_ross,
2006-01-17 22:55
|
Diff file of fix (not tested thoroughly) |
|
|
|
test_dbtables.py
|
j_ross,
2006-01-19 23:07
|
Simple test case - creates DB, Insert, attempts Modify w/ string - corrupts |
|
|
|
msg49334 - (view) |
Author: jross (j_ross) |
Date: 2006-01-17 22:55 |
|
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.
|
|
msg49335 - (view) |
Author: Neal Norwitz (nnorwitz) |
Date: 2006-01-18 06:14 |
|
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?
|
|
msg49336 - (view) |
Author: jross (j_ross) |
Date: 2006-01-19 18:11 |
|
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'})
|
|
msg49337 - (view) |
Author: Jim Jewett (jimjjewett) |
Date: 2006-01-19 22:35 |
|
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...
|
|
msg49338 - (view) |
Author: jross (j_ross) |
Date: 2006-01-19 23:07 |
|
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.
|
|
msg49339 - (view) |
Author: Gregory P. Smith (gregory.p.smith) |
Date: 2006-06-08 05:18 |
|
Logged In: YES
user_id=413
fixed in SVN 46736 for python 2.5.
honestly people should just use sqlite3 instead of dbtables.
|
|
| Date |
User |
Action |
Args |
| 2006-01-17 22:55:43 | j_ross | create | |
|