php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29455 DBA can not be built with FreeBSD DBM
Submitted: 2004-07-30 09:13 UTC Modified: 2004-08-30 01:00 UTC
Votes:5
Avg. Score:4.0 ± 0.6
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:5 (125.0%)
From: dada at bbs dot giga dot net dot tw Assigned: helly (profile)
Status: No Feedback Package: *Compile Issues
PHP Version: 5.0.0 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dada at bbs dot giga dot net dot tw
New email:
PHP Version: OS:

 

 [2004-07-30 09:13 UTC] dada at bbs dot giga dot net dot tw
Description:
------------
Yes, it's related to Bug #28384.

Since DBM extension is deprecated.
I need the DBM handler (Berkeley DB 1.85) support of DBA extension.
(ex: dba_open( 'index.db', 'n', 'dbm' ) )

FreeBSD has its own built-in DBM library, which is Berkeley DB 1.85.

But I can not build DBA extension with FreeBSD's DBM.
The DBM support can not be auto-detected by the configure script.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-02 13:20 UTC] derick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2004-08-04 12:49 UTC] dada at bbs dot giga dot net dot tw
The DBM is not the database format, but the API interface.

So the 'support for DBM handler' may be confused.

The PHP source use gdbm's dbm (api) emulation as underlying library to build DBM handler support in DBA.

But the resulting database format for this kind of 'dbm' handler does NOT compatible with FreeBSD's built-in DB format.

FreeBSD has its built-in database format (libc) which been used in the system everywhere, such as /etc/mail/aliases.db.

In fact, FreeBSD/db's format is the same as 'Berkeley DB 1.85'

So my question becomes:

How to access 'Berkeley DB 1.85' by DBA extension ?

-or-

How to build 'dbm' handler with FreeBSD/db as underlying library ?

The deprecated PHP dbm_* extension can open 'Berkeley DB 1.85' in FreeBSD. But this should be replaced by DBA.

The codes in PHP/ext/dba/dba_dbm.c does not compatiable with the API of FreeBSD's db library.

I decided to fix this myself.

I rewrite the PHP/ext/dba/dba_dbm.c today, and it can be build with FreeBSD/db. It now runs perfectly.

But I think this should be called as 'db1' handler.
The codes can only be compiled in FreeBSD.

I don't know if you would like to add this into PHP CVS.
I'll be glad if I can contribute my codes.

Thanks for your patience on the report and tolerate my poor english.
 [2004-08-05 00:37 UTC] helly@php.net
Please send me your handler file. I'll see what to do next. And thanks for your patience and very much for your efforts in helping.
 [2004-08-05 04:05 UTC] dada at bbs dot giga dot net dot tw
I just send the modified source to you.

Thanks.
 [2004-08-18 17:23 UTC] dada at bbs dot giga dot net dot tw
The deprecated DBM extension seems using 'ndbm' in FreeBSD
 (instead of built-in db library)
 for accessing Berkeley DB 1.85 format in BSD system.

1. Deprecated DBM extension use ndbm's dbm_open() in FreeBSD's /usr/include/ndbm.h
2. my solution use dbopen() in FreeBSD's /usr/include/db.h

Both works!

My codes use the 2nd solution to support db 1.85 format.

Maybe you can barrow the codes from the deprecated DBM extension to utilize the 1st solution
to support the Berkeley DB 1.85 format in FreeBSD.
This may increase the portability.

~ dada
 [2004-08-19 20:34 UTC] helly@php.net
The dbm extension didn't care for the data format. Neither do you if you are using ndm functions which are normally mapped to db2 or db3. Also dbm is a bad idea because you can only have one single file open (though we currently miss some check code for that).

To verify which what version you are dealing look for 'DB_VERSION_STRING' in the db.h file or any file it includes.

Maybe we can switch to search fro the db_185.h haeder and use that if available. This thing also provides a way to open multiple datase files. Probably this is what you see in your db.h file.
 [2004-08-22 17:59 UTC] helly@php.net
Another thing we could do is providing a new subhandler called db1 to deal with teh db 1.85 format interface. The question is whether that makes sense and how to distinguish from ndbm interface and libs?
 [2004-08-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-02-25 12:27 UTC] dada dot taiwan at gmail dot com
db_185.h only provide the compatible interface,
 not the compatible data format.

http://www.csie.nctu.edu.tw/~cdsheen/codings/freebsd-phpdbm-patch.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 04:01:29 2024 UTC