README showflaw-1.2 Wed Sep 15 15:32:54 EDT 1999 David Harris This archive contains the example program and explanation for showing database corruption using the following locking method which is proffered in the DB_File documentation: $db = tie(%db, 'DB_File', '/tmp/foo.db', O_CREAT|O_RDWR, 0644) || die "dbcreat /tmp/foo.db $!"; $fd = $db->fd; open(DB_FH, "+<&=$fd") || die "dup $!"; flock (DB_FH, LOCK_SH) || die "flock: $!"; The basic problem is that the first 4k of the database file are read and cached on the tie line -- so if the process is blocking in the flock call while another process modifies that area of the database file, database corruption can result. Files in this archive... README -- This file showflaw.pl -- This program actually creates corruption on my system doc.showflaw -- Some text explaining how the showflaw.pl program works. However the real documentation is still the source code. doc.strace -- The output of my strace testing that shows the read call before the flock call actually happening. example/ -- This directory has example output from running showflaw.pl on my system write.pl -- Super simple test program for manipulating the database file that I used in developing showflaw.pl