Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG 5.005_(03|57)] lib/anydbm.t fails #12 (null key) with DB 2.1.2 #298

Closed
p5pRT opened this issue Jul 31, 1999 · 6 comments
Closed

[BUG 5.005_(03|57)] lib/anydbm.t fails #12 (null key) with DB 2.1.2 #298

p5pRT opened this issue Jul 31, 1999 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 31, 1999

Migrated from rt.perl.org#1121 (status was 'resolved')

Searchable as RT1121$

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 1999

From @schwern

print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n");

Since libndbm.so is lined to libdb.so on Debian (and RedHat as well, I
believe) AnyDBM_File is using DB_File by default. The following
example also fails​:

use DB_File;
tie(%h,DB_File,"/tmp/Op_dbmx", O_RDWR|O_CREAT, 0640) or die $!;
$h{""} = "bar";
$h{"foo"} = "foo";
print ($h{"foo"} eq "foo" ? "ok 11\n" : "not ok 11\n");'
print ($h{""} eq "bar" ? "ok 12\n" : "not ok 12\n");'

ok 11

Use of uninitialized value at -e line 1.
not ok 12

libdb.so is 2.1.2 from the Debian libc6 (2.1.2-0pre2) package
I presume this is an issue in DB 2 and not really a perlbug per-say.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=linux, osvers=2.2.7, archname=i686-linux
  uname='linux athens 2.2.7 #2 smp mon may 10 23​:17​:01 edt 1999 i686 unknown '
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='gcc', optimize='-O6', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
  cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
  ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
  stdchar='char', d_stdstdio=undef, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
  libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Built under linux
  Compiled at Jul 29 1999 00​:29​:00
  @​INC​:
  /usr/lib/perl5/i686-linux
  /usr/lib/perl5
  /usr/lib/perl5/site_perl/5.005/i686-linux
  /usr/lib/perl5/site_perl/5.005
  .

Summary of my perl5 (revision 5.0 version 5 subversion 57) configuration​:
  Platform​:
  osname=linux, osvers=2.2.7, archname=i686-linux
  uname='linux athens 2.2.7 #2 smp mon may 10 23​:17​:01 edt 1999 i686 unknown '
  config_args=''
  hint=previous, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  use64bits=undef usemultiplicity=undef
  Compiler​:
  cc='gcc', optimize='-g', gccversion=2.7.2.3
  cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING -I/usr/local/include -DDEBUGGING_OPS -DEBUGGING_MSTATS'
  ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING -I/usr/local/include -DDEBUGGING_OPS -DEBUGGING_MSTATS'
  stdchar='char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
  libc=/lib/libc-2.0.7.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​: DEBUGGING
  Built under linux
  Compiled at Jun 7 1999 16​:36​:16
  @​INC​:
  /usr/local/perl5.005_57/lib/5.00557/i686-linux
  /usr/local/perl5.005_57/lib/5.00557
  /usr/local/perl5.005_57/lib/site_perl/5.00557/i686-linux
  /usr/local/perl5.005_57/lib/site_perl/5.00557
  .

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 1999

From @pmqs

From​: Michael G Schwern [mailto​:schwern@​ArenaNetworks.com]

On both perl 5.005_03 and 5.005_57 with Debian 2.1 (potato) and
Berkeley DB 2, lib/anydbm.t fails test 12​:

print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n");

Since libndbm.so is lined to libdb.so on Debian (and RedHat as well, I
believe) AnyDBM_File is using DB_File by default. The following
example also fails​:

use DB_File;
tie(%h,DB_File,"/tmp/Op_dbmx", O_RDWR|O_CREAT, 0640) or die $!;
$h{""} = "bar";
$h{"foo"} = "foo";
print ($h{"foo"} eq "foo" ? "ok 11\n" : "not ok 11\n");'
print ($h{""} eq "bar" ? "ok 12\n" : "not ok 12\n");'

ok 11

Use of uninitialized value at -e line 1.
not ok 12

libdb.so is 2.1.2 from the Debian libc6 (2.1.2-0pre2) package
I presume this is an issue in DB 2 and not really a perlbug per-say.

Correct, this is a Berkeley DB issue rather than a DB_File one.

The good new is that the Sleepycat folk have said that they will re-enable
null keys in a future release of Berkeley DB.

Paul

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 1999

From @schwern

On Sat, Jul 31, 1999 at 08​:40​:32PM +0100, paul.marquess@​bt.com wrote​:

From​: Michael G Schwern [mailto​:schwern@​ArenaNetworks.com]

libdb.so is 2.1.2 from the Debian libc6 (2.1.2-0pre2) package
I presume this is an issue in DB 2 and not really a perlbug per-say.

Correct, this is a Berkeley DB issue rather than a DB_File one.

The good new is that the Sleepycat folk have said that they will re-enable
null keys in a future release of Berkeley DB.

Ahh, good to hear. May I suggest that a comment be added to
lib/anydbm.t and lib/db-hash.t about this?

*** db-hash.t 1999/08/01 01​:57​:06
--- db-hash.t 1999/08/01 01​:57​:53
***************
*** 164,169 ****
--- 164,171 ----
  $h{'foo'} = '';
  ok(26, $h{'foo'} eq '' );

+ # Berkeley DB 2 (up to an including 2.1.2) does not allow null keys.
+ # Future versions should reenable this feature.
  #$h{''} = 'bar';
  #ok(27, $h{''} eq 'bar' );
  ok(27,1) ;

