php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23975 dba_open locking error with ndbm/db2/db3
Submitted: 2003-06-03 03:43 UTC Modified: 2003-11-13 04:07 UTC
Votes:8
Avg. Score:4.8 ± 0.4
Reproduced:7 of 7 (100.0%)
Same Version:5 (71.4%)
Same OS:5 (71.4%)
From: rhalstenbach at t-online dot de Assigned: helly
Status: Wont fix Package: DBM/DBA related
PHP Version: * OS: win32 only
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-06-03 03:43 UTC] rhalstenbach at t-online dot de
The new locking feature (introduced with 4.3.0) does not work correctly in default mode "d". Very annoying because it is the default mode ...

Example:

<?php
$d1 = dba_open("c:/www/htdocs/dbfile", "c", "db3); // Old syntax, specifying no locking mode means mode "d", i.e. same as "cd"

if ($d1 === FALSE) die("Could not open dbfile");
?>

Same problem for mode "w".

It works correctly for locking mode "l" and for suppressing locking via "-". Obviously the dba_open() function tries to create a lock file with exactly the same name as the database file - what fails of course.

Tested on WindowsXP with db3, but i think it will fail for every db-driver (except gdbm) on every OS.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-10 05:19 UTC] adam at saki dot com dot au
This is actually because the locking will prematurely create an empty file, causing the VCWD_STAT command in dba_db3.c to return 0, resulting in the wrong parameters to db_open.

This can be verified by putting a stat command after the lock detection code and before the call to open (line 590 in ext/dba/dba.c).
 [2003-06-15 08:56 UTC] helly@php.net
Seems to be a windows only problem. The bug is fixed for *nix.
 [2003-08-19 04:48 UTC] courtois at nouvo dot com
The bug I submitted (25115) was declared "duplicate" with this one.

I experience the problem only when I try to open a file which is not in the current directory.

My 2 cents
 [2003-08-23 16:09 UTC] fabio_heller at yahoo dot it
curtois wrote

"The bug I submitted (25115) was declared "duplicate" with this one."

Same thing happened to me (25090) as in this post the precise error occurred (Driver initialization failed for...) isnt't specified so the search engine doesn't help in finding it.

Anyway the problem is still present in cvs version for WIN and specially it isn't possibile to use "c" mode to create a  new db.
 [2003-11-13 04:07 UTC] helly@php.net
There is no way of doing it correct on windows and changing the defaults makes no sense either.
Thus working with db2/db3/db4/gdb,/ndbm requires to manually specify a non blocking access mode.
 
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Mon Jun 15 18:01:54 2015 UTC