Bug 1768

Summary: Perl DB lib is not opening DB files.
Product: [Retired] Red Hat Linux Reporter: Wil Harris <wil>
Component: perlAssignee: Crutcher Dunnavant <crutcher>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 6.0CC: deh-redhat, smanes
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-04-01 05:56:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Wil Harris 1999-03-24 23:44:45 UTC
perl Script that works in 5.2 no longer works in 5.9,
getting errors opening db files, debug output is below. If
more is needed, let me know.

  DB<1> main::(./foetus:97):    close PASS;
  DB<1> main::(./foetus:100):
$stuff=tie(%stuff,'DB_File',"$dbfile",O_CREAT|O_RDWR,0664,$DB_HASH)
|| die "Error: Can't open dbfile: $dbfile\n";
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:118):
118:        (my $constname = $AUTOLOAD) =~ s/.*:://;
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:119):
119:        my $val = constant($constname, 0);
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:120):
120:        if ($! != 0) {
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:131):
131:        *$AUTOLOAD = sub { $val };
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:132):
132:        goto &$AUTOLOAD;
  DB<1>
Fcntl::__ANON__(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:131):
131:        *$AUTOLOAD = sub { $val };
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:118):
118:        (my $constname = $AUTOLOAD) =~ s/.*:://;
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:119):
119:        my $val = constant($constname, 0);
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:120):
120:        if ($! != 0) {
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:131):
131:        *$AUTOLOAD = sub { $val };
  DB<1>
Fcntl::AUTOLOAD(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:132):
132:        goto &$AUTOLOAD;
  DB<1>
Fcntl::__ANON__(/usr/lib/perl5/5.00502/i386-linux/Fcntl.pm:131):
131:        *$AUTOLOAD = sub { $val };
  DB<1>
DB_File::TIEHASH(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:260):
260:        tie_hash_or_array(@_) ;
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:241):
241:        my (@arg) = @_ ;
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:242):
242:        my $tieHASH = ( (caller(1))[3] =~ /TIEHASH/ ) ;
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:245):
245:            if @arg >= 5 && ref $arg[4] && $arg[4] =~
/=HASH/ && tied %{ $arg[4] } ;
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:244):
244:        $arg[4] = tied %{ $arg[4] }
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:244):
244:        $arg[4] = tied %{ $arg[4] }
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:248):
248:        if ($db_version > 1 and defined $arg[4] and
$arg[4] =~ /RECNO/ and
249:            $arg[1] and ! -e $arg[1]) {
  DB<1>
DB_File::tie_hash_or_array(/usr/lib/perl5/5.00502/i386-linux/DB_File.pm:255):
255:        DoTie_($tieHASH, @arg) ;
  DB<1> Error: Can't open dbfile: stuff.db

Comment 1 Preston Brown 1999-03-30 21:42:59 UTC
Cristian, I think this relates to bug #1581 rather strongly.

Comment 2 Cristian Gafton 1999-04-01 05:56:59 UTC
*** This bug has been marked as a duplicate of 1581 ***

Comment 3 deh-redhat 1999-05-13 15:45:59 UTC
Despite the appearance that both bugs have to do with perl and
database connectivity, they are probably not related. Bug 1581 has
to do with AnyDBM_File, and bug 1768 has to do with DB_File; these
are different things and use different underlying C routines.

Bug 1768's actual origin is that libdb has changed from db1 to db2
in RedHat 6.0. Notice that perl is looking for libdb, not libdb1:

deh% ldd perl
        libnsl.so.1 => /lib/libnsl.so.1 (0x40019000)
        libdb.so.3 => /lib/libdb.so.3 (0x4002e000)
                      ^^^^^^^^^^^^^^^
        libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x40068000)
        libdl.so.2 => /lib/libdl.so.2 (0x4006f000)
        libm.so.6 => /lib/libm.so.6 (0x40072000)
        libc.so.6 => /lib/libc.so.6 (0x4008e000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4017c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
deh% ls -al /lib/libdb.so.3
lrwxrwxrwx   1 root     root           14 May 12 00:26
/lib/libdb.so.3 -> libdb-2.1.1.so
                   ^^^^^^^^^^^^^^
deh% ls -al /lib/libdb.so.2
lrwxrwxrwx   1 root     root           15 May 12 00:26
/lib/libdb.so.2 -> libdb1-2.1.1.so

Indeed, there is a patch in perl-5.00503-2.src.rpm which attempts to
deal with this:
...
+# Glibc 2.1 comes with db2. If we link against that then databases
created
+# with the older perl (linked with db1) will not be readable by this
+# new perl. So we disable normal "db" and force in the link of db1.
+set `echo X "$libswanted "| sed -e 's/ db / db1 /'`
...

I notice that perl5.005_03/ext/DB_File/Makefile.PL wasn't referenced
in the patch, but contains the following line:
my $LIB = "-ldb" ;