php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51062 DBA DB4 build uses mismatched headers & libraries
Submitted: 2010-02-16 21:52 UTC Modified: 2010-03-05 07:30 UTC
From: seanius at debian dot org Assigned: sixd (profile)
Status: Not a bug Package: DBM/DBA related
PHP Version: 5.3.1 OS: Debian
Private report: No CVE-ID: None
 [2010-02-16 21:52 UTC] seanius at debian dot org
Description:
------------
Tested against the debian 5.3.1 packages as well as a recent 5.3 snapshot.  fails on a variety of BE/LE and 32/64bit archs.  note that the failure is different from the snapshot (Segfaults in some cases) and from 5.3.1 (various warnings about invalid parameters).  i don't want to flood the description so i'll only include the 5.3 snapshot output here.

=====================================================================
PHP         : ./sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.3-dev
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux rangda 2.6.32-trunk-amd64 #1 SMP Sun Jan 10 22:40:40 UTC 2010 x86_64
INI actual  : /home/sean/Download/php5.3-201002160730
More .INIs  :  
CWD         : /home/sean/Download/php5.3-201002160730
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
Running selected tests.
TEST 1/25 [ext/dba/tests/bug36436.phpt]
========DIFF========
001+ DB->sync: method not permitted before handle's open method
002+ Segmentation fault
001- resource(%d) of type (dba persistent)
002- string(3) "XYZ"
003- string(1) "X"
004- string(1) "Y"
005- ===DONE===
========DONE========
FAIL Bug #36436 (DBA problem with Berkeley DB4) [ext/dba/tests/bug36436.phpt] 
TEST 2/25 [ext/dba/tests/bug48240.phpt]
========DIFF========
001+ DB->sync: method not permitted before handle's open method
002- ===DONE===
003+ Segmentation fault
========DONE========
FAIL Bug #48240 (DBA Segmentation fault dba_nextkey) [ext/dba/tests/bug48240.phpt] 
TEST 3/25 [ext/dba/tests/bug49125.phpt]
========DIFF========
001+ DB->sync: method not permitted before handle's open method
001- bool(true)
002+ Segmentation fault
========DONE========
FAIL Bug #49125 (Error in dba_exists C code) [ext/dba/tests/bug49125.phpt] 
PASS DBA File Creation Test [ext/dba/tests/dba001.phpt] 
PASS DBA Insert/Fetch Test [ext/dba/tests/dba002.phpt] 
PASS DBA Insert/Replace/Fetch Test [ext/dba/tests/dba003.phpt] 
PASS DBA Multiple Insert/Fetch Test [ext/dba/tests/dba004.phpt] 
PASS DBA FirstKey/NextKey Loop Test With 5 Items [ext/dba/tests/dba005.phpt] 
PASS DBA FirstKey/NextKey with 2 deletes [ext/dba/tests/dba006.phpt] 
PASS DBA Multiple File Creation Test [ext/dba/tests/dba007.phpt] 
PASS DBA magic_quotes_runtime Test [ext/dba/tests/dba008.phpt] 
PASS DBA dba_popen Test [ext/dba/tests/dba009.phpt] 
PASS DBA CDB handler test [ext/dba/tests/dba_cdb.phpt] 
PASS DBA CDB_MAKE handler test [ext/dba/tests/dba_cdb_make.phpt] 
PASS DBA CDB handler test (read only) [ext/dba/tests/dba_cdb_read.phpt] 
SKIP DBA DB1 handler test [ext/dba/tests/dba_db1.phpt] reason: DB1 handler not available
SKIP DBA DB2 handler test [ext/dba/tests/dba_db2.phpt] reason: DB2 handler not available
SKIP DBA DB3 handler test [ext/dba/tests/dba_db3.phpt] reason: DB3 handler not available
TEST 19/25 [ext/dba/tests/dba_db4.phpt]
========DIFF========
002+ DB->sync: method not permitted before handle's open method
003+ DB->get: method not permitted before handle's open method
004+ DB->get: method not permitted before handle's open method
005+ DB->fd: method not permitted before handle's open method
006+ 0Segmentation fault
002- 3NYNYY
003- Content String 2
004- Content 2 replaced
005- Read during write: not allowed
006- Content 2 replaced 2nd time
007- The 6th value
008- array(3) {
009-   ["key number 6"]=>
010-   string(13) "The 6th value"
011-   ["key2"]=>
012-   string(27) "Content 2 replaced 2nd time"
013-   ["key5"]=>
014-   string(23) "The last content string"
015- }
016- --NO-LOCK--
017- 3NYNYY
018- Content String 2
019- Content 2 replaced
020- Read during write: not allowed
021- Content 2 replaced 2nd time
022- The 6th value
023- array(3) {
024-   ["key number 6"]=>
025-   string(13) "The 6th value"
026-   ["key2"]=>
027-   string(27) "Content 2 replaced 2nd time"
028-   ["key5"]=>
029-   string(23) "The last content string"
030- }
031- ===DONE===
========DONE========
FAIL DBA DB4 handler test [ext/dba/tests/dba_db4.phpt] 
SKIP DBA DBM handler test [ext/dba/tests/dba_dbm.phpt] reason: DBM handler not available
PASS DBA FlatFile handler test [ext/dba/tests/dba_flatfile.phpt] 
SKIP DBA GDBM handler test [ext/dba/tests/dba_gdbm.phpt] reason: GDBM handler not available
PASS DBA INIFILE handler test [ext/dba/tests/dba_inifile.phpt] 
SKIP DBA NDBM handler test [ext/dba/tests/dba_ndbm.phpt] reason: NDBM handler not available
SKIP DBA QDBM handler test [ext/dba/tests/dba_qdbm.phpt] reason: QDBM handler not available
=====================================================================
Number of tests :   25                18
Tests skipped   :    7 ( 28.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    4 ( 16.0%) ( 22.2%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   14 ( 56.0%) ( 77.8%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #36436 (DBA problem with Berkeley DB4) [ext/dba/tests/bug36436.phpt]
Bug #48240 (DBA Segmentation fault dba_nextkey) [ext/dba/tests/bug48240.phpt]
Bug #49125 (Error in dba_exists C code) [ext/dba/tests/bug49125.phpt]
DBA DB4 handler test [ext/dba/tests/dba_db4.phpt]
=====================================================================


Reproduce code:
---------------
ext/dba/tests/bug36436.phpt
ext/dba/tests/bug48240.phpt
ext/dba/tests/bug49125.phpt
ext/dba/tests/dba_db4.phpt

Expected result:
----------------
PASS

Actual result:
--------------
FAIL (incl segfaults)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-17 22:40 UTC] seanius at debian dot org
some more investigation reveals that the problem was caused by having db4.8 headers alongside db4.6 and db4.8 runtime libraries (i.e. having installed libdb4.6, libdb4.8, and libdv-dev (which is 4.8 in latest debian/ubuntu)).  the build scripts find the the headers from the db4.8 package, and the 4.6 libraries since there is no code for testing for versions > 4.6.  strangely enough it's able to build/link.

having the libdb4.6 headers installed instead of the 4.8 headers removes the problem and the tests pass, but i would argue that this is still a bug.  namely:

 * php doesn't support building against db4.8 (i could report a seperate bug about this if it's better)
 * php wrongly builds against headers for one version of libdb and links against another.
 [2010-02-19 08:46 UTC] jani@php.net
-Status: Open
+Status: Bogus

No need for several reports on basically same issue, and regarding the header issues: That's nothing we can or will do about. If you mess your system with multiple libs and headers, that's your problem.
 [2010-02-19 08:57 UTC] seanius at debian dot org
actually it's fairly common (at least on debian-derived systems, couldn't speak for others) to have multiple versions of libdb installed.  The problem is that the code that does the testing of headers will match against a generic "db.h" and then will happily link against any other version of libdb that it finds (and it doesn't seem to be searching includes/libs in the same order).  i'd argue that the configure detection ought to be a bit more thorough in this regard but won't press the point.
 [2010-03-05 06:39 UTC] sixd@php.net
-Summary: test failures in ext/dba +Summary: DBA DB4 build uses mismatched headers & libraries
 [2010-03-05 06:39 UTC] sixd@php.net
I added DB 4.7 & DB 4.8 to the autodetect list in config.m4
for PHP 5.2.14-dev, PHP 5.3.3-dev and PHP 6.
This changes the default behavior and may help many cases.
It certainly allowed DBA DB4 to work when I had 4.7 headers and
4.7 & 4.6 libraries, and built using "--with-db4".  Without the
change I saw the corrupted output you reported.

Config.m4 still doesn't check the library version matches the
header version.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC