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:9
Avg. Score:4.8 ± 0.4
Reproduced:8 of 8 (100.0%)
Same Version:6 (75.0%)
Same OS:6 (75.0%)
From: rhalstenbach at t-online dot de Assigned: helly (profile)
Status: Wont fix Package: DBM/DBA related
PHP Version: * OS: win32 only
Private report: No CVE-ID: None
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC