Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.98k stars 559 forks source link

DB3's dbm/ndbm emulation support #2984

Closed p5pRT closed 21 years ago

p5pRT commented 23 years ago

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

Searchable as RT4906$

p5pRT commented 23 years ago

From utx@penguin.cz

Hallo Perl developers\,

I am adding small patch fixing some problems of ndbm/odbm emulation in DB3​:

- Some ndbm/odbm defines are disabled by default. On systems\, where dbm.h and ndbm.h are simple symlinks to db.h\, emualtion needs set-u define.

- ACTION is defined in both DB and PERL (unfortunatelly in different meaning). Carefull permutation of includes can simply workaround the problem.

The patch was not tested with real historic implementations of ndbm/dbm\, but I guess it should work.

Notes​:

lib/ndbm.............ok lib/odbm.............FAILED at test 9   Failed 1/64 tests\, 98.44% okay

DB3 is\, by default installed without links to historical names. This patch doesn't solve this - simply if these links are not created\, perl builds without odbm/ndbm emulation. But it's problem of DB3's packager\, not Perl.

ln -s libdb-3.so /usr/lib/libdb.so ln -s libdb-3.so /usr/lib/libdbm.so ln -s libdb-3.so /usr/lib/libndbm.so ln -s libdb-3.so /usr/lib/libdb1.so ln -s db.h /usr/include/ndbm.h ln -s db.h /usr/include/dbm.h

-- Stanislav Brabec

Inline Patch ```diff --- perl-5.6.0/ext/NDBM_File/NDBM_File.xs.orig Tue Feb 15 06:42:40 2000 +++ perl-5.6.0/ext/NDBM_File/NDBM_File.xs Wed Dec 13 19:45:28 2000 @@ -1,7 +1,9 @@ +#define DB_DBM_HSEARCH 1 +#include + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" -#include typedef struct { DBM * dbp ; --- perl-5.6.0/ext/ODBM_File/ODBM_File.xs.orig Wed Feb 16 07:12:17 2000 +++ perl-5.6.0/ext/ODBM_File/ODBM_File.xs Wed Dec 13 20:33:05 2000 @@ -1,7 +1,7 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" +#include "config.h" +#undef VOIDUSED +#define DB_DBM_HSEARCH 1 #ifdef I_DBM # include #else @@ -10,6 +10,10 @@ # endif #endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + #ifdef DBM_BUG_DUPLICATE_FREE /* * DBM on at least Ultrix and HPUX call dbmclose() from dbminit(), ```
p5pRT commented 23 years ago

From @jhi

On Wed\, Dec 13\, 2000 at 11​:27​:18PM +0100\, Stanislav Brabec wrote​:

Hallo Perl developers\,

I am adding small patch fixing some problems of ndbm/odbm emulation in DB3​:

- Some ndbm/odbm defines are disabled by default. On systems\, where dbm.h and ndbm.h are simple symlinks to db.h\, emualtion needs set-u define.

You mean this define before including dbm.h/ndbm.h?

  > +#define DB_DBM_HSEARCH 1

I guess that can be added.

- ACTION is defined in both DB and PERL (unfortunatelly in different meaning). Carefull permutation of includes can simply workaround the problem.

I do not see Perl defining ACTION anywhere. And even if it were\, wouldn't a #undef ACTION before including dbm.h/ndbm.h work?

+++ perl-5.6.0/ext/ODBM_File/ODBM_File.xs Wed Dec 13 20​:33​:05 2000 @​@​ -1\,7 +1\,7 @​@​ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" +#include "config.h" +#undef VOIDUSED

Why this?

The patch was not tested with real historic implementations of ndbm/dbm\, but I guess it should work.

Notes​:

lib/ndbm.............ok lib/odbm.............FAILED at test 9 Failed 1/64 tests\, 98.44% okay

DB3 is\, by default installed without links to historical names. This patch doesn't solve this - simply if these links are not created\, perl builds without odbm/ndbm emulation. But it's problem of DB3's packager\, not Perl.

ln -s libdb-3.so /usr/lib/libdb.so ln -s libdb-3.so /usr/lib/libdbm.so ln -s libdb-3.so /usr/lib/libndbm.so ln -s libdb-3.so /usr/lib/libdb1.so ln -s db.h /usr/include/ndbm.h ln -s db.h /usr/include/dbm.h

This information could be added to somewhere in the INSTALL file.

p5pRT commented 23 years ago

From [Unknown Contact. See original ticket]

Hallo Perl developers\,

There is my mail with final patch for DB3 support and new README.db3 file. I have sent this mail three weeks ago\, but accidentally replied only to Jarkko Hietaniemi \jhi@​iki\.fi​:

-- Stanislav Brabec

