Ray.Allen <[email protected]> added the comment:
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
----------
keywords: +patch
Added file: http://bugs.python.org/file20969/builtin_abort.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue11350>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com