*** anydbm.t 1999/08/01 01​:54​:31
--- anydbm.t 1999/08/01 01​:56​:40
***************
*** 118,123 ****
--- 118,126 ----
  print join('​:',200..400) eq join('​:',@​foo) ? "ok 10\n" : "not ok 10\n";

  print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n");
+ # Berkeley DB 2 (up to 2.1.2 and possibly higher) does not allow null keys
+ # and may cause this test to fail. Null keys should be reenabled in future
+ # versions of Berkeley DB 2.
  print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n");

  untie %h;

--

Michael G Schwern schwern@​pobox.com
  http​://www.pobox.com/~schwern
  /(?​:(?​:(1)[.-]?)?\(?(\d{3})\)?[.-]?)?(\d{3})[.-]?(\d{4})(x\d+)?/i

@p5pRT
Copy link
Author

p5pRT commented Aug 2, 1999

From @timbunce

On Sat, Jul 31, 1999 at 09​:53​:04PM -0400, Michael G Schwern wrote​:

On Sat, Jul 31, 1999 at 08​:40​:32PM +0100, paul.marquess@​bt.com wrote​:

From​: Michael G Schwern [mailto​:schwern@​ArenaNetworks.com]

libdb.so is 2.1.2 from the Debian libc6 (2.1.2-0pre2) package
I presume this is an issue in DB 2 and not really a perlbug per-say.

Correct, this is a Berkeley DB issue rather than a DB_File one.

The good new is that the Sleepycat folk have said that they will re-enable
null keys in a future release of Berkeley DB.

Ahh, good to hear. May I suggest that a comment be added to
lib/anydbm.t and lib/db-hash.t about this?

*** db-hash.t 1999/08/01 01​:57​:06
--- db-hash.t 1999/08/01 01​:57​:53
***************
*** 164,169 ****
--- 164,171 ----
$h{'foo'} = '';
ok(26, $h{'foo'} eq '' );

+ # Berkeley DB 2 (up to an including 2.1.2) does not allow null keys.
+ # Future versions should reenable this feature.
#$h{''} = 'bar';
#ok(27, $h{''} eq 'bar' );
ok(27,1) ;

Does DB offer a way to discover the version at runtime?

Tim.

@p5pRT
Copy link
Author

p5pRT commented Aug 2, 1999

From @pmqs

From​: Tim Bunce [mailto​:Tim.Bunce@​ig.co.uk]
 
On Sat, Jul 31, 1999 at 09​:53​:04PM -0400, Michael G Schwern wrote​:

On Sat, Jul 31, 1999 at 08​:40​:32PM +0100, paul.marquess@​bt.com wrote​:

From​: Michael G Schwern [mailto​:schwern@​ArenaNetworks.com]

libdb.so is 2.1.2 from the Debian libc6 (2.1.2-0pre2) package
I presume this is an issue in DB 2 and not really a perlbug per-say.

Correct, this is a Berkeley DB issue rather than a DB_File one.

The good new is that the Sleepycat folk have said that they will
re-enable
null keys in a future release of Berkeley DB.

Ahh, good to hear. May I suggest that a comment be added to
lib/anydbm.t and lib/db-hash.t about this?

*** db-hash.t 1999/08/01 01​:57​:06
--- db-hash.t 1999/08/01 01​:57​:53
***************
*** 164,169 ****
--- 164,171 ----
$h{'foo'} = '';
ok(26, $h{'foo'} eq '' );

+ # Berkeley DB 2 (up to an including 2.1.2) does not allow null keys.
+ # Future versions should reenable this feature.
#$h{''} = 'bar';
#ok(27, $h{''} eq 'bar' );
ok(27,1) ;

Does DB offer a way to discover the version at runtime?

For Berkeley DB 1.x, no.
For Berkeley DB 2.x, yes.

In DB_File I provide a restricted interface to the Berkeley DB version via
the $DB_File​::db_version variable.

For Berkeley DB 1.x the variable always returns "1".

With Berkeley DB version 2, it returns the major & minor version numbers
(but not the patch number) as a floating point number. So for Berkeley DB
2.7.5 $DB_File​::db_version will be 2.7

Paul

@p5pRT
Copy link
Author

p5pRT commented Aug 2, 1999

From @pmqs

From​: Michael G Schwern [mailto​:schwern@​pobox.com]

On Sat, Jul 31, 1999 at 08​:40​:32PM +0100, paul.marquess@​bt.com wrote​:

From​: Michael G Schwern [mailto​:schwern@​ArenaNetworks.com]

libdb.so is 2.1.2 from the Debian libc6 (2.1.2-0pre2) package
I presume this is an issue in DB 2 and not really a
perlbug per-say.

Correct, this is a Berkeley DB issue rather than a DB_File one.

The good new is that the Sleepycat folk have said that they
will re-enable
null keys in a future release of Berkeley DB.

Ahh, good to hear. May I suggest that a comment be added to
lib/anydbm.t and lib/db-hash.t about this?

*** db-hash.t 1999/08/01 01​:57​:06
--- db-hash.t 1999/08/01 01​:57​:53
***************
*** 164,169 ****
--- 164,171 ----
$h{'foo'} = '';
ok(26, $h{'foo'} eq '' );

+ # Berkeley DB 2 (up to an including 2.1.2) does not allow null keys.

Nope, the change was made in Berkeley DB 2.4.10. Anything before is ok,
anything after isn't.

Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant