Message129856
Here is a test case.
First here is a patch which implements a simple builtin function "abort()" that calls exit(0) directly, it simulates the cases that Py_FatalError occurred or segment fault.
Then run the following:
import dbm.dumb as dumb
db = dumb.open('test_db', 'c')
db.clear()
db['a'] = 'a'
db.sync()
db['a'] = 'aa'
abort()
Now the database 'test_db' is corrupt because .dat file and .dir file are out of sync:
db = dumb.open('test_db', 'c')
print(db['a'])
db.close()
prints:
b'a'
But the value of key 'a' in .dat file are: 'aa':
cat test_db.dat
aa |
|
Date |
User |
Action |
Args |
2011-03-02 04:28:52 | ysj.ray | set | recipients:
+ ysj.ray, r.david.murray |
2011-03-02 04:28:52 | ysj.ray | set | messageid: <1299040132.69.0.988386092802.issue11350@psf.upfronthosting.co.za> |
2011-03-02 04:28:52 | ysj.ray | link | issue11350 messages |
2011-03-02 04:28:52 | ysj.ray | create | |
|