[CentOS] Perl DBM problem...

Mon Feb 13 12:48:28 UTC 2006
Will McDonald <wmcdonald at gmail.com>

Kinda CentOS related so bear with me. :)

We have little legacy perl app on an old RH 7.3 box I'm trying to
migrate over to a CentOS 4 system. Some information the app uses is in
Berkley DB format

[root at korma data]# file *.db
applic.db:    Berkeley DB (Hash, version 5, native byte-order)
cables.db:    Berkeley DB (Hash, version 5, native byte-order)
connector.db: Berkeley DB (Hash, version 5, native byte-order)
equipment.db: Berkeley DB (Hash, version 5, native byte-order)
hood.db:      Berkeley DB (Hash, version 5, native byte-order)
interface.db: Berkeley DB (Hash, version 5, native byte-order)
wire.db:      Berkeley DB (Hash, version 5, native byte-order)

If I run the following Perl test script ...

#!/usr/bin/perl
#
#

if ($ARGV[0] eq "") {
  print "\n  * *  give me a DBM file name to dump (no DBM extension)  * *\n";
  exit;
}
dbmopen (%dumpfile, $ARGV[0], 0400) || die "Can't open DB file!" ;
foreach $line (sort keys %dumpfile) {
  print <<END1;
  $line  -  $dumpfile{$line}
END1
}
dbmclose (%dumpfile);

Running that against any of the BDB files on the old RH 7.3 system
dumps the file's data successfully.

Copy everything over to the CentOS system

[root at willspc data]# file *.db
applic.db:    Berkeley DB (Hash, version 5, native byte-order)
cables.db:    Berkeley DB (Hash, version 5, native byte-order)
connector.db: Berkeley DB (Hash, version 5, native byte-order)
equipment.db: Berkeley DB (Hash, version 5, native byte-order)
hood.db:      Berkeley DB (Hash, version 5, native byte-order)
interface.db: Berkeley DB (Hash, version 5, native byte-order)
wire.db:      Berkeley DB (Hash, version 5, native byte-order)

Run the script again, e.g...

[root at willspc data]# ./dump.pl cables
[root at willspc data]# file cables*
cables:    Berkeley DB (Hash, version 7, native byte-order)
cables.db: Berkeley DB (Hash, version 5, native byte-order)

And it dumps a new BDB with version 7, no other output. Stracing the
process shows it's using DB_File.pm

I'm a bit stumped as to what to try next.

Will.