#26304 [Opn]: Unexpected data loss when opening dba file

From: Date: Tue, 18 Nov 2003 17:59:59 +0000
Subject: #26304 [Opn]: Unexpected data loss when opening dba file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-50645@lists.php.net to get a copy of this message
ID: 26304 User updated by: vesely at tana dot it Reported By: vesely at tana dot it Status: Open Bug Type: DBM/DBA related Operating System: Solaris PHP Version: 4.3.4 New Comment: Also, that correction around line 67 in dba_db4.c (DBA_OPEN_FUNC) is bogus: if stat returns 0 you want to say DB_UNKNOWN, since you cannot say it is DB_BTREE when it was created by some other program. To reproduce the bug you should create a DB with a different type, e.g. in C if you just include db.h and then call the dbm_open compatibility layer. The Sleepycat message will then say "call implies an access method which is inconsistent with previous calls." Previous Comments: ------------------------------------------------------------------------ [2003-11-18 12:09:46] vesely at tana dot it Description: ------------ Opening a file in 'c' mode (see example below) truncates the file!! The docs say '"c" for read/write access and database creation if it doesn't currently exist.' I cannot understand that comment at line 658 in ext/dba/dba.c, as it seems to imply that truncating the database is necessary for locking it (??). Reproduce code: --------------- dba_open("important_data.db", "c", "db4"); Expected result: ---------------- open db (create if doesn't exist) Actual result: -------------- truncated db ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26304&edit=1

« previous php.bugs (#50645) next »