*BSD News Article 74956


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.ysu.edu!news.cps.udayton.edu!news.engr.udayton.edu!blackbird.afit.af.mil!zombie.ncsc.mil!news.mathworks.com!news-res.gsl.net!news.gsl.net!news.sgi.com!news1.best.com!pravda.aa.msen.com!not-for-mail
From: jims@mail.msen.com (Jim Schueler)
Newsgroups: comp.lang.perl,comp.unix.bsd.bsdi.misc
Subject: Losing data with Perl 4.0 dbm files
Date: 29 Jul 1996 14:06:05 GMT
Organization: Msen, Inc. -- Ann Arbor, MI.
Lines: 30
Message-ID: <4tiggd$gla@pravda.aa.msen.com>
NNTP-Posting-Host: conch.aa.msen.com
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
Xref: euryale.cc.adfa.oz.au comp.lang.perl:47482 comp.unix.bsd.bsdi.misc:4406

I am running Perl on BSDI Unix v2.0.  Suddenly, I am alarmed to discover 
that data is missing from associative arrays stored in dbm files.

Here's a sample of my code:

	@ARRAY_ONE = keys %DATA ;
	print $#ARRAY_ONE, "\n" ;
	dbmclose %DATA ;

	dbmopen( %DATA, $FILENAME, 0644 ) ;
	@ARRAY_TWO = keys %DATA ;
	print $#ARRAY_TWO, "\n" ;

Results:
	229
	116

I use Perl's dbm functions extensively, and this occurence is the first 
I've noticed.  (Although my confidence level has dipped somewhat.)  I'm 
guessing that my data size is affecting the problem.  The resulting db 
file is 12M.

In the above code, one of the elements in @ARRAY_TWO is a corrupted copy
of another element.  Otherwise all of the elements in @ARRAY_TWO are a
subset of @ARRAY_ONE.  I can determine the elements missing from
@ARRAY_TWO.  And a grep finds the missing keys in the resulting db file.

Any assistance is greatly appreciated.

Jim Schueler