p5pRT commented 23 years ago

From [Unknown Contact. See original ticket]

Message RFC822: Date: Wed, 3 Jan 2001 15:32:16 +0100 From: Stanislav Brabec To: Jarkko Hietaniemi jhi@iki.fi Subject: Re: [ID 20001213.003] DB3's dbm/ndbm emulation support Message-ID: 20010103153215.A30238@utx.cz References: 20001213232718.A30706@utx.cz 20001230160324.P12531@chaos.wustl.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: 20001230160324.P12531@chaos.wustl.edu; from jhi@iki.fi on Sat, Dec 30, 2000 at 04:03:24PM -0600 X-Accept-Language: cs, sk, en

Well, I have decided to make changes in code as small ass possible and write README with DB emulation description.

The patch becomes as simple as possible (undefine ENTER).

Text for README (maybe README.db3):

Notes on building DB, ODBM and NDBM interfaces with Berkeley DB3.

Perl interface for DB3 is part of Berkeley DB, but if you want to compile standard Perl DB/ODBM/NDBM interfaces, you must follow following instructions:

Berkeley DB3 from Sleepycat Software is, by default installed without DB1 compatibility code (needed for DB_File interface) and without links to compatibility files. So if you want to use packages written for DB/ODBM/NDBM interfaces, you need to configure DB3 with --enable-compat185 (and optionally with --enable-dump185) and create additional references (suppose you are installing DB3 with --prefix=/usr):

ln -s libdb-3.so /usr/lib/libdbm.so ln -s libdb-3.so /usr/lib/libndbm.so echo '#define DB_DBM_HSEARCH 1' >dbm.h echo '#include ' >>dbm.h install -m 0644 dbm.h /usr/include/dbm.h install -m 0644 dbm.h /usr/include/ndbm.h Optionally, if you have compiled with --enable-compat185 (not needed for ODBM/NDBM): ln -s libdb-3.so /usr/lib/libdb1.so ln -s libdb-3.so /usr/lib/libdb.so

ODBM emulation seems not to be perfect, but is quite usable. The results on my machine are: lib/odbm.............FAILED at test 9 Failed 1/64 tests, 98.44% okay

This stuff was tested against DB 3.1.17.

Stanislav Brabec utx@penguin.cz

On Sat, Dec 30, 2000 at 04:03:24PM -0600, Jarkko Hietaniemi wrote:

On Wed, Dec 13, 2000 at 11:27:18PM +0100, Stanislav Brabec wrote:

+#define DB_DBM_HSEARCH 1

I guess that can be added.

  • ACTION is defined in both DB and PERL (unfortunatelly in different meaning). Carefull permutation of includes can simply workaround the problem.

I do not see Perl defining ACTION anywhere. And even if it were, wouldn't a #undef ACTION before including dbm.h/ndbm.h work?

You are true. It was a token before: ENTER. And undef works.

-- Stanislav Brabec

--- perl-5.6.0/ext/NDBM_File/NDBM_File.xs.orig Tue Feb 15 06:42:40 2000 +++ perl-5.6.0/ext/NDBM_File/NDBM_File.xs Wed Jan 3 12:45:23 2001 @@ -1,6 +1,7 @@

include "EXTERN.h"

include "perl.h"

include "XSUB.h"

+#undef ENTER

include

typedef struct { --- perl-5.6.0/ext/ODBM_File/ODBM_File.xs.orig Wed Feb 16 07:12:17 2000 +++ perl-5.6.0/ext/ODBM_File/ODBM_File.xs Wed Jan 3 12:47:12 2001 @@ -3,6 +3,7 @@

include "XSUB.h"

ifdef I_DBM

+# undef ENTER

include

else

ifdef I_RPCSVC_DBM

p5pRT commented 23 years ago

From @pmqs

From​: Stanislav Brabec [mailto​:sb]

Well\, I have decided to make changes in code as small ass possible and write README with DB emulation description.

The patch becomes as simple as possible (undefine ENTER).

Text for README (maybe README.db3)​: ----------- Notes on building DB\, ODBM and NDBM interfaces with Berkeley DB3.

Perl interface for DB3 is part of Berkeley DB\, but if you want to compile standard Perl DB/ODBM/NDBM interfaces\, you must follow following instructions​:

Berkeley DB3 from Sleepycat Software is\, by default installed without DB1 compatibility code (needed for DB_File interface) and without links   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   NOT True.

I've written DB_File so that it can be built with any version of Berkeley DB that is currently available\, regardless of whether it has been built with DB1 compatibility mode. This is possible because I have implemented my own DB1 computability mode layer in DB_File.

Paul

_________________________________________________________ Do You Yahoo!? Get your free @​yahoo.com address at http​://mail.yahoo.com