12021-10-19 Sergey Poznyakoff <gray@gnu.org> 2 3 Version 1.22 4 5 62021-10-18 Sergey Poznyakoff <gray@gnu.org> 7 8 gdbm_recover does not disable crash tolerance 9 10 * src/recover.c (_gdbm_finish_transfer): Remove call to 11 _gdbmsync_done. 12 * doc/gdbm.texi: Reflect the changes. 13 142021-10-18 Sergey Poznyakoff <gray@gnu.org> 15 16 Revise the GDBM Manual 17 18 192021-10-17 Sergey Poznyakoff <gray@gnu.org> 20 21 Escape Makefile variable references in AC_PATH_PROG 22 23 242021-10-17 Sergey Poznyakoff <gray@gnu.org> 25 26 Change build process: explicitly require bison and flex 27 28 292021-10-17 Sergey Poznyakoff <gray@gnu.org> 30 31 Update the docs 32 33 * Makefile.am: Use plain git log to format the ChangeLog. 34 * git2chg.awk: Remove. 35 36 * NOTE-WARNING: Update. 37 * README: Likewise. 38 * README-alpha: Likewise. 39 * README-hacking: Likewise. 40 * doc/gdbm.3: Likewise. 41 * doc/gdbm.texi 42 432021-10-11 Sergey Poznyakoff <gray@gnu.org> 44 45 Improve documentation 46 47 482021-10-10 Sergey Poznyakoff <gray@gnu.org> 49 50 Update configure.ac 51 52 That should fix https://puszcza.gnu.org.ua/support/?349 53 54 * configure.ac: Don't use obsolete macros. Use 55 AM_GNU_GETTEXT_REQUIRE_VERSION (and require gettext 0.19), if 56 available. Install a kludge for that to work on autoconf 2.69. 57 Don't check for libdbm and libnbml. 58 592021-09-19 Sergey Poznyakoff <gray@gnu.org> 60 61 Fix key verification in sequential access. 62 63 This fixes https://oss-fuzz.com/testcase-detail/6317999997452288 64 and improves 4046a0af. 65 66 * src/bucket.c (gdbm_dir_entry_valid_p): Move to proto. 67 * src/proto.h (gdbm_dir_entry_valid_p): New inline function. 68 * src/gdbmseq.c (gdbm_valid_key_p): Use gdbm_dir_entry_valid_p 69 to validate the buffer index. Reorder the checks. 70 712021-09-16 Sergey Poznyakoff <gray@gnu.org> 72 73 Fix computation of dbf->avail->count after pushing new avail 74 block. 75 76 This is a very long-standing bug that caused a loss of an avail 77 entry if the original avail table had odd number of entries. 78 79 * src/falloc.c (push_avail_block): Fix computation of 80 dbf->avail->count. 81 822021-09-16 Sergey Poznyakoff <gray@gnu.org> 83 84 Fix typo 85 86 872021-09-15 Sergey Poznyakoff <gray@gnu.org> 88 89 Remove a left-over note from the README 90 91 922021-09-09 Sergey Poznyakoff <gray@gnu.org> 93 94 Add missing include 95 96 * src/gdbmtool.h: Include string.h 97 982021-09-09 Sergey Poznyakoff <gray@gnu.org> 99 100 Fix stack overflow in print_usage 101 102 * src/parseopt.c (print_usage): Fix length calculation for long 103 options. 104 1052021-09-07 Sergey Poznyakoff <gray@gnu.org> 106 107 Reset TERM for dejagnu testsuite 108 109 See https://puszcza.gnu.org.ua/bugs/index.php?520 110 111 * tests/gdbmtool/config/default.exp: Set TERM to empty string. 112 1132021-09-07 Sergey Poznyakoff <gray@gnu.org> 114 115 Fix testing with DejaGNU 1.6.3 116 117 DejaGNU starting from version 1.6.3 looks for the testsuite in 118 the directory testsuite. 119 120 See https://puszcza.gnu.org.ua/bugs/index.php?519 121 122 * configure.ac: Register tests/gdbmtool/Makefile 123 * tests/Makefile.am: Move dejagnu tests to the gdbmtool subdir. 124 * tests/gdbmtool/Makefile.am: New file. 125 * tests/config/default.exp: Move to 126 tests/gdbmtool/config/default.exp 127 * tests/gdbmtool/base.exp: Move to 128 tests/gdbmtool/testsuite/gdbmtool/base.exp 129 1302021-09-07 Sergey Poznyakoff <gray@gnu.org> 131 132 Determine if st_mtim is present in struct stat 133 134 * configure.ac: Check for st_mtim and st_mtimespec in struct 135 stat. The former is POSIX, the latter is used instead of it on 136 some systems 137 (reportedly, Darwin and NetBSD). 138 * src/systems.h [!HAVE_STRUCT_STAT_ST_MTIM]: Use st_mtimespec if 139 available. 140 * src/gdbmshell.c (print_snapshot): Fall back to st_mtime if 141 nanosecond precision is not available. 142 * src/gdbmsync.c (timespec_cmp): Take two pointers to struct 143 stat as arguments. Use the right time field, depending on the 144 configuration settings. All uses changed. 145 1462021-09-05 Sergey Poznyakoff <gray@gnu.org> 147 148 Fix file header validation 149 150 * src/gdbmopen.c (validate_header_std) 151 (validate_header_numsync): Check if bucket_size is > 0. 152 1532021-09-05 Sergey Poznyakoff <gray@gnu.org> 154 155 Revert "Request gettext version 0.18 or newer" 156 157 This requires autoconf 2.70. Reverted until it is spread wide 158 enough. 159 1602021-09-04 Sergey Poznyakoff <gray@gnu.org> 161 162 Request gettext version 0.18 or newer 163 164 1652021-09-03 Sergey Poznyakoff <gray@gnu.org> 166 167 Minor change 168 169 1702021-09-03 Sergey Poznyakoff <gray@gnu.org> 171 172 gdbm_fuzzer: use atexit to free memory allocated for script 173 buffer 174 175 * fuzz/gdbm_fuzzer.c: (fuzzer_exit): New function. 176 (LLVMFuzzerInitialize): Register atexit handler. 177 1782021-08-31 Sergey Poznyakoff <gray@gnu.org> 179 180 Add seed builder script and runcom file for gdbm_fuzzer 181 182 1832021-08-30 Sergey Poznyakoff <gray@gnu.org> 184 185 Add gdbm_fuzzer.c 186 187 1882021-08-30 Sergey Poznyakoff <gray@gnu.org> 189 190 Change semantics of the errorexit variable. 191 192 The "errorexit" variable is a string variable with the same 193 syntax as errormask. If a GDBM error is reported and the 194 corresponding gdbm_errno value is listed in this variable, 195 further script execution is aborted. 196 197 Setting it as boolean value is equivalent to set 198 errorexit="all". 199 200 * src/gdbmshell.c (all handlers): Return a GDBMSHELL_* error 201 code. 202 (closedb): Unset the fd variable only after closing the 203 database. 204 (run_command): If handler reported GDBM error and gdbm_errno is 205 listed in the errorexit variable, return 1 (which will cause 206 YYABORT in parser). 207 * src/gdbmtool.h (VAR_ERR_GDBM): New variable error code. 208 (variable_has_errno): New function. 209 (gdbm_error_is_masked): Rewrite using variable_has_errno. 210 * src/gram.y: Abort if run_command or run_last_command return 211 !0. Handle VAR_ERR_GDBM. 212 * src/var.c (variable): New member: data. 213 (errorexit variable): Change type to VART_STRING; install 214 sethook and typeconv. 215 (variable_unset): When unsetting string variable, free and reset 216 its value. 217 (cachesize_sethook,centfree_sethook) 218 (coalesce_sethook): Return VAR_ERR_GDBM on gdbmshell_setopt 219 error. 220 (errormask_sethook): Keep the mask vector in the data member. 221 Handle conversions from boolean. 222 (errorexit_sethook): Call errormask_sethook unless in 223 interactive session. 224 2252021-08-30 Sergey Poznyakoff <gray@gnu.org> 226 227 Minor change 228 229 * tests/gtconv.c (main): Free allocated memory before exit. 230 2312021-08-29 Sergey Poznyakoff <gray@gnu.org> 232 233 bootstrap: options for disable po download and for updating po 234 files 235 236 2372021-08-27 Sergey Poznyakoff <gray@gnu.org> 238 239 Minor change 240 241 * src/gdbmshell.c (command_type): Change initializer. 242 (gdbmshell_run): Initialize the .len member. 243 2442021-08-27 Sergey Poznyakoff <gray@gnu.org> 245 246 gdbmtool: new command "perror"; new options -t, -T; improve 247 timing output 248 249 * doc/gdbm.texi: Document the perror command. 250 * src/gdbmshell.c: New command: perror. 251 (run_command): In timing mode, print also user and system CPU 252 times. Print traces on stderr. 253 * src/gdbmtool.c: New options: -t (--trace) and -T (--timing). 254 2552021-08-17 Sergey Poznyakoff <gray@gnu.org> 256 257 gdbmtool: optionally print command trace (controlled by the 258 "trace" variable) 259 260 * src/gdbmshell.c (run_command): Print command trace if 261 requested. Prefix timing info with the name of the command. 262 * src/var.c: New variable: trace. 263 2642021-08-17 Sergey Poznyakoff <gray@gnu.org> 265 266 gdbmtool: optionally print real execution time at the end of 267 each command 268 269 * src/gdbmshell.c (run_command): Print real execution time, if 270 the "timing" variable is set. 271 * src/var.c: New boolean variable: timing 272 2732021-08-16 Sergey Poznyakoff <gray@gnu.org> 274 275 run_command: use error code from begin 276 277 2782021-08-16 Sergey Poznyakoff <gray@gnu.org> 279 280 Allow for [+-]all in the errormask value 281 282 2832021-08-16 Sergey Poznyakoff <gray@gnu.org> 284 285 New gdbmtool variables: errorexit and errormask. 286 287 Boolean errorexit controls whether script terminates upon first 288 erroneous return from run_command or its derivatives. The 289 variable can be set only in non-interactive mode. 290 291 errormask is a comma-delimited list of GDBM error codes that are 292 masked, i.e. that won't trigger a diagnostic message if they 293 occur. 294 * src/gdbmshell.c (all handlers): Return integer value 295 indicating success (0) or failure (!0). 296 * src/gdbmtool.h (input_context_drain): New function. 297 (run_last_command): Return integer. 298 * src/gram.y: abort if run_command returns error and "errorexit" 299 is set. 300 * src/input-argv.c (instream_argv_read): Bugfix. 301 * src/lex.l (input_context_drain): New function. 302 * src/var.c: New variables: errorexit and errormask. 303 3042021-09-03 Sergey Poznyakoff <gray@gnu.org> 305 306 Add gdbmshell.c to POTFILES.in 307 308 3092021-09-02 Sergey Poznyakoff <gray@gnu.org> 310 311 Version 1.21 released 312 313 3142021-08-27 Sergey Poznyakoff <gray@gnu.org> 315 316 Version 1.21 317 318 3192021-08-18 Sergey Poznyakoff <gray@gnu.org> 320 321 Minor fix 322 323 * src/input-argv.c ((instream_argv_read): Fix escaping of 324 special characters. 325 3262021-08-13 Sergey Poznyakoff <gray@gnu.org> 327 328 Revise gdbmtool error messages 329 330 * src/gdbmshell.c: Revise error messages. Use dberror where 331 appropriate. 332 * src/gdbmtool.h (dberror): New proto. 333 * src/gram.y (dberror): New function. 334 3352021-08-13 Sergey Poznyakoff <gray@gnu.org> 336 337 gdbmtool: always provide stdin stream 338 339 * src/Makefile.am (libgdbmapp_a_SOURCES): Add input-std.c 340 * src/gdbmshell.c (input_history_begin): Improve diagnostic 341 message. 342 * src/gdbmtool.c (instream_default_create): New define. 343 (gdbmtool_init): Use instream_default_create. 344 * src/gdbmtool.h [WITH_READLINE] (instream_readline_create_: New 345 proto. 346 (input_stream_name): New proto. 347 * src/input-rl.c (instream_stdin_create): Rename to 348 instream_readline_create. Fall back to instream_stdin_create if 349 stdin is not connected to a tty. 350 * src/lex.l (input_stream_name): New function. 351 3522021-08-13 Sergey Poznyakoff <gray@gnu.org> 353 354 Re-implement input history handling to minimize linking 355 requirements 356 357 Applications using gbdmshell don't need to link with 358 libreadline, unless they use instream_stdin_create with readline 359 support. 360 361 * src/gdbmshell.c (input_history_begin) 362 (input_history_handler): New functions. 363 (gdbmshell_run): Remove calls to input_init()/input_done(). 364 * src/gdbmtool.h (instream): New fields: in_history_size, 365 in_history_get. 366 (input_init,input_done): Remove. 367 (instream_history_size,instream_history_get): New functions. 368 (input_history_handler,input_history_begin): Remove. 369 * src/input-rl.c: Incorporate history handling into the stream 370 itself. 371 * src/input-std.c (input_init,input_done): Remove placeholders. 372 * src/lex.l (input_history_size,input_history_get): New 373 functions. 374 3752021-08-12 Sergey Poznyakoff <gray@gnu.org> 376 377 Update docs 378 379 * NEWS: Document changes. 380 * doc/gdbm.texi: Document new variables. 381 3822021-08-12 Sergey Poznyakoff <gray@gnu.org> 383 384 Fix NULL dereference in gdbmshell. Undefine "fd" upon closing 385 the database. 386 387 3882021-08-12 Sergey Poznyakoff <gray@gnu.org> 389 390 gdbmtool: setting database option affects the current database 391 392 * src/gdbmshell.c (gdbmshell_setopt): New function. 393 * src/gdbmtool.h (gdbmshell_setopt): New proto. 394 * src/var.c: Provide set hooks for: cachesize, coalesce, and 395 centfree. 396 3972021-08-12 Sergey Poznyakoff <gray@gnu.org> 398 399 gdbmshell: get rid of remaining globals 400 401 Use gdbmshell variables instead 402 403 * src/gdbmshell.c (file_name, file_descr) 404 (open_mode, open_format): Remove globals. 405 (opendb,checkdb) 406 (open_handler,import_handler) 407 (status_handler): Use variables instead of globals. 408 (command_tab): Mark the "open" parameter as optional. 409 * src/gdbmtool.c (gdbmtool_init): Use variables instead of 410 globals. 411 * src/gdbmtool.h (file_name, file_descr) 412 (open_mode, open_format): Remove globals. 413 * src/lex.l: Use variables instead of globals. 414 * src/var.c (variable): Rename hook to sethook. New field: 415 typeconv. 416 (vartab): New variables: "filename", "fd". 417 (variable_get): Use typeconv if provided. 418 * tests/gdbmtool/base.exp: Fix expected output. 419 * tests/gdbmtool00.at: Likewise. 420 * tests/gdbmtool01.at: Likewise. 421 4222021-08-11 Sergey Poznyakoff <gray@gnu.org> 423 424 gdbmtool: bugfixes 425 426 * src/gdbmshell.c (datum_free): New function. Use it whenever a 427 datum's dptr needs to be freed. 428 (gdbmshell_run): Initialize last_cmd and last_args at the start 429 and free last_args before returning. 430 * src/util.c (vgetyn): Copy ap to a temporary va_list 431 4322021-08-11 Sergey Poznyakoff <gray@gnu.org> 433 434 Fix duplicated mmap in gdbm_recover 435 436 * src/recover.c (_gdbm_finish_transfer): Reuse memory mapping 437 from the intermediate dbm structure. 438 4392021-08-11 Sergey Poznyakoff <gray@gnu.org> 440 441 Minor fix 442 443 * src/gdbmshell.c (opendb): Force GDBM_CLOERROR when calling 444 gdbm_fd_open. 445 4462021-08-11 Sergey Poznyakoff <gray@gnu.org> 447 448 Minor change in argv stream 449 450 * src/input-argv.c (instream_argv_read): Don't treat = 451 specially. 452 4532021-08-11 Sergey Poznyakoff <gray@gnu.org> 454 455 Fix memory leaks in gdbm_fd_open 456 457 * src/gdbmopen.c (gdbm_fd_open): Close the database before 458 returning on error. 459 4602021-08-10 Sergey Poznyakoff <gray@gnu.org> 461 462 Move gdbmtool shell functions to the library. 463 464 * src/Makefile.am (libgdbmapp_a_SOURCES): Move gdbm shell 465 support to the library. 466 * src/gdbmtool.c: Move shell support to another file. 467 * src/gdbmtool.h (file_descr): New extern. 468 (gdbmshell, gdbmshell_run) 469 (variables_init, variables_free): New functions. 470 * src/gdbmtool.supp: New file. 471 * src/var.c (VAR_IS_SET): Change definition. 472 (variable): New member: init. 473 (variable_set): Change meaning of VARF_INIT. 474 (variables_free,variables_init): New protos. 475 * src/gdbmtool.c: New file. 476 4772021-08-10 Sergey Poznyakoff <gray@gnu.org> 478 479 gdbmtool: separate command parameters and environment 480 481 4822021-08-10 Sergey Poznyakoff <gray@gnu.org> 483 484 gdbmtool: rewrite handler parameter functions; fix memory leaks 485 486 * src/input-null.c: New file. 487 * src/Makefile.am: Add input-null.c 488 * src/mem.c (e2nrealloc): New function. 489 * src/gdbmapp.h (e2nrealloc): New proto. 490 * src/gdbmtool.c (quit_handler): Exit from parser instead of 491 exiting from the program. 492 (param): Remove global. 493 (param_expand,param_push_arg,param_free): New functions for 494 handling parameters. 495 (param_free_argv): Take a single argument. Clear all parameters 496 up to argc. 497 (run_command): Rewrite parameter handling using new functions. 498 (main): Call input_init() after the input stream has been set 499 up. Call yylex_destroy when finished. 500 * src/gdbmtool.h (instream_null_create): New proto. 501 (handler_param): Change type of argc to size_t. New field 502 argmax. 503 (HANDLER_PARAM_INITIALIZER): New define. 504 (yylex_destroy): New proto. 505 * src/input-rl.c (history_file_name): New static. 506 (get_history_file_name): Initialize history_file_name. 507 (input_init): Initialize input history only in interactive mode. 508 (input_done): Free input history only in interactive mode. 509 5102021-08-10 Sergey Poznyakoff <gray@gnu.org> 511 512 Bugfixes 513 514 * src/gdbmdefs.h (SAVE_ERRNO): Preserve both gdbm_errno and 515 errno. 516 * src/recover.c (_gdbm_finish_transfer): Transfer all cache 517 fields 518 (cache_mru was missing). 519 5202021-08-10 Sergey Poznyakoff <gray@gnu.org> 521 522 Update gdbm.texi 523 524 5252021-08-09 Sergey Poznyakoff <gray@gnu.org> 526 527 Update docs. Rename some error codes. 528 529 * doc/gdbm.texi: Update. 530 * src/gdbm.h.in (GDBM_ILLEGAL_DATA): Rename to 531 GDBM_MALFORMED_DATA. 532 (GDBM_OPT_ILLEGAL): Rename to GDBM_OPT_BADVAL. All uses changed. 533 Old constants retained for backward compatibility. 534 5352021-08-09 Sergey Poznyakoff <gray@gnu.org> 536 537 Make parseopt reentrant. 538 539 * src/parseopt.c (parseopt_first): Initialize option tables to 540 NULL. 541 5422021-08-09 Sergey Poznyakoff <gray@gnu.org> 543 544 Version 1.20.91. Minor changes in translatable strings. 545 546 5472021-08-08 Sergey Poznyakoff <gray@gnu.org> 548 549 Document new gdbmtool options 550 551 5522021-08-08 Sergey Poznyakoff <gray@gnu.org> 553 554 gdbmtool: new option to open the database at a given file 555 descriptor 556 557 * src/gdbmtool.c (file_descr): New global. 558 (closedb): Reset file_descr to -1. 559 (opendb): Take second argument: file descriptor of the database 560 file. Use gdbm_fd_open if it is > 0. New options: -d, -x 561 * src/gdbmdefs.h: Fix comment. 562 5632021-08-04 Sergey Poznyakoff <gray@gnu.org> 564 565 Fix the docs 566 567 5682021-08-04 Sergey Poznyakoff <gray@gnu.org> 569 570 Fix representation of multibyte strings in gdbmtool output 571 572 * datconv.c (f_stringz, f_string): Use multi-byte and wide 573 string functions to decide whether a character is printable or 574 not. 575 5762021-08-04 Sergey Poznyakoff <gray@gnu.org> 577 578 Fix the representation of octal escapes in gdbmtool output 579 580 * src/datconv.c (f_stringz, f_string): Use unsigned char *. 581 5822021-08-03 Sergey Poznyakoff <gray@gnu.org> 583 584 gdbmtool: fix help output representation 585 586 5872021-08-03 Sergey Poznyakoff <gray@gnu.org> 588 589 New macro: ARRAY_SIZE 590 591 5922021-08-03 Sergey Poznyakoff <gray@gnu.org> 593 594 gdbmtool: control the format in which new databases are created 595 596 * src/gdbmload.c (_gdbm_str2fmt): New function. 597 * src/proto.h (_gdbm_str2fmt): New proto. 598 * src/gdbmtool.c (open_format): New global variable. 599 (opendb): Add open_format to gdbm_open flags 600 * src/gdbmtool.h (open_format): New extern. 601 * src/var.c: Handle the "format" variable. 602 * doc/gdbm.texi: Document the changes. 603 6042021-08-03 Sergey Poznyakoff <gray@gnu.org> 605 606 Preserve the database format across dump/restore 607 608 * src/gdbmdump.c (_gdbm_dump_ascii): New parameter "format" 609 holds the format of the original database. Set version number to 610 1.1 611 * src/gdbmload.c (_gdbm_load_file): Handle the "format" 612 parameter. 613 6142021-08-03 Sergey Poznyakoff <gray@gnu.org> 615 616 Fix typos 617 618 6192021-08-02 Sergey Poznyakoff <gray@gnu.org> 620 621 Various fixes 622 623 * doc/gdbm.texi: Document manual crash recovery procedure. 624 Document the gdbmtool "shell" command. Fix chapter headings 625 (remove final point). Replace headings with sections. 626 * src/gdbmopen.c (gdbm_header_avail): Remove const qualifier 627 from 1st argument 628 * src/proto.h (gdbm_file_sync): New proto. 629 * src/gdbmsync.c (gdbm_file_sync): Moved from proto.h. 630 (gdbm_sync): Call _gdbm_end_update to be sure all changes are 631 written to disk. 632 * src/gdbmtool.c: Implement the shell command. 633 (command_lookup): Fix name prefix comparison. 634 * src/gram.y: New token T_SHELL. 635 * src/lex.l: Sub-lexers for shell arguments. 636 6372021-08-02 Sergey Poznyakoff <gray@gnu.org> 638 639 Fix gdbm_recover 640 641 * src/recover.c (_gdbm_finish_transfer): Close snapshot 642 descriptors, if any. Restore xheader, avail, and avail_size 643 members. 644 6452021-08-02 Sergey Poznyakoff <gray@gnu.org> 646 647 Fix numsync comparison 648 649 * src/gdbmsync.c (gdbm_numsync_cmp): Properly handle unsigned 650 overflow. 651 * tests/gtload.c: New option -numsync. 652 6532021-08-01 Sergey Poznyakoff <gray@gnu.org> 654 655 New gdbmtool command: snapshot 656 657 * src/gdbmtool.c: New command: "snapshot" 658 * doc/gdbm.texi: Document the snapshot command (gdbmtool). 659 * doc/gdbmtool.1: Likewise. 660 * src/gdbmsync.c: Fix a comment. 661 6622021-08-01 Sergey Poznyakoff <gray@gnu.org> 663 664 Fix a typo. 665 666 * src/gdbmsync.c (stat_snapshot): Use EACCES instead of EACCESS. 667 6682021-07-31 Sergey Poznyakoff <gray@gnu.org> 669 670 Changes in the docs. Minor improvements in 671 gdbm_latest_snapshot. 672 673 * doc/Makefile.am: Export htmlxref.cnf 674 * doc/htmlxref.cnf: New file. 675 * doc/gdbm.texi: Improve crash-tolerance descriptions. 676 * src/gdbmsync.c (stat_snapshot): Set errno = EACCES if access 677 bits of the snapshot stat are wrong. 678 (gdbm_latest_snapshot): Don't touch ret if returning 679 GDBM_SNAPSHOT_SUSPICIOUS. 680 6812021-07-31 Sergey Poznyakoff <gray@gnu.org> 682 683 Update the documentation 684 685 6862021-07-30 Sergey Poznyakoff <gray@gnu.org> 687 688 Minor fix 689 690 * src/gdbmsync.c (gdbm_numsync_cmp): Fix signedness of na, nb 691 6922021-07-30 Sergey Poznyakoff <gray@gnu.org> 693 694 Minor change 695 696 * src/gdbmdefs.h (GDBM_HEADER_AVAIL_SIZE): Removed. 697 (GDBM_HEADER_AVAIL_OFFSET): New macro. 698 * src/avail.c: Use dbf->avail_size and GDBM_HEADER_AVAIL_OFFSET. 699 * src/gdbmopen.c: Likewise. 700 7012021-07-30 Sergey Poznyakoff <gray@gnu.org> 702 703 Avoid eventual alignment problems 704 705 * src/gdbm.magic: Handle extended GDBM format. 706 * src/gdbmdefs.h (gdbm_file_standard_header) 707 (gdbm_file_extended_header): New data types. 708 * src/gdbmopen.c (gdbm_header_avail): Use casts to 709 gdbm_file_*_header to obtain data offsets. 710 * src/gdbmtool.c (print_header_handler): Improve formatting. 711 7122021-07-29 Sergey Poznyakoff <gray@gnu.org> 713 714 Minor fix 715 716 * src/gdbmsync.c (gdbm_latest_snapshot): Restore missing break. 717 7182021-07-29 Sergey Poznyakoff <gray@gnu.org> 719 720 Various bugfixes. 721 722 7232021-07-29 Sergey Poznyakoff <gray@gnu.org> 724 725 Improve _gdbm_snapshot 726 727 * src/gdbmsync.c (_gdbm_snapshot): Before returning, chmod 728 previous snapshot write-only. Change proposed by Terence Kelly 729 on July 23, 2021. 730 7312021-07-29 Sergey Poznyakoff <gray@gnu.org> 732 733 Mark GDBM_MAGIC constants as unsigned 734 735 7362021-07-29 Sergey Poznyakoff <gray@gnu.org> 737 738 Implement snapshot selection by numsync. 739 740 * src/gdbm.h.in (GDBM_SNAPSHOT_SUSPICIOUS): New return code. 741 * src/gdbmsync.c (gdbm_latest_snapshot): Take into account 742 numsync when choosing between the two snapshots. 743 (gdbm_sync): Increase numsync. 744 7452021-07-29 Sergey Poznyakoff <gray@gnu.org> 746 747 Initialize dptr to non-null storage even if size is 0. 748 749 7502021-07-29 Sergey Poznyakoff <gray@gnu.org> 751 752 Test conversion to extended format. 753 754 * src/gdbmdefs.h (gdbm_ext_header): Add new field: version. Pad 755 to 8 integers. 756 * tests/gtconv.c: New auxiliary program. 757 * tests/conv.at: New test. 758 * tests/Makefile.am: Add new tests. 759 * tests/testsuite.at: Likewise. 760 7612021-07-29 Sergey Poznyakoff <gray@gnu.org> 762 763 Simplify gdbm_file_header 764 765 * src/gdbm.h.in (gdbm_convert): New proto. 766 * src/gdbmdefs.h: Define GDBM_MAGIC and GDBM_NUMSYNC_MAGIC here. 767 (gdbm_file_header): Remove the union. 768 * src/gdbmopen.c (gdbm_header_avail): Return pointer to 769 gdbm_ext_header in 4th argument. 770 (validate_header_std,validate_header_numsync): Remove avail size 771 verification. It will be checked later in gdbm_fd_open. 772 (gdbm_fd_open): Check avail table size. 773 (gdbm_convert): New function. 774 * src/avail.c (gdbm_avail_traverse): Change the avail table 775 offset calculation. 776 * src/gdbmtool.c: New commands: upgrade, downgrade and sync. Fix 777 output of the "header" command. 778 7792021-07-28 Sergey Poznyakoff <gray@gnu.org> 780 781 Introduce extended header. 782 783 * src/gdbm.h.in (GDBM_NUMSYNC): New flag for gdbm_open 784 * src/gdbmdefs.h (gdbm_ext_header): New struct. 785 (gdbm_file_header): New member of the union v: gdbm_ext_header. 786 * src/gdbmopen.c 787 (gdbm_header_avail): New function. 788 (validate_header): Use dbf->avail. 789 (gdbm_fd_open): Read both database types. Create 790 GDBM_NUMSYNC_MAGIC database if given the GDBM_MAGIC flag. 791 7922021-07-28 Sergey Poznyakoff <gray@gnu.org> 793 794 Prepare structs gdbm_file_header and gdbm_file_info for changes. 795 796 * src/gdbmconst.h (GDBM_NUMSYNC_MAGIC32) 797 (GDBM_NUMSYNC_MAGIC64) 798 (GDBM_NUMSYNC_MAGIC32_SWAP) 799 (GDBM_NUMSYNC_MAGIC64_SWAP): New constants. 800 * src/gdbmdefs.h (gdbm_file_header): Move avail to a union in 801 anticipation of further changes. 802 (gdbm_file_info) <avail, avail_size>: New members. 803 (GDBM_HEADER_AVAIL_SIZE): Redefine. 804 * src/gdbmopen.c (GDBM_NUMSYNC_MAGIC): New define. 805 (validate_header_std) 806 (validate_header_numsync): New functions. 807 (validate_header): Use one of these depending on the magic 808 number. 809 (gdbm_fd_open): Initialize new members of gdbm_file_info. 810 811 * src/avail.c: Use the GDBM_FILE avail pointer. 812 * src/falloc.c: Likewise. 813 * src/gdbmtool.c: Likewise. 814 8152021-07-22 Sergey Poznyakoff <gray@gnu.org> 816 817 Fix gdbm_avail_traverse() 818 819 * src/avail.c (gdbm_avail_traverse): Apply callback to the 820 header avail block as well. 821 * src/gdbmtool.c (avail_list_print): Don't print header block 822 separately. 823 8242021-06-27 Sergey Poznyakoff <gray@gnu.org> 825 826 Improve fsync_to_root. Other minor fixes. 827 828 * src/gdbm.h.in (gdbm_latest_status): Rename to 829 gdbm_latest_snapshot_status. 830 * src/gdbmsync.c (fsync_to_root): Start synching from the 831 snapshot itself. Take care to open it write-only. 832 (gdbm_latest_snapshot): Reorganize to improve readability. 833 [!GDBM_FAILURE_ATOMIC] gdbm_latest_snapshot: Fix signature. 834 8352021-06-27 Sergey Poznyakoff <gray@gnu.org> 836 837 Bugfix 838 839 * src/gdbmsync.c (stat_snapshot): Fix typo (missing 840 parentheses). 841 8422021-06-26 Sergey Poznyakoff <Sergey Poznyakoff> 843 844 Bugfixes in crash tolerance code. 845 846 * doc/gdbm.texi: Document GDBM_SNAPSHOT_BAD 847 * src/gdbm.h.in (GDBM_SNAPSHOT_BAD): New constant. 848 * src/gdbmsync.c (fsync_to_root): Rewrite. Use pointer to 849 traverse the pathname in the reverse direction. Fsync the root 850 directory as well. 851 (gdbm_failure_atomic): Create both snapshots in user write-only 852 mode. 853 (stat_snapshot): Fail if the file is neither readable nor 854 writable. 855 (gdbm_latest_snapshot): Fail if neither file is readable. Fix 856 selection of the snapshot by mtime: prefer the latest one. 857 [!GDBM_FAILURE_ATOMIC]: Provide the placeholder for 858 gdbm_latest_snapshot. 859 8602021-06-26 Sergey Poznyakoff <gray@gnu.org> 861 862 Document new error codes 863 864 8652021-06-26 Sergey Poznyakoff <gray@gnu.org> 866 867 Document crash tolerance API 868 869 8702021-06-25 Sergey Poznyakoff <Sergey Poznyakoff> 871 872 Crash-tolerance based on the patch from Terence Kelly 873 874 8752021-07-07 Sergey Poznyakoff <gray@gnu.org> 876 877 Fix https://puszcza.gnu.org.ua/bugs/?515 878 879 * src/gdbm.h.in: Include sys/types.h 880 8812021-06-17 Sergey Poznyakoff <gray@gnu.org> 882 883 Version 1.20 884 885 8862021-06-14 Sergey Poznyakoff <gray@gnu.org> 887 888 Enable pre-reading the memory mapped regions on request. 889 890 The commit 4fb2326a4a introduced pre-reading of memory mapped 891 regions. While speeding up searches, it has a negative impact 892 on write operatons, since every remapping effectively re-reads 893 the entire database. See 894 https://github.com/Perl/perl5/issues/18884 for details. 895 896 * NEWS: Document changes. 897 * doc/gdbm.texi: Document the GDBM_PREREAD flag. 898 * src/gdbm.h.in (GDBM_PREREAD): New flag. 899 * src/gdbmdefs.h (gdbm_file_info): New member: mmap_preread. 900 * src/gdbmopen.c (gdbm_fd_open): Set mmap_preread if requested. 901 * src/gdbmsetopt.c (setopt_gdbm_getflags): Report GDBM_PREREAD 902 flag, if dbf->mmap_preread is set. 903 * src/mmap.c (_gdbm_internal_remap): Use pre-fault reading only 904 if dbf->mmap_preread is set. 905 9062021-04-23 Sergey Poznyakoff <gray@gnu.org> 907 908 Fix possible integer overflows and cases of undefined behavior. 909 910 * src/avail.c (avail_comp): Prevent integer overflow. 911 (gdbm_avail_table_valid_p): Likewise. 912 * src/gdbmdefs.h (off_t_sum_ok): Change return type. Return 913 false if any argument is negative. 914 * src/gdbmopen.c (compute_directory_size): Prevent integer 915 overflow. 916 * src/hash.c (_gdbm_hash): Treat dptr elements as unsigned 917 integers. 918 9192021-03-22 Sergey Poznyakoff <gray@gnu.org> 920 921 Fix minor memory leaks in gdbmtool 922 923 * src/datconv.c (dsegm_list_free): Free name if necessary. 924 * src/gram.y (defid): Free $1 when no longer needed. 925 9262021-03-21 Sergey Poznyakoff <gray@gnu.org> 927 928 Merge branch 'newcache': Bucket cache rewritten from scratch. 929 930 9312021-03-21 Sergey Poznyakoff <gray@gnu.org> 932 933 Enable automatic cache size by default. 934 935 This provides for the optimal performance. 936 937 Additional GDBM_XVERIFY flag can be used when opening the 938 database to request extended database verification (entire avail 939 stack will be checked). 940 * src/bucket.c (cache_lookup): Handle cache_size == 941 GDBM_CACHE_AUTO. 942 (_gdbm_cache_init): Likewise. 943 * src/gdbm.h.in (GDBM_XVERIFY): New flag to gdbm_open. 944 (GDBM_CACHE_AUTO): New constant. Define error constants within 945 enum. Fix definition of GDBM_BAD_HASH_ENTRY. 946 * src/gdbmclose.c: Fix misleading comment. 947 * src/gdbmconst.h: Define DEFAULT_CACHESIZE to be 948 GDBM_CACHE_AUTO. 949 * src/gdbmopen.c (gdbm_fd_open): Call gdbm_avail_verify if the 950 GDBM_XVERIFY flag is set. 951 952 * doc/gdbm.texi: Update. 953 * doc/gdbm.3: Update. 954 9552021-03-20 Sergey Poznyakoff <gray@gnu.org> 956 957 More optimizations in cache tree 958 959 * src/bucket.c (gdbm_dir_entry_valid_p): Inline 960 (cache_lookup): Keep track of cache hits. 961 (_gdbm_get_bucket): Check the cache_entry first. 962 (gdbm_get_cache_stats): Change signature. Return the per-db 963 number of cache hits as well. 964 * src/cachetree.c: Inline static functions. 965 (_gdbm_cache_tree_lookup): Avoid extra level of indirection 966 (nodeptr) at the expense of one additional comparison. 967 * src/gdbm.h.in (gdbm_get_cache_stats): Change signature. 968 * src/gdbmdefs.h (gdbm_file_info) <cache_hits>: New member. 969 9702021-03-17 Sergey Poznyakoff <gray@gnu.org> 971 972 Fix memory leak in gdbmtool "next" command. 973 974 * src/gdbmtool.c (nextkey_handler): Always free the previous key 975 buffer. 976 9772021-03-17 Sergey Poznyakoff <gray@gnu.org> 978 979 Fix memory leak in gdbmtool "next" command. 980 981 * src/gdbmtool.c (nextkey_handler): Always free the previous key 982 buffer. 983 9842021-03-17 Sergey Poznyakoff <gray@gnu.org> 985 986 New functions for traversing the available space stack 987 988 * src/Makefile.am: Add avail.c 989 * src/avail.c: New file. 990 * src/gdbm.h.in (gdbm_avail_verify): New proto. 991 * src/gdbmdefs.h (GDBM_HEADER_AVAIL_SIZE): New macro. 992 * src/gdbmopen.c (gdbm_avail_table_valid_p) 993 (gdbm_avail_block_validate) 994 (gdbm_bucket_avail_table_validate): Move to avail.c 995 * src/gdbmtool.c (_gdbm_avail_list_size) 996 (_gdbm_print_avail_list): Rewrite using gdbm_avail_traverse. 997 * src/proto.h (gdbm_avail_traverse): New proto. 998 * src/systems.h: Include stddef.h. 999 10002021-03-17 Sergey Poznyakoff <gray@gnu.org> 1001 1002 New functions for traversing the available space stack 1003 1004 * src/Makefile.am: Add avail.c 1005 * src/avail.c: New file. 1006 * src/gdbm.h.in (gdbm_avail_verify): New proto. 1007 * src/gdbmdefs.h (GDBM_HEADER_AVAIL_SIZE): New macro. 1008 * src/gdbmopen.c (gdbm_avail_table_valid_p) 1009 (gdbm_avail_block_validate) 1010 (gdbm_bucket_avail_table_validate): Move to avail.c 1011 * src/gdbmtool.c (_gdbm_avail_list_size) 1012 (_gdbm_print_avail_list): Rewrite using gdbm_avail_traverse. 1013 * src/proto.h (gdbm_avail_traverse): New proto. 1014 * src/systems.h: Include stddef.h. 1015 10162021-03-17 Sergey Poznyakoff <gray@gnu.org> 1017 1018 Follow-up fixes to fd5cf245ea. 1019 1020 These address https://puszcza.gnu.org.ua/bugs/?503 1021 1022 * src/gdbmdefs.h (gdbm_avail_block_valid_p): Remove. 1023 * src/gdbmopen.c (gdbm_avail_block_validate): Use inline 1024 conditional instead of gdbm_avail_block_valid_p. 1025 (gdbm_fd_open): Revert to reading master avail_block in two 1026 passes (as was before fd5cf245ea). 1027 (validate_header): Add back master avail block consistency 1028 check. 1029 * src/gdbmtool.c (_gdbm_avail_list_size): Use 1030 _gdbm_avail_block_read. 1031 * src/recover.c (_gdbm_finish_transfer): Reset dbf->file_size. 1032 10332021-03-17 Sergey Poznyakoff <gray@gnu.org> 1034 1035 Follow-up fixes to fd5cf245ea. 1036 1037 These address https://puszcza.gnu.org.ua/bugs/?503 1038 1039 * src/gdbmdefs.h (gdbm_avail_block_valid_p): Remove. 1040 * src/gdbmopen.c (gdbm_avail_block_validate): Use inline 1041 conditional instead of gdbm_avail_block_valid_p. 1042 (gdbm_fd_open): Revert to reading master avail_block in two 1043 passes (as was before fd5cf245ea). 1044 (validate_header): Add back master avail block consistency 1045 check. 1046 * src/gdbmtool.c (_gdbm_avail_list_size): Use 1047 _gdbm_avail_block_read. 1048 * src/recover.c (_gdbm_finish_transfer): Reset dbf->file_size. 1049 10502021-03-16 Sergey Poznyakoff <gray@gnu.org> 1051 1052 Verify if key/pair ends at a valid offset before attempting to 1053 read it. 1054 1055 This fixes https://puszcza.gnu.org.ua/bugs/index.php?502. 1056 1057 * src/findkey.c (gdbm_bucket_element_valid_p): Verify also if 1058 the key/data pair ends at a valid file offset. 1059 (_gdbm_read_entry): Set up the cache data only on success. 1060 * src/gdbmdefs.h (gdbm_bucket_element_valid_p): Remove 1061 declaration. 1062 (gdbm_file_info): New member 'file_size' keeps the recently 1063 retrieved value of the file size. It is invalidated wherever 1064 data is written to the database. 1065 * src/fullio.c (_gdbm_full_write,_gdbm_file_extend): Invalidate 1066 dbf->file_size. 1067 * src/gdbmopen.c (gdbm_fd_open): Initialize file_size to -1. 1068 (_gdbm_file_size): New function. 1069 * src/mmap.c (_gdbm_file_size): Remove. 1070 * src/proto.h (_gdbm_file_size): New proto. 1071 10722021-03-16 Sergey Poznyakoff <gray@gnu.org> 1073 1074 Improve reading and validation of available blocks 1075 (avail_block). 1076 1077 Fixes http://puszcza.gnu.org.ua/bugs/?501. 1078 1079 * src/falloc.c (_gdbm_avail_block_read): New function. 1080 (pop_avail_block): Use _gdbm_avail_block_read. 1081 * src/gdbmdefs.h: Fix typo in the comment. 1082 * src/gdbmopen.c (gdbm_avail_block_validate): Take size of the 1083 avail block in bytes as the third argument. All uses changed. 1084 (PARTIAL_HEADER_SIZE) 1085 (HEADER_AVAIL_SIZE): New macros. 1086 (_gdbm_validate_header): Validate the avail block as well. 1087 (validate_header): Don't validate the avail block fields here. 1088 (gdbm_fd_open): Read partial header up to the avail field, then 1089 read entire avail block using _gdbm_avail_block_read. 1090 * src/gdbmtool.c (_gdbm_print_avail_list): Fix avail block 1091 calculation 1092 (one extra entry was assumed). Use _gdbm_avail_block_read to 1093 obtain and validate block. 1094 * src/proto.h (_gdbm_avail_block_read): New proto. 1095 (gdbm_avail_block_validate): Change signature. 1096 10972021-03-16 Sergey Poznyakoff <gray@gnu.org> 1098 1099 Fix memory leak in gdbm_recover 1100 1101 * src/recover.c (_gdbm_finish_transfer): Free the cache. 1102 11032021-02-06 Sergey Poznyakoff <gray@gnu.org> 1104 1105 Fix bug #499 1106 1107 See http://puszcza.gnu.org.ua/bugs/?499 1108 1109 * src/gdbm.h.in (GDBM_BAD_HASH_ENTRY): New error code. 1110 * src/gdbmseq.c (get_next_key): Verify the computed hash and 1111 bucket address for the obtained key. 1112 * src/gdbmerrno.c (gdbm_errlist): Add error message for 1113 GDBM_BAD_HASH_ENTRY. 1114 11152021-03-16 Sergey Poznyakoff <gray@gnu.org> 1116 1117 Verify if key/pair ends at a valid offset before attempting to 1118 read it. 1119 1120 This fixes https://puszcza.gnu.org.ua/bugs/index.php?502. 1121 1122 * src/findkey.c (gdbm_bucket_element_valid_p): Verify also if 1123 the key/data pair ends at a valid file offset. 1124 (_gdbm_read_entry): Set up the cache data only on success. 1125 * src/gdbmdefs.h (gdbm_bucket_element_valid_p): Remove 1126 declaration. 1127 (gdbm_file_info): New member 'file_size' keeps the recently 1128 retrieved value of the file size. It is invalidated wherever 1129 data is written to the database. 1130 * src/fullio.c (_gdbm_full_write,_gdbm_file_extend): Invalidate 1131 dbf->file_size. 1132 * src/gdbmopen.c (gdbm_fd_open): Initialize file_size to -1. 1133 (_gdbm_file_size): New function. 1134 * src/mmap.c (_gdbm_file_size): Remove. 1135 * src/proto.h (_gdbm_file_size): New proto. 1136 11372021-03-16 Sergey Poznyakoff <gray@gnu.org> 1138 1139 Follow-up to 40a464d322 1140 1141 * src/bucket.c (bucket_read): New function. 1142 (_gdbm_get_bucket): Use bucket_read. Invalidate bucket in case 1143 of error. 1144 11452021-03-16 Sergey Poznyakoff <gray@gnu.org> 1146 1147 Improve reading and validation of available blocks 1148 (avail_block). 1149 1150 This fixes remaining failures in 1151 http://puszcza.gnu.org.ua/bugs/?501. 1152 1153 * src/falloc.c (_gdbm_avail_block_read): New function. 1154 (pop_avail_block): Use _gdbm_avail_block_read. 1155 * src/gdbmdefs.h: Fix typo in the comment. 1156 * src/gdbmopen.c (gdbm_avail_block_validate): Take size of the 1157 avail block in bytes as the third argument. All uses changed. 1158 (PARTIAL_HEADER_SIZE) 1159 (HEADER_AVAIL_SIZE): New macros. 1160 (_gdbm_validate_header): Validate the avail block as well. 1161 (validate_header): Don't validate the avail block fields here. 1162 (gdbm_fd_open): Read partial header up to the avail field, then 1163 read entire avail block using _gdbm_avail_block_read. 1164 * src/gdbmtool.c (_gdbm_print_avail_list): Fix avail block 1165 calculation 1166 (one extra entry was assumed). Use _gdbm_avail_block_read to 1167 obtain and validate block. 1168 * src/proto.h (_gdbm_avail_block_read): New proto. 1169 (gdbm_avail_block_validate): Change signature. 1170 11712021-03-15 Sergey Poznyakoff <gray@gnu.org> 1172 1173 Don't leave erroneous bucket in GDBM_FILE if _gdbm_get_bucket 1174 fails 1175 1176 This fixes most of bug #501 1177 (http://puszcza.gnu.org.ua/bugs/?501). 1178 1179 * src/bucket.c (_gdbm_get_bucket): Reinitialize dbf->bucket to 1180 NULL before returning failure. 1181 11822021-02-06 Sergey Poznyakoff <gray@gnu.org> 1183 1184 Fix bug #499 1185 1186 See http://puszcza.gnu.org.ua/bugs/?499 1187 1188 * src/gdbm.h.in (GDBM_BAD_HASH_ENTRY): New error code. 1189 * src/gdbmseq.c (get_next_key): Verify the computed hash and 1190 bucket address for the obtained key. 1191 * src/gdbmerrno.c (gdbm_errlist): Add error message for 1192 GDBM_BAD_HASH_ENTRY. 1193 11942021-01-09 Sergey Poznyakoff <gray@gnu.org> 1195 1196 Merge branch 'master' into newcache 1197 1198 11992021-01-09 Sergey Poznyakoff <gray@gnu.org> 1200 1201 Minor changes 1202 1203 * src/hash.c (_gdbm_hash): Suppress address sanitizer errors. 1204 * src/proto.h (gdbm_file_sync): Add missing return. 1205 * src/lex.l (input_context_pop): Delete current buffer when tos 1206 is reached. 1207 12082021-01-08 Sergey Poznyakoff <gray@gnu.org> 1209 1210 Reword some messages and add translator comments. 1211 1212 * src/gdbmtool.c: Avoid duplicating the GDBM_BAD_AVAIL message. 1213 Add translator comments. 1214 * src/gdbmerrno.c: Add translator comments. 1215 * src/util.c: Likewise. 1216 12172021-01-02 Sergey Poznyakoff <gray@gnu.org> 1218 1219 Update copyright years 1220 1221 12222021-01-02 Sergey Poznyakoff <gray@gnu.org> 1223 1224 Update copyright years 1225 1226 12272020-12-24 Sergey Poznyakoff <gray@gnu.org> 1228 1229 Merge branch 'master' into newcache 1230 1231 12322020-12-24 Sergey Poznyakoff <gray@gnu.org> 1233 1234 Fix the use of unprefixed dnl in configure.ac 1235 1236 12372020-12-23 Sergey Poznyakoff <gray@gnu.org> 1238 1239 Version 1.19 1240 1241 12422020-12-23 Sergey Poznyakoff <gray@gnu.org> 1243 1244 Update the docs 1245 1246 * doc/Makefile.am: Use gendocs.pl to generate web version of the 1247 manual. 1248 * doc/gdbm.texi: Update. 1249 * doc/gendocs.pl: New file. 1250 * doc/otherdoc.texi.in: New file. 1251 * doc/.gitignore: Ignore otherdoc.texi. 1252 * doc/webdoc.init: New file. 1253 * doc/gendocs.sh: Remove. 1254 * doc/gendocs_template: Remove. 1255 * doc/html.init: Remove. 1256 12572020-01-27 Sergey Poznyakoff <gray@gnu.org.ua> 1258 1259 Update copyright years 1260 1261 12622020-12-23 Sergey Poznyakoff <gray@gnu.org> 1263 1264 Remove duplicate global declarations 1265 1266 * src/gdbm_dump.c: Add missing I18N. 1267 * src/gdbm_load.c: Likewise. 1268 * src/parseopt.c (parseopt_program_doc) 1269 (parseopt_program_args): Remove duplicate declarations. 1270 12712020-10-31 Sergey Poznyakoff <gray@gnu.org> 1272 1273 Recover from ENOMEM in cache_lookup 1274 1275 * src/bucket.c (cache_lookup): Try to recover from ENOMEM by 1276 freeing the least recently used cache entry. 1277 12782020-10-29 Sergey Poznyakoff <gray@gnu.org> 1279 1280 Minor changes. 1281 1282 * src/bucket.c (_gdbm_cache_init): Minimum cache capacity is 1. 1283 * src/cachetree.c (_gdbm_cache_tree_lookup): Fix the 1284 description. 1285 (_gdbm_cache_tree_destroy): Speed up the tree traversal. 1286 * src/gdbmsetopt.c (setopt_gdbm_setcachesize): Don't enforce 1287 minimal cache capacity. 1288 12892020-10-09 Sergey Poznyakoff <gray@gnu.org> 1290 1291 Implement tagged structure initializers. 1292 1293 * NEWS: Document changes. 1294 * doc/gdbm.texi: Document changes. 1295 * src/datconv.c (datum_scan_tag): Implement tagged structure 1296 initialization. 1297 * src/gdbmtool.c (kvlist_free): Made extern. 1298 (kvlist_find): New function. 1299 * src/gdbmtool.h (kvlist_find, kvlist_free) 1300 (dsegm_list_find): New protos. 1301 (dsegm_free_list): Rename to dsegm_list_free. All uses changed. 1302 * src/gram.y: Forbid duplicate tags in kvlist. 1303 13042020-10-08 Sergey Poznyakoff <gray@gnu.org> 1305 1306 Bugfixes. 1307 1308 * doc/gdbm.texi: Fix the description of a sample content 1309 structure. 1310 * src/datconv.c (datum_scan_notag): Proceed to the next kvpair 1311 only for segments of the FDEF_FLD type. 1312 13132020-03-15 Sergey Poznyakoff <gray@gnu.org> 1314 1315 Implement the gdbm_bucket_count function. 1316 1317 * src/gdbmcount.c (gdbm_bucket_count): New function. 1318 * src/gdbm.h.in (gdbm_bucket_count): New proto. 1319 * doc/gdbm.texi: Document gdbm_bucket_count. 1320 * src/gdbmtool.c (bucket_count): Reimplement via 1321 gdbm_bucket_count. 1322 13232020-01-27 Sergey Poznyakoff <gray@gnu.org.ua> 1324 1325 Update copyright years 1326 1327 13282020-01-27 Sergey Poznyakoff <gray@gnu.org.ua> 1329 1330 Minor changes 1331 1332 * src/cachetree.c (_gdbm_node_set_elem): Remove function. 1333 * src/findkey.c: Finalize efaefe4c. 1334 13352019-11-16 Sergey Poznyakoff <gray@gnu.org> 1336 1337 Simplify memory allocation 1338 1339 * src/gdbmdefs.h (cache_elem): Place one hash_bucket element at 1340 the end of the structure so it can be allocated along with it. 1341 * src/bucket.c (cache_elem_new): Allocate enough space for 1342 cache_elem and dbf->header->bucket_size hash bucket within. 1343 13442019-11-13 Sergey Poznyakoff <gray@gnu.org.ua> 1345 1346 Move cache element allocation to bucket.c. 1347 1348 * src/bucket.c (_gdbm_cache_elem_new): Rename to cache_elem_new. 1349 Make static. 1350 (cache_lookup): Allocate new elem if _gdbm_cache_tree_lookup 1351 returned node_new. 1352 * src/cachetree.c (cache_tree): Remove dbf. 1353 (_gdbm_cache_tree_delete): Use node->adr. 1354 (cache_tree_lookup): Rename to _gdbm_cache_tree_lookup. Change 1355 signature. Return pointer to the (found or inserted) node. Don't 1356 allocate elem, this is responsibility of the caller. 1357 (_gdbm_cache_tree_alloc): Change signature. 1358 * src/gdbmdefs.h (cache_node): New definition (from cachetree.c) 1359 * src/proto.h: Fix protos. 1360 13612019-11-13 Sergey Poznyakoff <gray@gnu.org.ua> 1362 1363 Namespace cleanup 1364 1365 * src/proto.h (_gdbm_cache_tree_delete): Remove. 1366 (_gdbm_rbt_remove_node): Rename to _gdbm_cache_tree_delete. All 1367 uses changed 1368 13692019-11-13 Sergey Poznyakoff <gray@gnu.org.ua> 1370 1371 Don't cache data pages 1372 1373 * src/findkey.c (_gdbm_read_entry): Revert dc176a5c 1374 13752019-11-12 Sergey Poznyakoff <gray@gnu.org> 1376 1377 Rewrite bucket cache 1378 1379 The new bucket cache uses the least recently used replacement 1380 policy (instead of the least recently read, implemented 1381 previously). It also allows for quick bucket lookups by the 1382 corresponding disk address. To this effect the cache entries 1383 form a red-black tree sorted by bucket address. 1384 1385 Additionally, data buckets are also cached. 1386 1387 * README: Describe the new branch. 1388 * src/bucket.c: Rewrite cache support. 1389 * src/cachetree.c: New file. 1390 * src/Makefile.am: Add new file. 1391 * src/findkey.c (_gdbm_read_entry): Use _gdbm_fetch_data. This 1392 ensures data pages are cached as well as buckets. 1393 * src/gdbm.h.in (GDBM_BUCKET_CACHE_CORRUPTED): New error code. 1394 (gdbm_cache_stat): New struct. 1395 (gdbm_get_cache_stats): New proto. 1396 * src/gdbmclose.c (gdbm_close): Call _gdbm_cache_free to dispose 1397 of the cache. 1398 * src/gdbmdefs.h (cache_elem_color): New data type. 1399 (cache_elem): New members: ca_left, ca_right, ca_node, and 1400 ca_hits. 1401 (cache_tree): New typedef. 1402 (gdbm_file_info): Remove bucket_cache and last_read. New fields: 1403 cache_num, cache_tree, cache_mru, cache_lru, cache_avail, 1404 cache_access_count. 1405 * src/gdbmerrno.c: Handle GDBM_BUCKET_CACHE_CORRUPTED. 1406 * src/gdbmopen.c (gdbm_fd_open): Change cache initialization. 1407 (_gdbm_init_cache, _gdbm_cache_entry_invalidate: Remove. 1408 * src/gdbmsetopt.c (setopt_gdbm_setcachesize): Cache can be 1409 re-initialized on the fly. 1410 * src/gdbmtool.c: Change bucket printing routines. 1411 * src/proto.h (_gdbm_read_bucket_at): Remove. 1412 (_gdbm_fetch_data,_gdbm_cache_init,_gdbm_cache_free) 1413 (_gdbm_cache_flush,_gdbm_cache_elem_new) 1414 (_gdbm_cache_tree_alloc,_gdbm_cache_tree_destroy) 1415 (_gdbm_cache_tree_delete,_gdbm_rbt_remove_node) 1416 (_gdbm_cache_tree_lookup): New protos. 1417 (_gdbm_init_cache,_gdbm_cache_entry_invalidate): Remove. 1418 * src/recover.c (_gdbm_finish_transfer): Adapt to the new cache 1419 structure. 1420 * src/update.c: Likewise. 1421 * tests/setopt00.at: Fix second GDBM_SETCACHESIZE test. 1422 14232019-10-29 Sergey Poznyakoff <gray@gnu.org> 1424 1425 Pre-read the memory mapped regions on systems that support it 1426 1427 * src/mmap.c (GDBM_MMAP_FLAGS): Define to MAP_POPULATE or 1428 MAP_PREFAULT_READ, if available. 1429 (_gdbm_internal_remap): Use GDBM_MMAP_FLAGS. 1430 14312019-10-29 Sergey Poznyakoff <gray@gnu.org> 1432 1433 Minor changes 1434 1435 * src/gdbmconst.h: Don't redefine SIZE_T_MAX 1436 * src/gdbmtool.c: Likewise. Include <termios.h>, instead of 1437 <sys/termios.h> 1438 * configure.ac: Don't check for termios.h 1439 * tests/closerr.c: Minor fixes. 1440 14412019-04-08 Sergey Poznyakoff <gray@gnu.org> 1442 1443 Update copyright years 1444 1445 14462019-04-08 Sergey Poznyakoff <gray@gnu.org> 1447 1448 Preserve locking type during database reorganization 1449 1450 * src/recover.c (_gdbm_finish_transfer): Preserve locking type. 1451 14522018-11-27 Sergey Poznyakoff <gray@gnu.org> 1453 1454 Fix typo in the manpage. 1455 1456 14572018-10-27 Sergey Poznyakoff <gray@gnu.org> 1458 1459 Version 1.18.1 1460 1461 14622018-10-18 Sergey Poznyakoff <gray@gnu.org> 1463 1464 Restore backward compatibility with older databases 1465 1466 * src/gdbmopen.c (validate_header): Silently accept databases 1467 with next_block pointing beyond end of file. 1468 14692018-10-18 Sergey Poznyakoff <gray@gnu.org> 1470 1471 Attempt recovery in case of invalid next_block header field 1472 1473 * src/gdbmopen.c (validate_header): Return GDBM_NEED_RECOVERY if 1474 next_block is invalid. 1475 (_gdbm_validate_header): New function. 1476 (gdbm_fd_open): Set need_recovery depending on return from 1477 validate_header. 1478 (gdbm_open): Bail out on invalid value of GDBM_OPENMASK bits. 1479 * src/proto.h (_gdbm_validate_header): New proto. 1480 * src/recover.c (check_db): Re-validate the header. 1481 * src/gdbmtool.c (export_handler): Fix option processing. 1482 14832018-08-31 Sergey Poznyakoff <gray@gnu.org> 1484 1485 Various bugfixes. 1486 1487 * compat/dbmopen.c (ndbm_open_dir_file0): Ignore ENOENT. 1488 * src/falloc.c (push_avail_block): Free temporary storage no 1489 matter what return status. 1490 * src/gdbm.h.in (GDBM_FILE_TRUNCATE_ERROR): New error code. 1491 * src/gdbmdump.c (_gdbm_dump_ascii): Initialize rc. 1492 * src/gdbmerrno.c: Handle new error.code 1493 * src/gdbmload.c (gdbm_load_bdb_dump): Initialize rc 1494 * src/gdbmopen.c (_gdbm_ftruncate): New function. 1495 (gdbm_fd_open): Use _gdbm_ftruncate. Check its return. 1496 * src/gdbmseq.c (gdbm_firstkey): Initialize dsize 1497 * src/gdbmtool.c (command_generator): Check if cmd is NULL. 1498 (shouldn't happen, but anyways). 1499 * src/mmap.c (_gdbm_mapped_lseek): Check for vailidity of the 1500 'whence' parameter. 1501 * src/systems.h (TRUNCATE): Remove macro. 1502 * src/util.c (vgetyn): Remove unnecessary assignment. 1503 15042018-08-21 Sergey Poznyakoff <gray@gnu.org> 1505 1506 Version 1.18 1507 1508 15092018-08-19 Sergey Poznyakoff <gray@gnu.org> 1510 1511 Fix directory entry validation. 1512 1513 Bug reported by Miroslav Lichvar and Marek Skalický 1514 1515 * src/bucket.c (gdbm_dir_entry_valid_p): Fix lower limit for the 1516 allowed bucket address. Initial allocation of second block for 1517 the directory can be eventually returned to the available list 1518 when the directory is expanded during bucket splitting. 1519 15202018-08-12 Sergey Poznyakoff <gray@gnu.org> 1521 1522 Bugfix 1523 1524 * src/gdbmdump.c (_gdbm_dump_ascii): Clear the 1525 GDBM_ITEM_NOT_FOUND error. 1526 * src/gdbmexp.c (gdbm_export_to_file): Likewise. 1527 * NEWS: Update. 1528 15292018-08-03 Sergey Poznyakoff <gray@gnu.org> 1530 1531 Bugfix 1532 1533 * src/gdbmopen.c (gdbm_avail_table_valid_p): Fix improper use of 1534 the GDBM_DEBUG macro. 1535 15362018-07-31 Sergey Poznyakoff <gray@gnu.org> 1537 1538 Bugfix 1539 1540 * src/gdbmsync.c (gdbm_sync): Always return a meaningful value 1541 15422018-07-30 Sergey Poznyakoff <gray@gnu.org> 1543 1544 Version 1.17 1545 1546 15472018-07-02 Sergey Poznyakoff <gray@gnu.org> 1548 1549 Bugfixes 1550 1551 * src/recover.c (backup_name): Fix memory overwrite. 1552 * src/gdbmtool.c (recover_handler): New option "force". 1553 15542018-07-01 Sergey Poznyakoff <gray@gnu.org> 1555 1556 Change return value of gdbm_close and gdbm_sync 1557 1558 * src/gdbm.h.in (gdbm_close, gdbm_sync): Return int 1559 (GDBM_FILE_CLOSE_ERROR, GDBM_FILE_SYNC_ERROR): New error codes. 1560 * src/gdbmclose.c (gdbm_close): Return 0 on success, -1 on 1561 failure. Set gdbm_errno and errno. 1562 * src/gdbmsync.c (gdbm_sync): Likewise. 1563 * src/gdbmerrno.c: Handle new error codes. 1564 * src/mmap.c (_gdbm_mapped_sync): Set gdbm_errno. 1565 * src/proto.h (gdbm_file_sync): Set gdbm_errno. 1566 1567 * doc/gdbm.3: Document changes. 1568 * doc/gdbm.texi: Document changes. 1569 * NEWS: Document changes. 1570 * configure.ac: Set patchlevel. 1571 1572 * tests/Makefile.am: Add new test. 1573 * tests/testsuite.at: Add new test. 1574 * tests/closerr.at: New test case. 1575 * tests/closerr.c: New test program. 1576 * tests/gtdel.c: Check gdbm_close return. 1577 * tests/gtdump.c: Likewise. 1578 * tests/gtfetch.c: Likewise. 1579 * tests/gtload.c: Likewise. 1580 * tests/gtopt.c: Likewise. 1581 * tests/gtrecover.c: Likewise. 1582 15832018-06-27 Sergey Poznyakoff <gray@gnu.org> 1584 1585 Version 1.16 1586 1587 15882018-06-27 Sergey Poznyakoff <gray@gnu.org> 1589 1590 Fix typo 1591 1592 15932018-06-27 Sergey Poznyakoff <gray@gnu.org> 1594 1595 New gdbmtool variables: coalesce and centfree 1596 1597 The two boolean variables control the use of free block 1598 coalescing and central free block modes in newly opened 1599 databases. 1600 16012018-06-27 Sergey Poznyakoff <gray@gnu.org> 1602 1603 Coalesce mode: take into account both left- and right-adjacent 1604 slots. 1605 1606 * src/falloc.c (avail_lookup): Remove the start parameter. 1607 (avail_move): Take pointer to the count of entries in av_table. 1608 Update the pointed to value after performing the move. All uses 1609 changed. 1610 (_gdbm_put_av_elem): Rewrite the "can_merge" loop. 1611 16122018-06-25 Sergey Poznyakoff <gray@gnu.org> 1613 1614 Optimize operations on avail lists. 1615 1616 Use binary search for look-ups. 1617 1618 * src/falloc.c (avail_lookup, avail_move): New functions. 1619 (get_elem): Use avail_lookup to search. 1620 (_gdbm_put_av_elem): Use avail_lookup and avail_move to handle 1621 the avail table. In coalesce mode, store the index of the 1622 greater than or equal entry to avoid extra lookup in case no 1623 suitable entry is found. 1624 16252018-06-23 Sergey Poznyakoff <gray@gnu.org> 1626 1627 Bugfixes. Consistently use the coalesce_blocks flag. 1628 1629 * src/bucket.c (_gdbm_split_bucket): Take into account 1630 coalesce_blocks 1631 * src/falloc.c (_gdbm_put_av_elem): Change to void return. All 1632 uses changed. 1633 * src/proto.h: Likewise. 1634 16352018-06-23 Sergey Poznyakoff <gray@gnu.org> 1636 1637 Fix the previous patch 1638 1639 16402018-06-23 Sergey Poznyakoff <gray@gnu.org> 1641 1642 Silently restore sorting order of avail array when checking it. 1643 1644 * src/gdbmdefs.h (gdbm_avail_table_valid_p): Remove const 1645 qualifier from the AV parameter. 1646 * src/gdbmopen.c (gdbm_avail_table_valid_p): Don't insist on 1647 proper ordering of the array. Restore it if neccessary. 1648 16492018-06-23 Sergey Poznyakoff <gray@gnu.org> 1650 1651 Maintain correct ordering of the avail table after coalescing. 1652 1653 * src/falloc.c (_gdbm_put_av_elem): Float the merged entry to 1654 its proper position to preserve the sorting order. 1655 * THANKS: Thanks Adam Sampson 1656 16572018-06-23 Sergey Poznyakoff <gray@gnu.org> 1658 1659 Fix typo 1660 1661 16622018-06-16 Sergey Poznyakoff <gray@gnu.org> 1663 1664 Version 1.5 1665 1666 * configure.ac: Version 1.5 1667 * NEWS: Update. 1668 * src/Makefile.am (VI_CURRENT): Increment to 6 1669 * src/bucket.c (_gdbm_get_bucket): Fix the upper limit for 1670 bucket_bits. 1671 * src/falloc.c (push_avail_block): Fill the allocated block with 1672 0s. 1673 16742018-05-30 Sergey Poznyakoff <gray@gnu.org> 1675 1676 More error checking 1677 1678 * src/bucket.c (_gdbm_get_bucket): Check if bucket_bits value is 1679 valid. 1680 * src/gdbmtool.c (_gdbm_print_avail_list): Reverse the sense of 1681 the conditional (fix regression). 1682 16832018-05-30 Sergey Poznyakoff <gray@gnu.org> 1684 1685 Avoid unnecessary memory reallocations during caching 1686 1687 * src/findkey.c (_gdbm_read_entry): Reallocate 1688 cache_entry->ca_data.dptr only if necessary. 1689 * src/gdbmdefs.h (data_cache_elem): New member: dsize 1690 * src/gdbmdelete.c: Don't free cache_entry->ca_data.dptr 1691 * src/gdbmopen.c (_gdbm_init_cache): Initialize ca_data.dsize 1692 16932018-05-30 Sergey Poznyakoff <gray@gnu.org> 1694 1695 Rewrite gdbm_file_write etc. as inline functions. 1696 1697 16982018-05-30 Sergey Poznyakoff <gray@gnu.org> 1699 1700 Fix the legacy operation (--disable-mmapped-io) 1701 1702 * src/mmap.c (_gdbm_file_extend): Move to ... 1703 * src/fullio.c: ... here 1704 * src/proto.h (_gdbm_file_extend): New proto. 1705 * src/gdbmopen.c (gdbm_fd_open): Make sure the file size equals 1706 header->next_block. 1707 * src/gdbmsetopt.c [!HAVE_MMAP]: Don't disable GDBM_GETFLAGS. 1708 * src/update.c (_gdbm_end_update): Make sure disk file ends on 1709 header->next_block. 1710 17112018-05-30 Sergey Poznyakoff <gray@gnu.org> 1712 1713 Namespace cleanup 1714 1715 Rename: __read to gdbm_file_read 1716 __write to gdbm_file_write 1717 __lseek to gdbm_file_seek 1718 __fsync to gdbm_file_sync 1719 17202018-05-30 Sergey Poznyakoff <gray@gnu.org> 1721 1722 Drop debugging hooks 1723 1724 The hooks were introduced as a temporary tool in de7834e9. They 1725 did their job and are not necessary any more. 1726 17272018-05-30 Sergey Poznyakoff <gray@gnu.org> 1728 1729 gdbmtool: bugfixes 1730 1731 * src/gdbmtool.c (print_bucket_begin): Check return value from 1732 _gdbm_get_bucket. 1733 (source_handler): Don't gtry to push NULL stream. 1734 17352018-05-30 Sergey Poznyakoff <gray@gnu.org> 1736 1737 Fix memory leak in _gdbm_get_bucket 1738 1739 17402018-05-30 Sergey Poznyakoff <gray@gnu.org> 1741 1742 Fix memory leaks in handling history (gdbmtool) and in 1743 gdbm_recover 1744 1745 17462018-05-29 Sergey Poznyakoff <gray@gnu.org> 1747 1748 Minor changes 1749 1750 * src/gdbmtool.c: Reduce memory consuption in -random mode. Some 1751 minor bugfixes as well. 1752 17532018-05-28 Sergey Poznyakoff <gray@gnu.org> 1754 1755 Improve num2word 1756 1757 * tests/num2word.c: New options: -revert and -random 1758 17592018-05-26 Sergey Poznyakoff <gray@gnu.org> 1760 1761 Additional validation of avail_table. 1762 1763 Verify that avail_table is sorted by size and that each 1764 element's size falls within allowed range. 1765 1766 * src/bucket.c (gdbm_get_bucket): Fix bucket validation. 1767 Validate bucket_avail. 1768 (_gdbm_split_bucket): Check return from _gdbm_free. 1769 * src/falloc.c (adjust_bucket_avail,_gdbm_free): Return error 1770 code. All uses updated. 1771 (pop_avail_block): Fix eventual memory leak. Use 1772 gdbm_avail_block_validate. 1773 * src/gdbmdefs.h (gdbm_avail_table_valid_p): Change signature. 1774 * src/gdbmopen.c (gdbm_avail_table_valid_p): Traverse the array 1775 verifying address and size of each element. 1776 (gdbm_avail_block_validate) 1777 (gdbm_bucket_avail_table_validate): New functions. 1778 (validate_header): Remove call to gdbm_avail_block_valid_p. 1779 Avail_block is validated later, after it's been loaded. Bail out 1780 if header->next_block does not equal the file size. 1781 (gdbm_fd_open): Validate avail_block. 1782 * src/gdbmstore.c (_gdbm_store): Check return from _gdbm_free. 1783 Avoid endless loop in case of inconsistent h_table. 1784 * src/gdbmtool.c (_gdbm_print_avail_list): Use 1785 gdbm_avail_block_validate. 1786 * src/proto.h: Update. 1787 * tests/gtload.c: Improve error diagnostics. 1788 17892018-05-26 Sergey Poznyakoff <gray@gnu.org> 1790 1791 gdbmtool: quote special characters in command line input 1792 1793 17942018-05-25 Sergey Poznyakoff <gray@gnu.org> 1795 1796 configure: emit a notice if --enable-gdbmtool-debug is used 1797 1798 17992018-05-25 Sergey Poznyakoff <gray@gnu.org> 1800 1801 More database consistency checks 1802 1803 * NEWS: Update. 1804 * THANKS: Update. 1805 * src/bucket.c (_gdbm_get_bucket): Check if directory entry is 1806 valid. Don't cache invalid buckets. 1807 * src/gdbm.h.in (GDBM_BAD_DIR_ENTRY): New error code. 1808 * src/gdbmerrno.c: Likewise. 1809 * src/gdbmopen.c (validate_header): Compute expected number of 1810 bucket elements based on the bucket size, not on the block size. 1811 (_gdbm_init_cache_entry): New function. 1812 * src/proto.h (_gdbm_init_cache_entry): New proto. 1813 * src/recover.c (gdbm_recover): Clear error state after return 1814 from check_db indicating failure. 1815 18162018-05-24 Sergey Poznyakoff <gray@gnu.org> 1817 1818 Various fixes 1819 1820 * src/input-std.c: Bugfix 1821 * doc/gdbm.texi: Document changes. 1822 * README: Update. 1823 * configure.ac: New option --enable-gdbmtool-debug. 1824 * src/Makefile.am: Conditionally augment AM_YFLAGS and AM_LFLAGS 1825 with options that enable debugging. 1826 * src/gdbmtool.c: Conditionally enable --lex-trace and 1827 --gram-trace options. 1828 * src/gram.y: Likewise. 1829 * src/lex.l: Likewise. 1830 * tests/Makefile.am: Remove architecure-dependent tests. 1831 * tests/testsuite.at: Likewise. 1832 18332018-05-24 Sergey Poznyakoff <gray@gnu.org> 1834 1835 More input checking fixes 1836 1837 * src/gdbmdefs.h (gdbm_avail_block_valid_p): Minimal capacity of 1838 an avail_block is 1 (one entry is stored in the block itself). 1839 * src/gdbmopen.c (gdbm_avail_table_valid_p): New function. 1840 (validate_header): Fix verification of dir_size and dir_bits. 1841 Verify avail.size. 1842 * src/falloc.c (pop_avail_block): Use gdbm_avail_table_valid_p 1843 * src/gdbmtool.c (_gdbm_print_avail_list): Likewise. 1844 18452018-05-24 Sergey Poznyakoff <gray@gnu.org> 1846 1847 Bugfix 1848 1849 * tests/Makefile.am (EXTRA_DIST): Add missing file. 1850 18512018-05-24 Sergey Poznyakoff <gray@gnu.org> 1852 1853 More error checking; improve gdbm_recover 1854 1855 * Makefile.am (set-dist-date): New rule 1856 (dist-hook): Catch FIXMEs in NEWS. 1857 * NEWS: Updated. 1858 * src/findkey.c (gdbm_bucket_element_valid_p): New function. 1859 (_gdbm_read_entry): Validate the retrieved bucket element. 1860 * src/gdbm.h.in (gdbm_recovery): New member: duplicate_keys. 1861 (GDBM_BAD_HASH_TABLE): New error code. 1862 * src/gdbmdefs.h (TYPE_WIDTH,SIGNED_TYPE_MAXIMUM) 1863 (OFF_T_MAX): New defines. 1864 (off_t_sum_ok): New function. 1865 (gdbm_bucket_element_valid_p): New prototype. 1866 * src/gdbmerrno.c: Support for GDBM_BAD_HASH_TABLE code. 1867 * src/gdbmtool.c (recover_handler): Fix argument counting. New 1868 argument 'summary' prints statistics summary at the end of the 1869 run. 1870 (export_handler,import_handler): Fix argument counting. 1871 * src/mmap.c (SUM_FILE_SIZE): Rewrite as inlined function. Add 1872 error checking. 1873 (_gdbm_mapped_remap): More error checking. 1874 * src/recover.c (run_recovery): Don't bail out on 1875 GDBM_CANNOT_REPLACE. 1876 (gdbm_recover): Initialize duplicate_keys 1877 * src/systems.h: Include limits.h 1878 18792018-05-24 Sergey Poznyakoff <gray@gnu.org> 1880 1881 Fix the use of return code from _gdbm_full_(read|write) 1882 functions 1883 1884 18852018-05-24 Sergey Poznyakoff <gray@gnu.org> 1886 1887 error checking: check for avail_block consistency before using 1888 it 1889 1890 * src/gdbmdefs.h (gdbm_avail_block_valid_p): New function. 1891 * src/gdbm.h.in (GDBM_BAD_AVAIL): New error code. 1892 * src/gdbmerrno.c: Support new error code. 1893 * src/falloc.c (pop_avail_block): Validate the avail_block 1894 * src/gdbmopen.c (validate_header): Validate the avail_block. 1895 * src/gdbmtool.c (_gdbm_avail_list_size) 1896 (_gdbm_print_avail_list): Validate the avail_block. 1897 18982018-05-24 Sergey Poznyakoff <gray@gnu.org> 1899 1900 Add new test 1901 1902 19032018-05-24 Sergey Poznyakoff <gray@gnu.org> 1904 1905 gdbmtool: fix data conversion when storing structured content. 1906 1907 * src/datconv.c (DEFNSCAN): Use proper target type to store in 1908 datum. 1909 (datum_scan_notag): Accept C-like initialization of array of 1910 characters by a quoted string. 1911 19122018-05-23 Sergey Poznyakoff <gray@gnu.org> 1913 1914 gdbmtool: accept commands from command line as well as from file 1915 1916 Commands can be supplied to gdbmtool in three ways: 1917 1918 1. From a file, using the --file (-f) option: 1919 1920 gdbmtool -f comfile 1921 1922 2. From the command line, if first argument is the database 1923 name: 1924 1925 gdbmtool test.db count \; fetch mykey \; avail 1926 1927 Note the use of semicolon to delimit commands. 1928 1929 3. From the interactive shell, if neither of the above is used. 1930 1931 * src/Makefile.am: Add new sources. 1932 * src/gdbmtool.c: Use new stream functions for input. 1933 * src/gdbmtool.h (setsource): Remove proto. 1934 (instream_t): New data type. 1935 (instream_name, instream_read) 1936 (instream_close, instream_interactive) 1937 (instream_eq): New functions. 1938 (instream_stdin_create) 1939 (instream_argv_create) 1940 (instream_file_create) 1941 (interactive, input_context_push): New protos. 1942 * src/gram.y: Accept ; in place of newline. 1943 * src/input-argv.c: New file. 1944 * src/input-file.c: New file. 1945 * src/input-rl.c: Rewrite to provide instream_t API. 1946 * src/input-std.c: Likewise. 1947 * src/lex.l: Rewrite. 1948 * tests/.gitignore: Update. 1949 * tests/Makefile.am: Add new tests. Incorporate DejaGNU tests. 1950 * tests/config/default.exp: New file. 1951 * tests/gdbmtool/base.exp: New file. 1952 * tests/gdbmtool00.at: New file. 1953 * tests/gdbmtool01.at: New file. 1954 * tests/gdbmtool02.at: New file. 1955 * tests/testsuite.at: Include new tests. 1956 19572018-05-19 Sergey Poznyakoff <gray@gnu.org> 1958 1959 Remove gdbm-1.8.3 compatibility layer 1960 1961 * configure.ac: Remove gdbm-1.8.3 compatibility layer. Version 1962 1.14.90 1963 * Makefile.am (ACLOCAL_AMFLAGS): Remove deprecated variable. 1964 (MAYBE_EXPORT): Remove variable and conditional. 1965 * NEWS: Update. 1966 * NOTE-WARNING: Update. 1967 * README: Update. 1968 * doc/gdbm.texi: Update. 1969 * export/.gitignore: Remove. 1970 * export/Makefile.am: Remove. 1971 * export/export.c: Remove. 1972 19732018-05-19 Sergey Poznyakoff <gray@gnu.org> 1974 1975 Catch more errors 1976 1977 * src/gdbmdump.c (_gdbm_dump_ascii): Break on errors 1978 * src/gdbmopen.c (compute_directory_size): Remove unused 1979 argument. 1980 (validate_header): Catch dir_size and dir_bits mismatches. 1981 * src/mmap.c (_gdbm_mapped_lseek): Bail out on negative offsets. 1982 * tests/dump03.at: New test. 1983 * tests/dump04.at: New test. 1984 * tests/Makefile.am: Add new tests. 1985 * tests/testsuite.at: Add new tests. 1986 19872018-05-19 Sergey Poznyakoff <gray@gnu.org> 1988 1989 Add new tests 1990 1991 * src/gdbm_dump.c: Fix exit code. 1992 * configure.ac: Determine presence of gzip and base64 1993 (GZIP_BIN,BASE64_BIN): New variables. 1994 * tests/atlocal.in (GZIP_BIN,BASE64_BIN): New variables. 1995 * tests/dump00.at: New file. 1996 * tests/dump01.at: New file. 1997 * tests/dump02.at: New file. 1998 * tests/Makefile.am: Add new tests. 1999 * tests/testsuite.at: Add new tests. 2000 20012018-05-19 Sergey Poznyakoff <gray@gnu.org> 2002 2003 Improve error checking 2004 2005 * src/bucket.c (_gdbm_get_bucket): Improve validation. 2006 * src/fullio.c (_gdbm_full_read,_gdbm_full_write): Don't 2007 overwrite an already set error. 2008 * src/gdbm.h.in (GDBM_WRONG_OFF_T): Merge with 2009 GDBM_BAD_FILE_OFFSET. 2010 (GDBM_BAD_HEADER): New error code. 2011 * src/gdbmdump.c (_gdbm_dump_ascii): Check for database error 2012 code. 2013 * src/gdbmerrno.c (gdbm_errlist): Add GDBM_BAD_HEADER 2014 * src/gdbmopen.c (validate_header: Imporve logic. 2015 (_gdbm_init_cache): Initialize bucket_cache 2016 * src/gdbmseq.c (gdbm_firstkey): Check return value from 2017 _gdbm_get_bucket. 2018 * src/mmap.c (_gdbm_mapped_remap): Bail out if current position 2019 is bigger than file size. 2020 20212018-05-19 Sergey Poznyakoff <gray@gnu.org> 2022 2023 Fix typo 2024 2025 20262018-05-16 Sergey Poznyakoff <gray@gnu.org> 2027 2028 Improve database file safety checks. 2029 2030 * src/bucket.c (_gdbm_get_bucket): Verify bucket consistency. 2031 * src/gdbm.h.in (GDBM_BAD_BUCKET, GDBM_WRONG_ARCH): New error 2032 codes. 2033 * src/gdbmerrno.c (gdbm_errlist): New error codes. 2034 * src/gdbmopen.c (gdbm_fd_open): Improve header consistency 2035 checks. 2036 20372018-01-03 Sergey Poznyakoff <gray@gnu.org> 2038 2039 Bump library current version number 2040 2041 20422018-01-01 Sergey Poznyakoff <gray@gnu.org> 2043 2044 Version 1.14 2045 2046 20472018-01-01 Sergey Poznyakoff <gray@gnu.org> 2048 2049 Happy GNU Year 2050 2051 20522017-12-23 Sergey Poznyakoff <gray@gnu.org> 2053 2054 Fix build with --enable-gdbm-export 2055 2056 * THANKS: Add Jakub Bogusz 2057 * export/export.c: Define GDBM_EXPORT_18 prior to including 2058 gdbmexp.c 2059 * src/gdbmexp.c [GDBM_EXPORT_18]: Define GDBM_SET_ERRNO and 2060 GDBM_ASSERT_CONSISTENCY. 2061 20622017-12-23 Sergey Poznyakoff <gray@gnu.org> 2063 2064 Bugfix 2065 2066 * src/gdbmsetopt.c: Ignore NULL entries 2067 20682017-12-23 Sergey Poznyakoff <gray@gnu.org> 2069 2070 Complement c175231e 2071 2072 * configure.ac: Check whether __thread qualifier is supported 2073 * src/gdbmerrno.c (gdbm_errno_storage): Use GDBM_THREAD_LOCAL 2074 instead of __thread. 2075 20762017-12-21 Sergey Poznyakoff <gray@gnu.org> 2077 2078 Improve database reproducibility 2079 2080 * src/gdbmopen.c (gdbm_fd_open): Fill allocated memory with 0's 2081 where necessary. Check return value from fstat. 2082 * src/mmap.c (_gdbm_file_size): Set errno here, instead of 2083 delegating that to the caller. 2084 (_gdbm_file_extend): New function. 2085 (_gdbm_mapped_remap): Call _gdbm_file_extend instead of leaving 2086 the newly allocated space filled with garbage. 2087 * src/gdbmload.c (_set_gdbm_meta_info): Additional error 2088 checking. 2089 * NEWS: Update. 2090 20912017-12-19 Sergey Poznyakoff <gray@gnu.org.ua> 2092 2093 Make gdbm_error thread-safe 2094 2095 * src/gdbm.h.in (gdbm_errno_location): New extern 2096 (gdbm_errno): Change to a define. 2097 * src/gdbmerrno.c (gdbm_errno_location): New function. 2098 (gdbm_errno_storage): Thread-safe storage for the last errno. 2099 21002017-10-28 Sergey Poznyakoff <gray@gnu.org> 2101 2102 Fix manpage formatting. 2103 2104 21052017-07-24 Sergey Poznyakoff <gray@gnu.org.ua> 2106 2107 Fix handling of group headers in --help output. 2108 2109 * src/parseopt.c (print_option_descr): Return if descr is NULL 2110 or empty. Translate it using gettext. All callers changed. 2111 21122017-04-14 Sergey Poznyakoff <gray@gnu.org.ua> 2113 2114 Fix a typo 2115 2116 21172017-03-11 Sergey Poznyakoff <gray@gnu.org> 2118 2119 Fix GENDOCS command line 2120 2121 21222017-03-11 Sergey Poznyakoff <gray@gnu.org> 2123 2124 Version 1.13 2125 2126 21272017-03-07 Sergey Poznyakoff <gray@gnu.org> 2128 2129 Fix parralel builds 2130 2131 * src/Makefile.am: Add dependency for gram.h 2132 2133 Reported by Petr Ovtchenkov <ptr@void-ptr.info> 2134 21352017-01-02 Sergey Poznyakoff <gray@gnu.org> 2136 2137 Happy GNU Year 2138 2139 21402016-12-21 Sergey Poznyakoff <gray@gnu.org> 2141 2142 Minor fix 2143 2144 * src/mmap.c (_gdbm_internal_remap): Avoid munmapping NULL 2145 pointer. Make sure mapped_region isn't a dangling pointer. 2146 21472016-08-06 Sergey Poznyakoff <gray@gnu.org.ua> 2148 2149 Fix typos 2150 2151 21522016-07-27 Sergey Poznyakoff <gray@gnu.org.ua> 2153 2154 Remove obsolete error code. 2155 2156 * doc/gdbm.texi: Remove description of GDBM_UNKNOWN_UPDATE. 2157 Document GDBM_DIR_OVERFLOW. 2158 * src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): Rename to 2159 GDBM_DIR_OVERFLOW. 2160 (GDBM_UNKNOWN_ERROR): New error code. 2161 (GDBM_UNKNOWN_UPDATE): Define to GDBM_UNKNOWN_ERROR for backward 2162 compatibility. 2163 * src/gdbmerrno.c (gdbm_strerror, gdbm_db_strerror): Simplify a 2164 bit 2165 21662016-07-27 Sergey Poznyakoff <gray@gnu.org.ua> 2167 2168 Avoid range error when doubling directory size. 2169 2170 * src/bucket.c (_gdbm_split_bucket): Avoid range error when 2171 doubling directory size. 2172 * src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): New error code. 2173 * src/gdbmerrno.c (gdbm_errlist): Describe 2174 GDBM_ERR_DIR_OVERFLOW. 2175 21762016-07-26 Sergey Poznyakoff <gray@gnu.org.ua> 2177 2178 Update gdbm.magic 2179 2180 * src/gdbm.magic: Explicitly handle big- and little-endian 2181 databases. 2182 21832016-07-26 Sergey Poznyakoff <gray@gnu.org.ua> 2184 2185 Minor changes 2186 2187 * src/bucket.c (_gdbm_read_bucket_at): Remove unused variable. 2188 * src/debug.c: Include ctype.h 2189 (datbuf_format): Don't use sprintf; Precede each output line 2190 with data offset. 2191 21922016-07-26 Sergey Poznyakoff <gray@gnu.org.ua> 2193 2194 Fix remaining uses of gdbm_set_errno function. 2195 2196 Use the GDBM_SET_ERRNO and GDBM_SET_ERRNO2 macros to make sure 2197 the error gets reported in debug output. 2198 2199 * src/fullio.c (_gdbm_full_read) 2200 (_gdbm_full_write): Return -1 and set gdbm_errno on error. 2201 * src/bucket.c: Use GDBM_SET_ERRNO(2?) or GDBM_DEBUG where 2202 necessary. 2203 * src/falloc.c: Likewise. 2204 * src/findkey.c: Likewise. 2205 * src/gdbmdefs.h: Likewise. 2206 * src/gdbmopen.c: Likewise. 2207 * src/gdbmstore.c: Likewise. 2208 * src/mmap.c: Likewise. 2209 * src/recover.c: Likewise. 2210 * src/update.c: Likewise. 2211 22122016-07-25 Sergey Poznyakoff <gray@gnu.org.ua> 2213 2214 Improve debugging and error tracing. 2215 2216 * src/gdbmdefs.h (GDBM_SET_ERRNO) 2217 (GDBM_SET_ERRNO2): New macros. 2218 2219 * src/base64.c: Use new macros to set error state. 2220 * src/bucket.c: Likewise. 2221 * src/falloc.c: Likewise. 2222 * src/findkey.c: Likewise. 2223 * src/gdbm_load.c: Likewise. 2224 * src/gdbmdelete.c: Likewise. 2225 * src/gdbmdump.c: Likewise. 2226 * src/gdbmexp.c: Likewise. 2227 * src/gdbmfetch.c: Likewise. 2228 * src/gdbmimp.c: Likewise. 2229 * src/gdbmload.c: Likewise. 2230 * src/gdbmopen.c: Likewise. 2231 * src/gdbmseq.c: Likewise. 2232 * src/gdbmsetopt.c: Likewise. 2233 * src/gdbmstore.c: Likewise. 2234 2235 * src/gdbmtool.c: Fix preprocessor conditional. 2236 22372016-07-25 Sergey Poznyakoff <gray@gnu.org.ua> 2238 2239 Fix distribution 2240 2241 * src/Makefile.am: Mark gdbm.h as noinst 2242 * compat/Makefile.am (AM_CPPFLAGS): Make sure we pick up 2243 ../src/gdbm.h 2244 22452016-07-25 Sergey Poznyakoff <gray@gnu.org.ua> 2246 2247 Improve the "next" shortcut. 2248 2249 * src/gdbmtool.c (open_handler): Close the previously opened 2250 database. 2251 (close_handler): Free the file name. 2252 (print_dir_handler): Print the number of buckets. 2253 (command_repeat_type): New enum. 2254 (command) <repeat>: Change type to enum command_repeat_type. 2255 (command_tab): Update accordingly. Mark "next" with 2256 REPEAT_NOARG. 2257 (run_last_command): Handle REPEAT_NOARG separately. 2258 * NEWS: Document the shortcut. 2259 * doc/gdbm.texi: Likewise. 2260 * src/debug.c (datbuf_format): Don't represent bytes after the 2261 end of datum as zeros. 2262 (gdbm_debug_datum): Print datum size. 2263 22642016-07-25 Sergey Poznyakoff <gray@gnu.org.ua> 2265 2266 Add debug info. 2267 2268 * configure.ac: Fix description wording. 2269 * src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Don't define 2270 GDBM_DEBUG_ENABLE. 2271 * tests/Makefile.am: Likewise. 2272 * src/debug.c (gdbm_debug_printer) 2273 (gdbm_debug_flags): New globals. 2274 (gdbm_debug_token, gdbm_debug_parse_state) 2275 (gdbm_debug_datum): New functions. 2276 * src/gdbm.h.in [@GDBM_DEBUG_ENABLE@]: Define GDBM_DEBUG_ENABLE. 2277 (gdbm_debug_printer_t): New typedef. 2278 (gdbm_debug_printer, gdbm_debug_flags): New externs. 2279 (GDBM_DEBUG_ERR,GDBM_DEBUG_OPEN) 2280 (GDBM_DEBUG_READ,GDBM_DEBUG_STORE) 2281 (GDBM_DEBUG_LOOKUP,GDBM_DEBUG_ALL): New defines. 2282 (gdbm_debug_token,gdbm_debug_parse_state) 2283 (gdbm_debug_datum): New protos. 2284 * src/gdbmdefs.h (GDBM_DEBUG,GDBM_DEBUG_DATUM): New macros. 2285 2286 * src/findkey.c: Add debugging info. 2287 * src/gdbmfetch.c: Likewise. 2288 * src/gdbmopen.c: Likewise. 2289 * src/gdbmseq.c: Likewise. 2290 * src/gdbmstore.c: Likewise. 2291 * src/gdbmtool.c (open_handler): Allow the use of ~/ 2292 (command) <repeat,variadic>: New members. 2293 (run_command): Handle variadic functions. 2294 (run_last_command): New command. In interactive mode, repeats 2295 the last command if it was marked with repeat=1 (currently, only 2296 "next"). New command: "debug". 2297 (all functions): Use terror instead of fprintf(stderr,...); 2298 * src/gdbmtool.h (handler_param) <vararg>: New member. 2299 (run_last_command): New proto. 2300 * src/gram.y: Call run_last_command) on empty input. 2301 * tests/gtload.c: New option: -debug= 2302 23032016-07-20 Sergey Poznyakoff <gray@gnu.org> 2304 2305 Introduce debug hooks. 2306 2307 * configure.ac: New option --enable-debug Print feature summary 2308 at the end of the run. 2309 2310 * src/debug.c: New file. 2311 * src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Build debug.o Define 2312 GDBM_DEBUG_ENABLE. 2313 * src/gdbmdefs.h [GDBM_DEBUG_ENABLE] (_gdbm_debug_hook_install) 2314 (_gdbm_debug_hook_remove,_gdbm_debug_hook_check) 2315 (_gdbm_debug_hook_val): New protos. 2316 (GDBM_DEBUG_HOOK, GDBM_DEBUG_OVERRIDE) 2317 (GDBM_DEBUG_ALLOC): New defines. 2318 * src/gdbm.h.in (GDBM_RCVR_FORCE): New flag. 2319 * src/recover.c (gdbm_recover): Check database before attempting 2320 recovery, unless GDBM_RCVR_FORCE flag is set. 2321 * doc/gdbm.texi: Document GDBM_RCVR_FORCE 2322 * src/gdbmreorg.c (gdbm_reorganize): Use GDBM_RCVR_FORCE. 2323 2324 * src/gdbmtool.c (main): Always allocate file_name. 2325 2326 * src/bucket.c: Put GDBM_DEBUG_OVERRIDE and GDBM_DEBUG_ALLOC in 2327 critical places. 2328 * src/falloc.c: Likewise. 2329 * src/findkey.c: Likewise. 2330 * src/gdbmopen.c: Likewise. 2331 * src/gdbmstore.c: Likewise. 2332 * src/update.c: Likewise. 2333 2334 * tests/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Define 2335 GDBM_DEBUG_ENABLE. 2336 * tests/gtload.c: New options -hook, -recover, -verbose, 2337 -backup, -max-failures, -max-failed-keys, and 2338 -max-failed-buckets. Attempt recovery after errors. 2339 23402016-07-20 Sergey Poznyakoff <gray@gnu.org> 2341 2342 Fix typo 2343 2344 23452016-07-19 Sergey Poznyakoff <gray@gnu.org> 2346 2347 Improve docs. Minor changes. 2348 2349 * NEWS: Document new features. 2350 * doc/gdbm.texi: Likewise. 2351 * src/gdbm.h.in (gdbm_last_errno): Fix return value. 2352 (gdbm_check_syserr): New proto. 2353 * src/gdbmdefs.h (gdbm_file_info) <last_error>: Fix data type. 2354 * src/gdbmerrno.c (gdbm_last_errno): Fix return value. 2355 (gdbm_check_syserr): New function. 2356 23572016-07-19 Sergey Poznyakoff <gray@gnu.org> 2358 2359 Implement gdbm_recover function 2360 2361 * configure.ac: Don't check for rename. 2362 * src/Makefile.am (libgdbm_la_SOURCES): Add recover.c 2363 * src/recover.c: New file. 2364 * src/bucket.c (_gdbm_get_bucket): Remove extra space before [ 2365 * src/err.c (prerror): Take additional argument 2366 (gdbm_perror): Print system errno if necessary. 2367 * src/gdbm.h.in (GDBM_CLOERROR): New flag. 2368 (gdbm_fd_open, gdbm_copy_meta): New proto. 2369 (gdbm_last_syserr,gdbm_db_strerror,gdbm_recover): New proto. 2370 (gdbm_syserr): New extern. 2371 (gdbm_recovery): New struct. 2372 (GDBM_RCVR_DEFAULT,GDBM_RCVR_ERRFUN) 2373 (GDBM_RCVR_MAX_FAILED_KEYS) 2374 (GDBM_RCVR_MAX_FAILED_BUCKETS) 2375 (GDBM_RCVR_MAX_FAILURES) 2376 (GDBM_RCVR_BACKUP): New flags. 2377 (GDBM_BACKUP_FAILED): New error code. 2378 * src/gdbmclose.c (gdbm_close): Work correctly if dbf->desc == 2379 -1. 2380 * src/gdbmcount.c (gdbm_count): Remove spurious sorting. Use 2381 _gdbm_next_bucket_dir for iterating over the buckets. 2382 * src/gdbmdefs.h (struct gdbm_file_info)<last_syserror> 2383 <last_errstr>: New members. 2384 * src/gdbmerrno.c (gdbm_set_errno): Set last_syserror as well. 2385 (gdbm_clear_error): Reset last_syserror. 2386 (gdbm_last_syserr): New function. 2387 (gdbm_errlist): New entry for GDBM_BACKUP_FAILED. 2388 (gdbm_db_strerror): New function. 2389 (gdbm_syserr): New global. 2390 * src/gdbmload.c (get_parms): Buffer can be NULL. 2391 * src/gdbmopen.c (gdbm_fd_open): New function. 2392 (gdbm_open): Rewrite as a wrapper over gdbm_fd_open. 2393 * src/gdbmreorg.c (gdbm_reorganize): Rewrite as a wrapper over 2394 gdbm_recover. 2395 * src/proto.h (_gdbm_next_bucket_dir): New proto. 2396 * src/gdbmtool.c: New command: recover. 2397 * tests/.gitignore: Add gtrecover 2398 * tests/gtrecover.c: New test program. 2399 * tests/Makefile.am: Build gtrecover 2400 24012016-07-16 Sergey Poznyakoff <gray@gnu.org.ua> 2402 2403 Bugfix 2404 2405 24062016-07-15 Sergey Poznyakoff <gray@gnu.org.ua> 2407 2408 New gdbm_setopt option to get the actual block size value 2409 2410 * src/gdbm.h.in (GDBM_GETBLOCKSIZE): New option. 2411 * src/gdbmcount.c (gdbm_count): Fix memory leak on error. 2412 * src/gdbmsetopt.c (gdbm_setopt): Rewrite. Handle 2413 GDBM_GETBLOCKSIZE. 2414 2415 * NEWS: Document GDBM_GETBLOCKSIZE 2416 * doc/gdbm.texi: Likewise. 2417 2418 * tests/gtload.c: New options -bsexact and -verbose. 2419 * tests/Makefile.am: Add new testcases. 2420 * tests/testsuite.at: Likewise. 2421 * tests/blocksize00.at: New testcase. 2422 * tests/blocksize01.at: Likewise. 2423 * tests/blocksize02.at: Likewise. 2424 24252016-07-15 Sergey Poznyakoff <gray@gnu.org.ua> 2426 2427 gdbm_open adjusts requested block size to accomodate integer 2428 number of directory offsets. 2429 2430 * src/gdbm.h.in (GDBM_BSEXACT): New flag. 2431 * src/gdbmopen.c (compute_directory_size): New function. 2432 (gdbm_open): When creating new database, adjust the requested 2433 block size so that the block holds integer number of directory 2434 indices. Disable this behavior if GDBM_BSEXACT flag is set 2435 (this reverts to old behavior). Always unset GDBM_BSEXACT if 2436 using block size returned by stat(2). This makes sure gdbm_open 2437 succeeds on file systems reporting block sizes not divisible by 2438 512. 2439 * src/gdbmconst.h (GDBM_MIN_BLOCK_SIZE): New constant. 2440 * src/gdbmimp.c (gdbm_import_from_file): Use GDBM_MIN_BLOCK_SIZE 2441 instead of the hardcoded value. 2442 * NEWS: Document GDBM_BSEXACT. 2443 * doc/gdbm.texi: Likewise. 2444 24452016-07-14 Sergey Poznyakoff <gray@gnu.org.ua> 2446 2447 Don't use hardcoded constant 2448 2449 * src/gdbmconst.h (GDBM_HASH_BITS): New constant. 2450 * src/bucket.c: Use GDBM_HASH_BITS instead of the hardcoded 2451 value. 2452 * src/findkey.c (_gdbm_findkey): Use _gdbm_hash_key. 2453 2454 * src/gdbmtool.c (hash_handler): Use _gdbm_hash_key if the 2455 database is open. 2456 * src/hash.c (_gdbm_bucket_dir, _gdbm_hash_key): New functions. 2457 * src/proto.h (_gdbm_bucket_dir, _gdbm_hash_key): New protos. 2458 2459 * src/systems.h (STATBLKSIZE): Take a struct stat as argument. 2460 * src/gdbmopen.c (STATBLKSIZE): Takes argument now. 2461 24622016-07-14 Sergey Poznyakoff <gray@gnu.org.ua> 2463 2464 gdbmtool: improve bucket dump and hash calculator 2465 2466 * src/gdbmtool.c (format_key_start): New function. 2467 (print_bucket): Take variadic arguments, use mesg as prinf-style 2468 format. Display first bytes of each non-empty key. 2469 (print_current_bucket_begin): Avoid coredump if gdbm_file is not 2470 initialized. 2471 (print_current_bucket_handler): Change header depending on the 2472 invoking command. 2473 (hash_handler): In presence of a database, print also the bucket 2474 number and offset within the bucket. 2475 24762016-07-13 Sergey Poznyakoff <gray@gnu.org.ua> 2477 2478 Bugfix 2479 2480 24812016-07-13 Sergey Poznyakoff <gray@gnu.org.ua> 2482 2483 Bugfix 2484 2485 24862016-07-13 Sergey Poznyakoff <gray@gnu.org.ua> 2487 2488 Update magic file 2489 2490 * src/gdbm.magic: Recognize dumpfiles. 2491 24922016-07-13 Sergey Poznyakoff <gray@gnu.org.ua> 2493 2494 Update NEWS 2495 2496 24972016-07-13 Sergey Poznyakoff <gray@gnu.org.ua> 2498 2499 Provide the gdbm.magic file for file(1). 2500 2501 * src/gdbm.magic: New file. 2502 * README: Document existence of the magic file. 2503 * src/Makefile.am (EXTRA_DIST): Add gdbm.magic. 2504 25052016-07-13 Sergey Poznyakoff <gray@gnu.org.ua> 2506 2507 gdbmtool: define macros for accessing typed handler arguments. 2508 2509 * src/gdbmtool.h (PARAM_STRING, PARAM_DATUM) 2510 (PARAM_KVPAIR): New defines. 2511 * src/gdbmtool.c: Use above for accessing handler arguments. 2512 25132016-07-12 Sergey Poznyakoff <gray@gnu.org.ua> 2514 2515 Line-editing support in gdbmtool 2516 2517 * configure.ac: Check if GNU Readline is available. 2518 * src/Makefile.am: Add new files. 2519 * src/input-rl.c: New file. 2520 * src/input-std.c: New file. 2521 * src/gdbmtool.c (handler_param): Move declaration to the header 2522 file. 2523 (quit_handler): Call input_done. 2524 (command_tab): Add the "history" command. 2525 (command_generator): New function. 2526 (slist_new_s, slist_new_l) 2527 (slist_insert): New functions. 2528 (main): Call input_init and input_done. 2529 * src/gdbmtool.h: New protos. 2530 * src/gram.y: Use slist_insert to construct string lists. 2531 * src/lex.l (read_input): Remove. Use input_read instead. 2532 (print_prompt_at_bol): New function. 2533 (print_prompt): Remove. 2534 (make_prompt): New function. 2535 2536 * NEWS: Document changes. 2537 * README: Document readline support. 2538 * doc/gdbm.texi: Document line editing in gdbmtool. 2539 * doc/gdbmtool.1: Likewise. 2540 25412016-07-09 Sergey Poznyakoff <gray@gnu.org.ua> 2542 2543 Don't bail out on fatal errors, unless the user defines the 2544 fatal_err function 2545 2546 * src/bucket.c (_gdbm_get_bucket) 2547 (_gdbm_split_bucket, _gdbm_write_bucket): Return error code. All 2548 callers updated. 2549 * src/proto.h (_gdbm_get_bucket) 2550 (_gdbm_split_bucket, _gdbm_write_bucket): Update declarations 2551 * src/falloc.c (push_avail_block) 2552 (pop_avail_block): Return error code. All callers updated. 2553 * src/update.c (_gdbm_fatal): Exit only if the user defined 2554 fatal_err function. 2555 2556 * src/gdbmerrno.c (gdbm_needs_recovery): New function. 2557 * src/gdbm.h.in (gdbm_needs_recovery): New proto. 2558 2559 * compat/dbminit.c: Set gdbm_errno on fatal errors. 2560 * compat/dbmopen.c: Likewise. 2561 * src/findkey.c: Likewise. 2562 * src/gdbm_load.c: Likewise. 2563 * src/gdbmcount.c: Likewise. 2564 * src/gdbmdefs.h: Likewise. 2565 * src/gdbmdelete.c: Likewise. 2566 * src/gdbmdump.c: Likewise. 2567 * src/gdbmexists.c: Likewise. 2568 * src/gdbmexp.c: Likewise. 2569 * src/gdbmfetch.c: Likewise. 2570 * src/gdbmimp.c: Likewise. 2571 * src/gdbmload.c: Likewise. 2572 * src/gdbmopen.c: Likewise. 2573 * src/gdbmreorg.c: Likewise. 2574 * src/gdbmseq.c: Likewise. 2575 * src/gdbmsetopt.c: Likewise. 2576 * src/gdbmstore.c: Likewise. 2577 * src/gdbmsync.c: Likewise. 2578 * src/mmap.c: Likewise. 2579 25802016-07-09 Sergey Poznyakoff <gray@gnu.org.ua> 2581 2582 All gdbm functions return immediately if the DB is in 2583 inconsistent sate (needs recovery). 2584 2585 * src/gdbm.h.in (GDBM_NEED_RECOVERY): New error code. 2586 * src/gdbmdefs.h (GDBM_ASSERT_CONSISTENCY): New macro. 2587 * src/gdbmerrno.c: Update. 2588 * src/gdbmopen.c (gdbm_open): Initialize need_recovery and 2589 last_error. 2590 2591 * src/gdbmcount.c (gdbm_count): Return immediately if the 2592 database needs recovery. 2593 * src/gdbmdelete.c (gdbm_delete): Likewise. 2594 * src/gdbmdump.c (gdbm_dump_to_file, gdbm_dump): Likewise. 2595 * src/gdbmexists.c (gdbm_exists): Likewise. 2596 * src/gdbmexp.c (gdbm_export_to_file): Likewise. 2597 * src/gdbmfetch.c (gdbm_fetch): Likewise. 2598 * src/gdbmimp.c (gdbm_import_from_file): Likewise. 2599 * src/gdbmreorg.c (gdbm_reorganize): Likewise. 2600 * src/gdbmseq.c (gdbm_firstkey): Likewise. 2601 * src/gdbmsetopt.c (gdbm_nextkey): Likewise. 2602 * src/gdbmstore.c (gdbm_store): Likewise. 2603 * src/gdbmsync.c (gdbm_sync): Likewise. 2604 26052016-07-09 Sergey Poznyakoff <gray@gnu.org.ua> 2606 2607 Fix indentation 2608 2609 26102016-07-09 Sergey Poznyakoff <gray@gnu.org.ua> 2611 2612 Per-database error state. 2613 2614 Last error code is stored in the database file structure as well 2615 as in the global gdbm_errno. Special functions are provided for 2616 retrieving and clearing the last error state. 2617 2618 * src/gdbmdefs.h (gdbm_file_info): New member: last_error 2619 * src/gdbm.h.in (gdbm_last_errno, gdbm_set_errno) 2620 (gdbm_clear_error): New protos. 2621 * src/gdbmerrno.c (gdbm_last_errno, gdbm_set_errno) 2622 (gdbm_clear_error): New functions 2623 2624 * NEWS: Update. 2625 2626 * compat/dbminit.c: Use gdbm_set_errno to set error state. 2627 * compat/dbmopen.c: Likewise. 2628 * src/bucket.c: Likewise. 2629 * src/findkey.c: Likewise. 2630 * src/gdbm_load.c: Likewise. 2631 * src/gdbmcount.c: Likewise. 2632 * src/gdbmdelete.c: Likewise. 2633 * src/gdbmdump.c: Likewise. 2634 * src/gdbmexists.c: Likewise. 2635 * src/gdbmexp.c: Likewise. 2636 * src/gdbmfetch.c: Likewise. 2637 * src/gdbmimp.c: Likewise. 2638 * src/gdbmload.c: Likewise. 2639 * src/gdbmopen.c: Likewise. 2640 * src/gdbmreorg.c: Likewise. 2641 * src/gdbmseq.c: Likewise. 2642 * src/gdbmsetopt.c: Likewise. 2643 * src/gdbmstore.c: Likewise. 2644 * src/gdbmsync.c: Likewise. 2645 * src/mmap.c: Likewise. 2646 26472016-07-08 Sergey Poznyakoff <gray@gnu.org.ua> 2648 2649 Use C99 array initializers in src/gdbmerrno.c 2650 2651 26522016-07-08 Sergey Poznyakoff <gray@gnu.org.ua> 2653 2654 Improve _gdbm_findkey interface. 2655 2656 * doc/gdbm.texi: Document gdbm_exists in detail. 2657 * src/findkey.c (_gdbm_findkey): return parameters can be NULL. 2658 * src/gdbmexists.c (gdbm_exists): Remove unnecessary local 2659 variables. Reset gdbm_errno to 0 if the key was not found. 2660 * src/gdbmdelete.c (gdbm_delete): Remove unnecessary local 2661 variables. 2662 * src/gdbmfetch.c: Likewise. 2663 * src/gdbmseq.c: Likewise. 2664 * src/gdbmstore.c: Likewise. 2665 26662016-07-08 Sergey Poznyakoff <gray@gnu.org.ua> 2667 2668 Fix error handling in gdbm_fetch, gdbm_firstkey, and 2669 gdbm_nextkey. 2670 2671 * src/gdbmfetch.c: Hanlde out of memory error. 2672 * src/findkey.c: Set gdbm_errno to GDBM_ITEM_NOT_FOUND if 2673 nothing was found. 2674 * src/gdbmdelete.c: Don't set gdbm_errno after 2675 _gdbm_findkey returns -1. It's been done already. 2676 * src/gdbmexp.c (gdbm_export_to_file): Return -1 if gdbm_fetch 2677 fails. 2678 * src/gdbmseq.c (get_next_key): Set gdbm_errno to 2679 GDBM_ITEM_NOT_FOUND if there's no next key. Don't call 2680 _gdbm_fatal on out of memory condition. 2681 (gdbm_nextkey): Set gdbm_errno to GDBM_ITEM_NOT_FOUND if there's 2682 no next key. 2683 * src/gdbmtool.c (fetch_handler) 2684 (firstkey_handler,nextkey_handler): Check gdbm_errno. 2685 * src/gdbmstore.c: Handle error return from _gdbm_findkey. 2686 * tests/gtdump.c: Likewise. 2687 * tests/gtfetch.c: Likewise. 2688 2689 * doc/gdbm.texi: Document changes. 2690 * doc/gdbm.3: Likewise. 2691 2692 * configure.ac: Version 1.12.90 2693 * NEWS: Update. 2694 2695 * .gitignore: Update. 2696 26972016-07-07 Sergey Poznyakoff <gray@gnu.org.ua> 2698 2699 Switch to Git repository 2700 2701 * .cvsignore: Rename to .gitignore 2702 * compat/.cvsignore: Likewise. 2703 * doc/.cvsignore: Likewise. 2704 * export/.cvsignore: Likewise. 2705 * po/.cvsignore: Likewise. 2706 * src/.cvsignore: Likewise. 2707 * tests/.cvsignore: Likewise. 2708 2709 * doc/gdbm.texinfo: Rename to doc/gdbm.texi 2710 * doc/Makefile.am: Update 2711 2712 Generate ChangeLog from Git log 2713 2714 * ChangeLog: Rename to ChangeLog.cvs 2715 * Makefile.am: Recreate ChangeLog 2716 * bootstrap: Create a ChangeLog placeholder. 2717 * git2chg.awk: New file. 2718 27192016-07-06 Sergey Poznyakoff <gray@gnu.org.ua> 2720 2721 * doc/gdbm.texinfo: Normal installation prefix is /usr. 2722 * doc/gdbm.3: Spell fixes. 2723 27242016-05-16 Sergey Poznyakoff <gray@gnu.org.ua> 2725 2726 Version 1.12 2727 27282016-05-16 Sergey Poznyakoff <gray@gnu.org.ua> 2729 2730 * src/gdbmtool.c (_gdbm_print_bucket_cache): Use %zu to print 2731 size_t. 2732 * src/gdbmtool.h (variable_unset): New proto. 2733 (yyerror): Argument is char const *. 2734 * src/gram.y: Likewise. 2735 * src/lex.l: Add option noinput 2736 * src/parseopt.c (print_option_descr): Use fwrite instead of 2737 printf. 2738 * src/var.c: Fix initializers to suppress warnings. 2739 27402015-12-05 Sergey Poznyakoff <gray@gnu.org.ua> 2741 2742 * doc/gendocs_template: Add references to manpages. 2743 27442015-12-05 Harald Hoyer <harald@redhat.com> 2745 2746 * doc/gdbmtool.1: Minor change. 2747 * doc/gdbm.3: Fix typo. 2748 27492015-11-02 Sergey Poznyakoff <gray@gnu.org.ua> 2750 2751 Tiny fix 2752 2753 * var.c: Use ISO C99 initializers. Thanks to 2754 Brad Forschinger <bnjf@bnjf.id.au> 2755 27562015-08-14 Sergey Poznyakoff <gray@gnu.org.ua> 2757 2758 Fix doc generation. 2759 2760 * doc/Config: Rename to doc/html.init. 2761 * doc/gdbm.texinfo: Fix sectioning. 2762 27632015-08-13 Sergey Poznyakoff <gray@gnu.org.ua> 2764 2765 Minor fix in docs 2766 2767 * doc/gdbm.texinfo: Fix direntry records. 2768 27692014-07-03 Sergey Poznyakoff <gray@gnu.org.ua> 2770 2771 Bugfix. 2772 2773 * src/lex.l (expand_char): Don't return any value. 2774 27752014-02-14 Sergey Poznyakoff <gray@gnu.org.ua> 2776 2777 Optionally install compatibility headers into a separate directory. 2778 2779 * configure.ac: Version 1.11.90 2780 (COMPATINCLUDEDIR): New substitution variable. 2781 * compat/Makefile.am (compatincludedir): New variable. 2782 (include_HEADERS): Rename to compatinclude_HEADERS. 2783 * NEWS: Document COMPATINCLUDEDIR. 2784 * README: Likewise. 2785 27862014-02-12 Sergey Poznyakoff <gray@gnu.org.ua> 2787 2788 * src/gdbmimp.c (gdbm_import_from_file): Read record sizes as 2789 unsigned long, as they are stored by gdbm_export_to_file. 2790 Improve error reporting. 2791 27922014-02-06 Sergey Poznyakoff <gray@gnu.org.ua> 2793 2794 * doc/Makefile.am: Use dist_man_MANS 2795 27962013-12-25 Sergey Poznyakoff <gray@gnu.org.ua> 2797 2798 Version 1.11 2799 28002013-12-25 Sergey Poznyakoff <gray@gnu.org.ua> 2801 2802 Minor changes. 2803 2804 * src/gdbm_load.c: New options: --mmap, --cache-size and 2805 --block-size. 2806 2807 * doc/gdbm.texinfo: Document new gdbm_load options. 2808 * doc/gdbm_load.1: Likewise. 2809 2810 * src/gdbmdelete.c: Stylistic changes. 2811 * src/gdbmstore.c: Likewise. 2812 28132013-05-21 Sergey Poznyakoff <gray@gnu.org.ua> 2814 2815 New function gdbm_count. 2816 2817 * configure.ac: Check for unsigned long long, define 2818 substitution variable GDBM_COUNT_T. 2819 * src/gdbmcount.c: New file. 2820 * src/Makefile.am (libgdbm_la_SOURCES): Add gdbmcount.c. 2821 * src/bucket.c (_gdbm_read_bucket_at): New function. 2822 * src/gdbm.h.in (gdbm_count_t): New typedef. 2823 (gdbm_count): New proto. 2824 * src/gdbmdefs.h (GDBM_DIR_COUNT): New define. 2825 * src/proto.h (_gdbm_read_bucket_at): New proto. 2826 * src/var.c: New variable "filemode". 2827 2828 * src/gdbmtool.c: Use gdbm_count. Various bugfixes. 2829 2830 * NEWS: Update. 2831 * doc/gdbm.texinfo: Update. 2832 28332013-05-17 Sergey Poznyakoff <gray@gnu.org.ua> 2834 2835 Update the docs. 2836 2837 * NEWS: Update. 2838 * doc/gdbm.texinfo: Update. 2839 * doc/gdbmtool.1: Document the "define" statement. 2840 * src/datconv.c: Rename string datatypes to reflect their 2841 meaning. 2842 (dsprint): Improve output presentation. 2843 28442013-05-16 Sergey Poznyakoff <gray@gnu.org.ua> 2845 2846 Provide support for a simplified "define" construct. 2847 2848 * doc/gdbm.texinfo: Document the "define" statement. 2849 * src/datconv.c: Support short and ushort data types. 2850 * src/gdbmtool.c: Don't call checkdb prior to handling 2851 the "hash" command. 2852 * src/gram.y: Support simplified definition construct: 2853 "define key|content type". 2854 28552013-05-16 Sergey Poznyakoff <gray@gnu.org.ua> 2856 2857 Improve handling of the variables. 2858 2859 * src/gdbmtool.c (opendb): Allow for unset variables. 2860 * src/gram.y: Improve error detection. 2861 * src/lex.l: Handle multiline strings. 2862 (pe_file_name): file_name can be NULL. 2863 * src/var.c (VARF_PROT): New flag. Protects the variable 2864 from being unset. 2865 (vartab): Use VARF_PROT if needed. 2866 (s2b): Fix return values. 2867 (variable_set, variable_unset): Return error if attempting 2868 to unset a variable marked with VARF_PROT. 2869 2870 * doc/gdbm.info: Update. 2871 * doc/gdbmtool.1: Update. 2872 28732013-05-15 Sergey Poznyakoff <gray@gnu.org.ua> 2874 2875 Minor change 2876 2877 * src/gdbmtool.c (command_tab): Change variable names 2878 in docstrings to uppercase. 2879 28802013-05-15 Sergey Poznyakoff <gray@gnu.org.ua> 2881 2882 Implement the "quiet" variable. 2883 2884 * src/var.c (vartab) <quiet>: New variable. 2885 (variable_is_true): Return 0 if the value cannot be 2886 retrieved. 2887 * src/gdbmtool.c (optab): New option --file (-f). 2888 (main): Handle the --file option. 2889 Retrieve the "quiet" setting from the variable. 2890 * src/lex.l (context_pop): Clear both point.file 2891 and yylloc. 2892 28932013-05-15 Sergey Poznyakoff <gray@gnu.org.ua> 2894 2895 Add "pager" variable and "unset" command. 2896 2897 * src/gdbmtool.c (command_tab) <unset>: New command. 2898 (run_command): Get pager value from the variable. 2899 * src/gdbmtool.h (VAR_ERR_NOTSET): New error code. 2900 (variable_is_true): New function. Replaces variable_is_set, 2901 which changed semantics. 2902 * src/gram.y: Implement the unset command. 2903 * src/var.c: Support the "unset variable" notion. 2904 (VARF_INIT): New flag. 2905 (VAR_IS_SET): New define. 2906 (vartab): Mark initialized variables with VARF_INIT. 2907 New variable "pager". 2908 (open_hook): v can be NULL. 2909 (variable_set): NULL value unsets the variable. 2910 (variable_unset): New function. 2911 (variable_get): Return VAR_ERR_NOTSET if the variable is 2912 not set. 2913 (variable_is_true): Renamed from variable_is_set. 2914 (variable_is_set): New function. 2915 2916 * src/gdbmdefs.h: Fix some typos. 2917 29182013-05-14 Sergey Poznyakoff <gray@gnu.org.ua> 2919 2920 Change variable handling. 2921 2922 * src/util.c: New file. 2923 * src/Makefile.am: Add new files. 2924 * src/gdbmtool.c (open_mode): New variable. 2925 (terror): Remove. 2926 (mkfilename, tildexpand): Move to util.c 2927 (opendb): Use open_mode. 2928 (import_handler): Likewise. 2929 (optab): New option -N (--norc). 2930 2931 * src/gdbmtool.h (vparse_error): Rename to vlerror. 2932 (parse_error): Rename to lerror. 2933 (syntax_error): Rename tp terror. 2934 All uses updated. 2935 (VAR_ERR_FAILURE): Remove. 2936 (VAR_ERR_BADVALUE): New error code. 2937 (variable_mode_name): Remove. 2938 (mkfilename, tildexpand) 2939 (vgetyn, getyn): New protos. 2940 * src/lex.l (initialized): New static. 2941 (setsource): Set initialized. 2942 (vlerror): Print locus only if the lexer has been 2943 initialized. 2944 * src/var.c: Rewrite. 2945 29462013-05-14 Sergey Poznyakoff <gray@gnu.org.ua> 2947 2948 Provide "open" and "close" commands; implement new variables. 2949 2950 * src/datconv.c (datum_format): Don't print field delimiter 2951 after the last field. 2952 (dsprint): Bugfix. 2953 * src/gdbmload.c (gdbm_load_from_file): Return GDBM_NO_DBNAME 2954 when loading from bdb dump and the database pointer is NULL. 2955 * src/gdbmtool.c (opendb, checkdb): New auxiliary functions. 2956 (begin handlers): call checkdb. 2957 (import_handler): Special handling for GDBM_NO_DBNAME. 2958 (status_handler): Print more info. 2959 (command_tab): Call checkdb prior to handlers that expect an 2960 open database. 2961 New commands: open, close 2962 (gdbmarg_string, gdbmarg_datum) 2963 (gdbmarg_kvpair): Take pointer to locus as the 2nd argument. 2964 All uses changed. 2965 (coerce): Include locus info in the diagnostic message. 2966 (main): Don't open database right away. 2967 * src/gdbmtool.h (GDBMTOOL_DEFFILE): New define. 2968 (gdbmarg) <loc>: New member. 2969 (VART_INT): New variable typ.e 2970 (VAR_ERR_FAILURE): New error code. 2971 (variable_is_set, varible_mode_name): New protos. 2972 * src/gram.y: Provide printable token names for error messages. 2973 Pass locus to gdbmarg initialization functions. 2974 * src/lex.l (vparse_error): Fix output. 2975 * src/var.c (variable) <v.num, hook, hook_data>: New members. 2976 (vartab): Define more variables. 2977 (variable_set): Accept value of any valid datatype. 2978 (variable_mode_name, variable_is_set): New functions. 2979 29802013-05-14 Sergey Poznyakoff <gray@gnu.org.ua> 2981 2982 Cleanup. 2983 2984 * src/datconv.c (s_float): Use strtod. 2985 (datum_scan_notag, datum_scan_tag): Made static. 2986 (dsprint): New function. 2987 * src/gdbmtool.c (status_handler): Print key and 2988 content definitions. 2989 (slist_new): Bugfix (missing return statement). 2990 * src/gdbmtool.h: Add new prototypes. 2991 * src/lex.l: Remove unused variables, set option 2992 nounput. 2993 29942013-05-14 Sergey Poznyakoff <gray@gnu.org.ua> 2995 2996 Implement rc files and "source" command; improve lexical analyzer. 2997 2998 * src/gdbmtool.c (interactive): Move to lex.l; 2999 (mkfilename, tildexpand): New functions. 3000 (command_tab) <source>: New command. 3001 (main): Source rc file, if present. 3002 * src/gdbmtool.h (setsource): Change return type 3003 and signature. 3004 * src/lex.l: Implement context stack. 3005 Change DEF to be an exclusive state. 3006 3007 * src/gdbmapp.h (estrdup): Argument is const. 3008 * src/mem.c: Likewise. 3009 30102013-05-14 Sergey Poznyakoff <gray@gnu.org.ua> 3011 3012 Add support for Berkeley dump format version 3 (read-only). 3013 3014 * src/gdbmapp.h: Include gettext.h and locale.h. 3015 * src/gdbmload.c: Support for Berkeley dump format, 3016 version 3. 3017 30182013-05-13 Sergey Poznyakoff <gray@gnu.org.ua> 3019 3020 Remove the "read" command. Use "import" instead. 3021 30222013-05-13 Sergey Poznyakoff <gray@gnu.org.ua> 3023 3024 Add "set" and "define" to the main command table. 3025 3026 * src/gdbmtool.c: Include gram.h 3027 (command) <tok>: New member. 3028 (command_tab): List "define" and "set". 3029 (find_command): Rewrite as command_lookup, with different 3030 return type and signature. 3031 (run_command): Take struct command * as its first argument. 3032 * src/gdbmtool.h (command_lookup): New proto. 3033 (run_command): Change signature. 3034 (datadef_locate): Rename to datadef_lookup. All uses changed. 3035 * src/gram.y: Update. 3036 * src/lex.l: Change handling of IDENT rules. 3037 30382013-05-13 Sergey Poznyakoff <gray@gnu.org.ua> 3039 3040 Implement shell variables in gdbmtool. 3041 3042 * src/var.c: New file. 3043 * src/Makefile.am: Add var.c 3044 * src/datconv.c (datum_format): Remove the "delim" 3045 parameter, use "delim1" and "delim2" shell variables 3046 instead. 3047 * src/gdbmtool.c: Remove "prompt" command. Use "set ps[12]" 3048 instead. 3049 (print_prompt): Move to lex.l 3050 * src/gdbmtool.h (variable_set) 3051 (variable_get, variable_print_all): New protos. 3052 * src/gram.y: Handle the "set" command. 3053 * src/lex.l: Update. 3054 30552013-05-13 Sergey Poznyakoff <gray@gnu.org.ua> 3056 3057 Handle structured key and content data in gdbmtool. 3058 3059 * src/datconv.c: New file. 3060 * src/Makefile.am (gdbmtool_SOURCES): Add datconv.c. 3061 * src/gdbmtool.h (slist, kvpair): New structures. 3062 (gdbmarg): Keep various types of data depending on the 3063 value of the type member. 3064 (slist_new, slist_free) 3065 (kvpair_string, kvpair_list): New protos. 3066 (gdbmarg_new): Remove. 3067 (gdbmarg_string, gdbmarg_datum) 3068 (gdbmarg_kvpair, gdbmarg_free) 3069 (gdbmarg_destroy): New protos. 3070 (xd_expand, xd_store, datadef_locate): New protos. 3071 (field, dsegm): New structs. 3072 (dsegm_new, dsegm_new_field, dsegm_free_list): New protos. 3073 * src/gdbmtool.c: Rewrite. 3074 * src/gram.y: Change grammar to allow for defining key and 3075 content structure and for supplying structured data as arguments 3076 to fetch, store and similar functions. 3077 * src/lex.l: Handle new token types. 3078 3079 * tests/dtload.c (main): Fix parser. 3080 * tests/gtload.c: Likewise. 3081 30822013-05-11 Sergey Poznyakoff <gray@gnu.org.ua> 3083 3084 Rewrite gdbmtool parser. 3085 3086 * src/testgdbm.c: Remove. 3087 * src/gdbmtool.c: New file. 3088 * src/gdbmtool.h: New file. 3089 * src/gram.y: New file. 3090 * src/lex.l: New file. 3091 * src/Makefile.am: Update. 3092 30932013-05-09 Sergey Poznyakoff <gray@gnu.org.ua> 3094 3095 Add new prompt escapes. 3096 3097 * src/testgdbm.c: New prompt escapes: %p, %P, %v, %_. 3098 Change default prompt to %p>%_. 3099 * doc/gdbmtool.1: Document new prompt escapes. 3100 31012013-05-08 Sergey Poznyakoff <gray@gnu.org.ua> 3102 3103 Rename testgdbm to gdbmtool. Improve documentation. 3104 3105 * configure.ac: Fix a typo. 3106 * src/.cvsignore: Add gdbmtool 3107 * src/Makefile.am: Rename testgdbm to gdbmtool. Source 3108 file not renamed because of CVS deficiency. 3109 * src/gdbm_dump.c: Enable NLS. 3110 * src/gdbm_load.c: Likewise. 3111 * src/testgdbm.c: New option -q (--quiet). 3112 New command: prompt. 3113 * doc/Makefile.am (man_MANS): Add new manpages. 3114 * doc/gdbmtool.1: New file. 3115 * doc/gdbm_load.1: New file. 3116 * doc/gdbm_dump.1: New file. 3117 * doc/gdbm.3: Update. 3118 * doc/gdbm.texinfo: Update. 3119 31202013-05-08 Sergey Poznyakoff <gray@gnu.org.ua> 3121 3122 * configure.ac: (AC_INIT): Add webpage URL. 3123 31242013-05-08 Sergey Poznyakoff <gray@gnu.org.ua> 3125 3126 Improve testgdbm; install some more bugfixes. 3127 3128 * src/gdbmdefs.h: Fix typo in a comment. 3129 * src/gdbmdump.c (gdbm_dump_to_file): Improve error 3130 checking. 3131 * src/testgdbm.c: Improve interactive usage. 3132 (command) <minlen>: Rename to len. 3133 (command_tab): Initialize len. 3134 (set_minimal_abbreviations): Remove. 3135 (sort_commands): New function. 3136 (find_command): Print possible alternatives in case of 3137 ambiguous input. 3138 (main): Reset param.argc after freeing previous arguments. 3139 Continue silently if find_command returns NULL. 3140 31412013-05-07 Sergey Poznyakoff <gray@gnu.org.ua> 3142 3143 Bugfix. 3144 3145 * src/gdbmreorg.c: Call _gdbm_mapped_init when the database 3146 structure is fully initialized (Puszcza bug #171). 3147 31482013-05-07 Sergey Poznyakoff <gray@gnu.org.ua> 3149 3150 Minor change 3151 3152 * configure.ac: Require autoconf 2.69 or newer (in response 3153 to Puszcza bug #171). 3154 31552012-03-21 Sergey Poznyakoff <gray@gnu.org.ua> 3156 3157 * tests/create00.at: Use cmp -s || diff -u instead of plain 3158 diff, because the latter produces extra output on some systems 3159 (notably Solaris). 3160 * tests/dbmcreate00.at: Likewise. 3161 * THANKS: Add Bill Jones 3162 31632011-11-16 Sergey Poznyakoff <gray@gnu.org.ua> 3164 3165 Improve testgdbm 3166 3167 * src/mem.c (ealloc_die): Return EXIT_FATAL to the shell. 3168 * src/testgdbm.c: Use emalloc, erealloc and estrdup for memory 3169 allocation. 3170 (syntax_error): New function. 3171 (handler_param): New struct. 3172 (all handlers): Change signature. Take a pointer to struct 3173 handler_param as argument. 3174 (export_handler,import_handler): Handle new formats. 3175 (main): Take first argument to be the file name. 3176 (optab): Remove -f argument. Hide -g, but retain it for 3177 backward compatibility. 3178 3179 * doc/gdbm.texinfo: Update. 3180 31812011-11-15 Sergey Poznyakoff <gray@gnu.org.ua> 3182 3183 Version 1.10.90 3184 3185 Update the docs. Improve dump/load utilities. 3186 3187 * doc/gdbm.texinfo: Reorganize the material. Document gdbm_load 3188 and gdbm_dump utilities. 3189 * src/gdbm.h.in (GDBM_META_MASK_MODE) 3190 (GDBM_META_MASK_OWNER): New constant. 3191 (gdbm_load,gdbm_load_from_file): Take an additional argument: 3192 meta_flags, which masks out restoring certain meta-data. 3193 * src/gdbm_dump.c: Remove -b option. The -H option takes symbolic 3194 format names. Use the standard exit codes. 3195 * src/gdbm_load.c: New options: --mode, --user and --no-meta. 3196 Use the standard exit codes. 3197 * src/gdbmapp.h (EXIT_OK, EXIT_FATAL, EXIT_MILD) 3198 (EXIT_USAGE): New constants. 3199 * src/gdbmload.c (gdbm_load,gdbm_load_from_file): Take an 3200 additional argument, which masks out restoring certain meta-data. 3201 32022011-11-15 Sergey Poznyakoff <gray@gnu.org.ua> 3203 3204 Return a meaningful error code if failed to restore file's metadata. 3205 3206 * src/gdbm.h.in (GDBM_ERR_FILE_OWNER) 3207 (GDBM_ERR_FILE_MODE): New error codes. 3208 (_GDBM_MAX_ERRNO): Update. 3209 * src/gdbmerrno.c (gdbm_errlist): Add new error codes. 3210 * src/gdbmload.c (_set_gdbm_meta_info): Set gdbm_errno and 3211 return 1 in case of errors. 3212 (_gdbm_load_file): Propagate the return value from 3213 _set_gdbm_meta_info. 3214 3215 * src/gdbm_load.c (main): Handle mild error conditions. 3216 * export/export.c (usage): Print the GDBM version the program is 3217 linked with. 3218 * doc/gdbm.texinfo: Document changes. 3219 32202011-11-14 Sergey Poznyakoff <gray@gnu.org.ua> 3221 3222 * doc/gdbm.texinfo (Error codes): Document new flat format and 3223 related functions. 3224 * po/POTFILES.in: Update 3225 32262011-11-13 Sergey Poznyakoff <gray@gnu.org.ua> 3227 3228 Implement new dump format. Add new utilities: gdbm_dump and gdbm_load. 3229 3230 * configure.ac (AC_CHECK_HEADERS): Don't check for files that must 3231 always be present. Check for getopt.h. 3232 (AC_CHECK_FUNCS): Add getopt_long 3233 * src/systems.h: Include useless #if's. 3234 3235 * src/flatfile.c: Split into two files: 3236 * src/gdbmexp.c: ... this and ... 3237 * src/gdbmimp.c: .., this 3238 3239 * src/mem.c: New file. 3240 * src/base64.c: New file. 3241 * src/gdbm_dump.c: New file. 3242 * src/gdbm_load.c: New file. 3243 * src/gdbmapp.h: New file. 3244 * src/gdbmdump.c: New file. 3245 * src/gdbmload.c: New file. 3246 * src/parseopt.c: New file. 3247 * src/progname.c: New file. 3248 * src/.cvsignore: Update. 3249 * src/Makefile.am (libgdbm_la_SOURCES): Add new files. 3250 (noinst_LIBRARIES): New variable. Build libgdbmapp.a. 3251 (libgdbmapp_a_SOURCES): New variable. 3252 (bin_PROGRAMS): Add gdbm_load and gdbm_dump 3253 (testgdbm_LDADD, gdbm_load_LDADD) 3254 (gdbm_dump_LDADD): Add ./libgdbmapp.a 3255 3256 * src/gdbm.h.in: Include <stdio.h> 3257 (gdbm_export_to_file) 3258 (gdbm_import_from_file): New prototypes. 3259 (GDBM_DUMP_FMT_BINARY,GDBM_DUMP_FMT_ASCII): New constants. 3260 (gdbm_dump,gdbm_load) 3261 (gdbm_dump_to_file,gdbm_load_from_file): New prototypes. 3262 (GDBM_NO_DBNAME): New error code. 3263 (_GDBM_MAX_ERRNO): Update. 3264 * src/gdbmdefs.h (_GDBM_MAX_DUMP_LINE_LEN): New constant. 3265 * src/gdbmerrno.c (gdbm_errlist): Add entry for GDBM_NO_DBNAME. 3266 * src/proto.h (_gdbm_base64_encode,_gdbm_base64_decode) 3267 (_gdbm_load,_gdbm_dump): New prototypes. 3268 3269 * src/testgdbm.c: Use gdbmapp interface for option parsing. 3270 3271 * export/export.c: Include gdbmexp.c 3272 * export/.cvsignore: Update. 3273 * doc/gdbm.texinfo: Update. 3274 32752011-11-13 Sergey Poznyakoff <gray@gnu.org.ua> 3276 3277 Version 1.10 3278 3279 * NEWS: Raise version number. 3280 * configure.ac: Raise version number. 3281 32822011-11-11 Sergey Poznyakoff <gray@gnu.org.ua> 3283 3284 Implement cloexec in gdbm_reorganize. Add test cases. 3285 3286 * compat/dbmopen.c: Apply O_CLOEXEC to newly created dir 3287 file, if requested. 3288 3289 * src/gdbmdefs.h (gdbm_file_info) <cloexec>: New member. 3290 * src/gdbmopen.c (gdbm_open): Initialize cloexec member. 3291 * src/gdbmreorg.c (gdbm_reorganize): Propagate cloexec bit 3292 to the new database. 3293 3294 * tests/.cvsignore: Update. 3295 * tests/cloexec00.at: New test case. 3296 * tests/cloexec01.at: Likewise. 3297 * tests/cloexec02.at: Likewise. 3298 * tests/cloexec03.at: Likewise. 3299 * fdop.c: New auxiliary program. 3300 * g_open_ce: New test program. 3301 * g_reorg_ce: New test program. 3302 * d_creat_ce: New test program. 3303 * tests/Makefile.am: Add new test cases and test programs. 3304 * tests/testsuite.at: Include new test cases. 3305 * doc/gdbm.texinfo: Minor change. 3306 33072011-11-11 Sergey Poznyakoff <gray@gnu.org.ua> 3308 3309 Use SEEK_SET instead of L_SET in all sources. 3310 33112011-11-11 Sergey Poznyakoff <gray@gnu.org.ua> 3312 3313 Support close-on-exec flag for gdbm_open call. 3314 3315 * src/gdbm.h.in (GDBM_CLOEXEC): New flag. 3316 * src/systems.h [O_CLOEXEC]: Provide a placeholder definition. 3317 3318 * src/gdbmopen.c (gdbm_open): Honor the GDBM_CLOEXEC flag. 3319 * compat/dbmopen.c (ndbm_open_dir_file0): Mask out open mode 3320 before comparing with GDBM_READER. 3321 Support GDBM_CLOEXEC. 3322 (dbm_open): Translate O_CLOEXEC to GDBM_CLOEXEC. 3323 3324 * doc/gdbm.texinfo: Document GDBM_CLOEXEC. 3325 3326 * NEWS: Update. 3327 33282011-11-11 Sergey Poznyakoff <gray@gnu.org.ua> 3329 3330 Fix handling of NDBM databases in read-only mode. 3331 3332 * compat/dbmopen.c (ndbm_open_dir_file0): Open dir file in 3333 read-only mode if the database is being opened as GDBM_READER. 3334 * tests/dbmcvt.at: New file. 3335 * tests/dbmfetch02.at: New file. 3336 * tests/dbmfetch03.at: New file. 3337 * tests/Makefile.am (TESTSUITE_AT): Add new files. 3338 * tests/testsuite.at: Include new testcases. 3339 33402011-10-05 Sergey Poznyakoff <gray@gnu.org.ua> 3341 3342 Fix bug #150. 3343 3344 Tolerate I/O operations returning less bytes than expected. Retry I/O 3345 if possible. 3346 3347 * src/fullio.c: New file. 3348 * src/Makefile.am (libgdbm_la_SOURCES): Add fullio.c 3349 * src/proto.h (_gdbm_full_read) 3350 (_gdbm_full_write): New protos. 3351 * src/gdbmerrno.c (gdbm_errlist): Add entry for GDBM_FILE_EOF. 3352 3353 * src/bucket.c: Use _gdbm_full_{read|write}. 3354 * src/falloc.c: Likewise. 3355 * src/findkey.c: Likewise. 3356 * src/gdbmopen.c: Likewise. 3357 * src/gdbmstore.c: Likewise. 3358 * src/testgdbm.c: Likewise. 3359 * src/update.c: Likewise. 3360 33612011-10-05 Sergey Poznyakoff <gray@gnu.org.ua> 3362 3363 * src/gdbmopen.c (gdbm_open): Initialize memory used for file 3364 header. This fixes bug #151. 3365 33662011-08-24 Sergey Poznyakoff <gray@gnu.org.ua> 3367 3368 Implement multi-character commands in testgdbm. 3369 3370 * bootstrap (get_po): Discard output from cmp. 3371 * src/testgdbm.c: Implement multi-character commands. 3372 * doc/gdbm.texinfo: Update. 3373 33742011-08-18 Sergey Poznyakoff <gray@gnu.org.ua> 3375 3376 * bootstrap: Get PO files; create LINGUAS list 3377 * po/.cvsignore: Add LINGUAS. 3378 33792011-08-17 Sergey Poznyakoff <gray@gnu.org.ua> 3380 3381 Make sure errno is preserved, if it can contain details about the 3382 gdbm error. 3383 3384 * src/gdbmdefs.h (SAVE_ERRNO): New macro. 3385 * src/gdbmopen.c: Use SAVE_ERRNO where it is important to 3386 preserve system errno. 3387 * src/mmap.c: Likewise. 3388 3389 * doc/gdbm.texinfo: Document which gdbm errors can 3390 be detailed by inspecting the system errno. 3391 33922011-08-17 Sergey Poznyakoff <gray@gnu.org.ua> 3393 3394 Introduce new error code. 3395 3396 * configure.ac, NEWS: Raise patchlevel to 90. 3397 * src/gdbm.h.in: Enclose entire file in conditional 3398 extern "C". 3399 (GDBM_FILE_STAT_ERROR): New error code. 3400 (_GDBM_MAX_ERRNO): Update. 3401 * src/gdbmerrno.c (gdbm_errlist): Update. 3402 * src/gdbmopen.c: Set GDBM_FILE_STAT_ERROR on fstat 3403 failure. 3404 * src/gdbmreorg.c: Likewise. 3405 * src/mmap.c: Likewise. 3406 * src/systems.h: Include errno.h 3407 * gdbm.texinfo: Document GDBM_FILE_STAT_ERROR. 3408 34092011-08-16 Sergey Poznyakoff <gray@gnu.org.ua> 3410 3411 Minor housekeeping for Gnits compliance. 3412 3413 * README-alpha: New file. 3414 * README-hacking: New file. 3415 * bootstrap: Update. 3416 34172011-08-16 Sergey Poznyakoff <gray@gnu.org.ua> 3418 3419 Internationalization. 3420 3421 * Makefile.am (SUBDIRS): Add po. 3422 (EXTRA_DIST): Add build-aux/config.rpath. 3423 * configure.ac (AC_CONFIG_FILES): Add po/Makefile.in. 3424 * bootstrap: New file. 3425 * src/Makefile.am (AM_CPPFLAGS): Define LOCALEDIR 3426 (noinst_HEADERS): Add gettext.h 3427 (LIBADD): New variable. 3428 * src/gettext.h: New file. 3429 * po/.cvsignore: New file. 3430 * po/Makevars: New file. 3431 * po/POTFILES.in: New file. 3432 * src/gdbmdefs.h: Define DEFAULT_TEXT_DOMAIN, _, N_ 3433 Include gettext.h 3434 * src/bucket.c: Add NLS markers. 3435 * src/falloc.c: Likewise. 3436 * src/findkey.c: Likewise. 3437 * src/gdbmerrno.c: Likewise. 3438 * src/gdbmfetch.c: Likewise. 3439 * src/gdbmseq.c: Likewise. 3440 * src/gdbmstore.c: Likewise. 3441 * src/update.c: Likewise. 3442 * src/testgdbm.c: Add NLS markers. 3443 (main): Initialize I18N. 3444 34452011-08-14 Sergey Poznyakoff <gray@gnu.org.ua> 3446 3447 * compat/Makefile.am (libgdbm_compat_la_LIBADD): Link against 3448 libgdbm. Suggested by Adam Sampson. 3449 34502011-08-13 Sergey Poznyakoff <gray@gnu.org.ua> 3451 3452 Improve release checking: use gnits. 3453 3454 * configure.ac (AM_INIT_AUTOMAKE): Use gnits. 3455 (AC_INIT): Remove extra quoting from around version number 3456 to pacify gnits. 3457 * THANKS: New file. 3458 34592011-08-13 Sergey Poznyakoff <gray@gnu.org.ua> 3460 3461 Verify preprocessor directives. Pass them through cppi to 3462 reflect their nesting level. Affected files: 3463 3464 * src/flatfile.c 3465 * src/gdbmconst.h 3466 * src/gdbm.h.in 3467 * src/gdbmconst.h 3468 * src/gdbmopen.c 3469 * src/gdbmreorg.c 3470 * src/lock.c 3471 * src/mmap.c 3472 * src/systems.h 3473 * src/testgdbm.c 3474 34752011-08-13 Sergey Poznyakoff <gray@gnu.org.ua> 3476 3477 * NEWS, configure.ac: Version 1.9.1 3478 34792011-08-12 Sergey Poznyakoff <gray@gnu.org.ua> 3480 3481 Bugfixes (pointed out by Matthew Burgess 3482 <matthew@linuxfromscratch.org>). 3483 3484 * src/gdbmopen.c: Fix a typo. 3485 * tests/Makefile.am ($(srcdir)/package.m4): Fix improper 3486 dependency. 3487 34882011-08-11 Sergey Poznyakoff <gray@gnu.org.ua> 3489 3490 Release 1.9 3491 34922011-08-11 Sergey Poznyakoff <gray@gnu.org.ua> 3493 3494 Add testcases for gdbm_setopt. 3495 3496 * tests/gtopt.c: New file 3497 * tests/.cvsignore: Update. 3498 * tests/setopt00.at: New testcase. 3499 * tests/setopt01.at: New testcase. 3500 * tests/Makefile.am: Build gtopt. Add setopt00.at and setopt01.at. 3501 * tests/testsuite.at: Include setopt00.at and setopt01.at. 3502 35032011-08-11 Sergey Poznyakoff <gray@gnu.org.ua> 3504 3505 New option GDBM_GETDBNAME. 3506 3507 * src/gdbm.h.in (GDBM_GETDBNAME): New option. 3508 * src/gdbmsetopt.c (gdbm_setopt): Handle GDBM_GETDBNAME. 3509 * doc/gdbm.texinfo (Options): Document GDBM_GETDBNAME. 3510 35112011-08-11 Sergey Poznyakoff <gray@gnu.org.ua> 3512 3513 Improve gdbm_setopt interface. 3514 3515 * src/gdbm.h.in (GDBM_OPENMASK): New constant. 3516 * src/gdbmconst.h: Remove constants duplicated in 3517 gdbm.h.in. 3518 * src/gdbmdefs.h (gdbm_file_info) <allow_mmap> 3519 <mmap_inited>: Replace with a single member: memory_mapping. 3520 All callers updated. 3521 (GDBM_SETCACHESIZE,GDBM_SETSYNCMODE) 3522 (GDBM_SETCENTFREE,GDBM_SETCOALESCEBLKS): New option names. 3523 (GDBM_SETMMAP,GDBM_GETMMAP,GDBM_GETFLAGS) 3524 (GDBM_GETCACHESIZE,GDBM_GETSYNCMODE,GDBM_GETCENTFREE) 3525 (GDBM_GETCOALESCEBLKS,GDBM_GETMAXMAPSIZE): New option codes. 3526 * src/gdbmsetopt.c: Implement new options. 3527 * doc/gdbm.texinfo: Document new options. 3528 35292011-08-11 Sergey Poznyakoff <gray@gnu.org.ua> 3530 3531 Improve memory mapping support. 3532 3533 The new code is more flexible and performs better when 3534 lots of inserts are being made (e.g. when populating the 3535 database with new data). 3536 3537 * src/gdbm.h.in (GDBM_SETMAXMAPSIZE): New constant. 3538 * src/gdbmconst.h (SIZE_T_MAX): New define. 3539 * src/gdbmdefs.h (gdbm_file_info) <cache_size>: Change type 3540 to size_t. 3541 <mmap_inited,mapped_size_max>: New member. 3542 <mapped_remap>: Remove. 3543 * src/gdbmopen.c: Fix a typo. 3544 (gdbm_open): Initialize new members. 3545 (_gdbm_init_cache): Second argument is size_t. 3546 * src/gdbmsetopt.c (gdbm_setopt): Optval argument is void*. 3547 Handle GDBM_SETMAXMAPSIZE. 3548 Improve error checking. 3549 * src/mmap.c (_GDBM_IN_MAPPED_REGION_P): Fix comparison with 3550 the lower bound. 3551 (_GDBM_NEED_REMAP): Return true if mapped_region is NULL. 3552 (SUM_FILE_SIZE): Rewrite. 3553 (_gdbm_mapped_unmap): Don't call msync. 3554 (_gdbm_internal_remap): Take 2 arguments, the second one 3555 giving the new mapped size. 3556 Unmap the region prior to remapping it. 3557 Always pass NULL as the argument to mmap. 3558 (_gdbm_mapped_remap): Rewrite the logic. Change semantics of the 3559 third argument. All uses updated. 3560 (_gdbm_mapped_init): Reflect the above changes. 3561 (_gdbm_mapped_read,_gdbm_mapped_write): Use mmap_inited to decide 3562 whether to use mmap, because mapped_region can be reset to zero 3563 by another functions (namely, _gdbm_mapped_lseek). 3564 Reset mmap_inited to FALSE, if _gdbm_mapped_remap fails. 3565 (_gdbm_mapped_lseek): Rewrite offset computations. Invalidate 3566 the mapped region. 3567 * src/proto.h (_gdbm_init_cache): Change prototype. 3568 * src/update.c (write_header, _gdbm_end_update): Remove checks 3569 for dbf->mapped_region. 3570 * tests/gtload.c: Implement the -maxmap option (set maximal 3571 mapped memory size). 3572 3573 * doc/gdbm.texinfo: Document GDBM_SETMAXMAPSIZE. 3574 35752011-08-09 Sergey Poznyakoff <gray@gnu.org.ua> 3576 3577 Update the docs. 3578 3579 * doc/gdbm.texinfo: Document compatibility functions, 3580 provide more cross-references. 3581 35822011-08-09 Sergey Poznyakoff <gray@gnu.org.ua> 3583 3584 Implement dbm_error and dbm_clearerr. 3585 3586 * compat/ndbm.h (__gdbm_error_to_ndbm): New macro 3587 (dbm_error,dbm_clearerr): Provide prototypes instead of 3588 the macros. 3589 (DBM) <_dbm_errno>: New member. 3590 * compat/dbmerr.c: New file. 3591 * compat/Makefile.am (NDBM_CF): Add dbmerr.c 3592 * compat/dbmdelete.c: Make sure _dbm_errno reflects the 3593 actual error state. 3594 * compat/dbmfetch.c: Likewise. 3595 * compat/dbmseq.c: Likewise. 3596 * compat/dbmstore.c: Likewise. 3597 35982011-08-08 Sergey Poznyakoff <gray@gnu.org.ua> 3599 3600 Provide test group descriptors in the testsuite. 3601 3602 * tests/atlocal.in (XFAILFILE): Remove. 3603 * tests/version.at: Don't create XFAILFILE. 3604 * tests/testsuite.at: Add test group banners 3605 * tests/dbmcreate00.at (AT_SETUP): Change description. 3606 * tests/dbmdel00.at: Likewise. 3607 * tests/dbmdel01.at: Likewise. 3608 * tests/dbmdel02.at: Likewise. 3609 * tests/dbmfetch00.at: Likewise. 3610 * tests/dbmfetch01.at: Likewise. 3611 36122011-08-07 Sergey Poznyakoff <gray@gnu.org.ua> 3613 3614 * src/testgdbm.c: Change internal command invocation 3615 mechanism: the begin handler (if provided) initializes 3616 the invocation and computes the expected number of 3617 output lines. If it is greater than the screen size 3618 the pager is enabled. End handler (if supplied) cleans 3619 up after the invocation. 3620 3621 Always use error() for diagnostics. 3622 36232011-08-06 Sergey Poznyakoff <gray@gnu.org.ua> 3624 3625 * doc/Config: New file. 3626 * doc/gendocs_template: Rewrite for the new site layout. 3627 3628 * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. 3629 Force the use of --enable-libgdbm-compat on distcheck stage. 3630 3631 * compat/ndbm.h (DBM) <dirfd>: New member. 3632 * src/version.c (gdbm_version_cmp): New function. 3633 * compat/dbmclose.c (dbm_close): Close dirfd. 3634 * compat/dbmdirfno.c (dbm_dirfno): Return dirfd. 3635 * compat/dbmopen.c (dbm_open): Instead of linking 3636 pag to dir, create a separate dir file with the version 3637 information in it. When opening an existing db in 3638 write mode, detect if it has pag linked to dir. If so, 3639 break the link and recreate the dir file in new format. 3640 This allows GDBM to cooperate with the applications which 3641 lock both pag and dir files. 3642 * doc/gdbm.texinfo: Document gdbm_version_cmp. 3643 * NEWS: Update. 3644 36452011-08-05 Sergey Poznyakoff <gray@gnu.org.ua> 3646 3647 * configure.ac: Require latest autotools. Enable silent mode. 3648 * NEWS: Convert to the standard GNU outline format. Add entry 3649 for 1.9. 3650 36512011-08-05 Sergey Poznyakoff <gray@gnu.org.ua> 3652 3653 * configure.ac: Require latest autotools. Enable silent mode. 3654 * NEWS: Convert to the standard GNU outline format. Add entry 3655 for 1.9. 3656 36572011-08-05 Sergey Poznyakoff <gray@gnu.org.ua> 3658 3659 * tests/version.at: Update. 3660 * tests/Makefile.am: Define AT_PACKAGE_VERSION_MAJOR, 3661 AT_PACKAGE_VERSION_MINOR, and AT_PACKAGE_VERSION_PATCH. 3662 * src/lock.c: Shut the gcc warning. 3663 * doc/gdbm.texinfo: Minor fixes. 3664 * src/testgdbm.c (error): Bugfix. 3665 36662011-08-05 Sergey Poznyakoff <gray@gnu.org.ua> 3667 3668 * src/global.c: Remove. 3669 * src/extern.h: Remove. 3670 * src/Makefile.am: Remove extern.h and global.c 3671 * src/flatfile.c: Don't include extern.h 3672 * src/gdbmreorg.c: Likewise. 3673 * src/lock.c: Likewise. 3674 * src/testgdbm.c: Likewise. 3675 * src/gdbmerrno.c (gdbm_errno): New declaration (from 3676 global.c) 3677 3678 3679 * compat/dbm-priv.h: New file. 3680 * compat/dbm.h: New file. 3681 * compat/ndbm.h: New file. 3682 * compat/Makefile.am (include_HEADERS): Add dbm.h and ndbm.h 3683 (noinst_HEADERS): Add dbm-priv.h 3684 * compat/close.c: Rewrite using ndbm interface. 3685 * compat/dbminit.c: Likewise. 3686 * compat/delete.c: Likewise. 3687 * compat/fetch.c: Likewise. 3688 * compat/seq.c: Likewise. 3689 * compat/store.c: Likewise. 3690 3691 * compat/dbmclose.c: Include nbdm.h. 3692 Use the new DBM declaration. 3693 * compat/dbmdelete.c: Likewise. 3694 * compat/dbmdirfno.c: Likewise. 3695 * compat/dbmfetch.c: Likewise. 3696 * compat/dbmopen.c: Likewise. 3697 * compat/dbmpagfno.c: Likewise. 3698 * compat/dbmrdonly.c: Likewise. 3699 * compat/dbmseq.c: Likewise. 3700 * compat/dbmstore.c: Likewise. 3701 3702 * tests/Makefile.am: Add new files. 3703 * tests/atlocal.in: Conditionally define COMPAT. 3704 3705 * tests/create00.at: Update keywords. 3706 * tests/delete00.at: Likewise. 3707 * tests/delete01.at: Likewise. 3708 * tests/delete02.at: Likewise. 3709 * tests/fetch00.at: Likewise. 3710 * tests/fetch01.at: Likewise. 3711 3712 * tests/gtdel.c: Include progname.h instead of declaring 3713 canonical_progname. 3714 * tests/gtdump.c: Likewise. 3715 * tests/gtfetch.c: Likewise. 3716 * tests/gtload.c: Likewise. 3717 * tests/gtver.c: Likewise. 3718 3719 * tests/testsuite.at (AT_COMPAT_PREREQ): New macro. 3720 Add compat test cases. 3721 3722 * tests/dtload.c: New file. 3723 * tests/dtdump.c: New file. 3724 * tests/dtdel.c: New file. 3725 * tests/dbmcreate00.at: New test case. 3726 * tests/dbmfetch00: Likewise. 3727 * tests/dbmfetch01: Likewise. 3728 * tests/dbmdel00.at: Likewise. 3729 * tests/dbmdel01.at: Likewise. 3730 * tests/dbmdel02.at: Likewise. 3731 37322011-08-04 Sergey Poznyakoff <gray@gnu.org.ua> 3733 3734 * README: Update. 3735 * doc/gdbm.3: Update. 3736 37372011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3738 3739 * tests/gtver.c: New file. 3740 * tests/Makefile.am (check_PROGRAMS): Add gtver. 3741 * tests/.cvsignore: Update. 3742 * tests/version.at: Use gtver instead of testgdbm. 3743 37442011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3745 3746 * src/gdbm.proto: Remove. 3747 * src/gdbm.proto2: Remove. 3748 * src/gdbmerrno.h: Remove. 3749 * src/gdbm.h.in: New file. 3750 * Makefile.am (dist-hook): Remove destination file before 3751 copying over it. 3752 * configure.ac: Define Major,Minor numbers and Patchlevel 3753 separately. 3754 (GDBM_VERSION_MAJOR,GDBM_VERSION_MINOR) 3755 (GDBM_VERSION_PATCH): New substitution variables. 3756 * src/Makefile.am: Remove rules for building gdbm.h. 3757 It is now created by configure. 3758 (noinst_HEADERS): Install gdbm.h 3759 (EXTRA_DIST): Distribute gdbm.h.in. 3760 3761 * src/flatfile.c: Include arpa/inet.h and gdbm.h. 3762 * src/gdbmerrno.c: Include gdbm.h. 3763 * src/version.c: Include gdbm.h. 3764 (gdbm_version_number): New global variable. 3765 3766 * doc/gdbm.texinfo: Document gdbm_version_number and 3767 GDBM_VERSION_* macros. 3768 3769 * src/gdbmopen.c: Remove unused variables, fix format specs. 3770 * src/testgdbm.c: Remove unused variables, fix format specs. 3771 37722011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3773 3774 * Makefile.am (dist-hook): Replace /*@DIST_DATE@*/ with 3775 the actual distribution date. 3776 * src/version.c (gdbm_version): Update automatically. 3777 37782011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3779 3780 * (all files): Update copyright headers. 3781 37822011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3783 3784 * doc/Makefile.am (check-fixmes): New rule. 3785 * doc/gdbm.texinfo: Document flat format and related 3786 functions. 3787 3788 * src/flatfile.c: Minor changes. 3789 * src/gdbmerrno.c (gdbm_errlist): Indicate the size of 3790 array and document its entries to minimize the possibility 3791 of errors when editing it. 3792 * src/gdbmerrno.h (gdbm_errlist): New prototype. 3793 37942011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3795 3796 * src/gdbmdefs.h (struct gdbm_file_info) <name>: Remove 3797 the static qualifier. 3798 37992011-08-03 Sergey Poznyakoff <gray@gnu.org.ua> 3800 3801 * src/gdbm.proto2: Remove a leftover __P wrapper. 3802 * src/gdbmsetopt.c (gdbm_setopt): Avoid coredumps on NULL 3803 optval. 3804 3805 * doc/.cvsignore: Update. 3806 * doc/Makefile.am: Rewrite. 3807 * doc/gdbm.texinfo: Revise. 3808 * doc/gendocs_template: New file. 3809 * doc/untabify.el: New file. 3810 38112011-08-02 Sergey Poznyakoff <gray@gnu.org.ua> 3812 3813 * tests/.cvsignore: Update. 3814 * tests/Makefile.am: Add new tests. 3815 * tests/testsuite.at: Likewise. 3816 * tests/gtdump.c: Minor fix. 3817 * tests/gtfetch.c: Likewise. 3818 * tests/delete00.at: New file. 3819 * tests/delete01.at: New file. 3820 * tests/delete02.at: New file. 3821 * tests/gtdel.c: New file. 3822 3823 * Makefile.am (SUBDIRS): Add tests. 3824 * configure.ac: Initialize testsuite. 3825 * src/testgdbm.c: Minor fixes. 3826 * tests/Makefile.am: New file. 3827 * tests/atlocal.in: New file. 3828 * tests/create00.at: New file. 3829 * tests/fetch00.at: New file. 3830 * tests/fetch01.at: New file. 3831 * tests/gtdump.c: New file. 3832 * tests/gtfetch.c: New file. 3833 * tests/gtload.c: New file. 3834 * tests/num2word.c: New file. 3835 * tests/testsuite.at: New file. 3836 3837 * tests/version.at: New file. 3838 3839 * .cvsignore: Update. 3840 * compat/.cvsignore: Update. 3841 * doc/.cvsignore: Update. 3842 * export/.cvsignore: Update. 3843 * src/.cvsignore: Update. 3844 38452011-08-01 Sergey Poznyakoff <gray@gnu.org.ua> 3846 3847 * compat/dbminit.c: Remove useless include. 3848 * compat/dbmopen.c: Likewise. 3849 38502011-08-01 Sergey Poznyakoff <gray@gnu.org.ua> 3851 3852 * src/testgdbm.c (main): Support --help and --version for 3853 the sake of make distcheck. 3854 38552011-08-01 Sergey Poznyakoff <gray@gnu.org.ua> 3856 3857 * src/gdbm.proto: Remove the legacy __P stuff. 3858 38592011-08-01 Sergey Poznyakoff <gray@gnu.org.ua> 3860 3861 * Makefile.am (ACLOCAL_AMFLAGS): New variable. 3862 * configure.ac: Use AM_INIT_AUTOMAKE with arguments. 3863 3864 * src/gdbm.proto (GDBM_FILE): Change typedef. 3865 * src/gdbmdefs.h: Include gdbm.h 3866 (datum): Remove duplicate declaration. 3867 (gdbm_file_info): Change to struct gdbm_file_info 3868 3869 * src/proto.h: Use GDBM_FILE instead of gdbm_file_info *. 3870 Remove duplicate declarations. 3871 3872 * src/gdbmopen.c: Use GDBM_FILE instead of gdbm_file_info *. 3873 (gdbm_open): Fix signature to match global declaration. 3874 3875 * compat/dbmclose.c: Use GDBM_FILE instead of gdbm_file_info *. 3876 * compat/dbmdirfno.c: Likewise. 3877 * compat/dbmfetch.c: Likewise. 3878 * compat/dbmopen.c: Likewise. 3879 * compat/dbmpagfno.c: Likewise. 3880 * compat/dbmrdonly.c: Likewise. 3881 * compat/dbmseq.c: Likewise. 3882 * compat/dbmstore.c: Likewise. 3883 * src/bucket.c: Likewise. 3884 * src/extern.h: Likewise. 3885 * src/falloc.c: Likewise. 3886 * src/findkey.c: Likewise. 3887 * src/flatfile.c: Likewise. 3888 * src/gdbmclose.c: Likewise. 3889 * src/gdbmdelete.c: Likewise. 3890 * src/gdbmexists.c: Likewise. 3891 * src/gdbmfdesc.c: Likewise. 3892 * src/gdbmfetch.c: Likewise. 3893 * src/gdbmreorg.c: Likewise. 3894 * src/gdbmseq.c: Likewise. 3895 * src/gdbmsetopt.c: Likewise. 3896 * src/gdbmstore.c: Likewise. 3897 * src/gdbmsync.c: Likewise. 3898 * src/global.c: Likewise. 3899 * src/lock.c: Likewise. 3900 * src/mmap.c: Likewise. 3901 * src/testgdbm.c: Likewise. 3902 * src/update.c: Likewise. 3903 39042009-01-03 Sergey Poznyakoff <gray@gnu.org.ua> 3905 3906 * configure.ac: Update bug-reporting address. 3907 * doc/gdbm.texinfo: Likewise. 3908 * INSTALL, doc/version.texi: Remove automatically generated files. 3909 3910Wed Dec 3 19:29:25 PST 2008 Jason Downs (downsj@downsj.com) 3911 3912 * src/lock.c, src/gdbm.proto, src/proto.h: Disabled/removed 3913 gdbm_locked() for now, it's not needed. 3914 3915Sun Nov 30 16:48:29 PST 2008 Jason Downs (downsj@downsj.com) 3916 3917 * src/lock.c: Check errno to see if a lock failed because it's already 3918 locked. Add external gdbm_locked() routine to return the 3919 status of locking. Move lock type to the dbf. 3920 * src/gdbmdefs.h: Move lock type to the dbf. 3921 * src/gdbm.proto: Add gdbm_export(), gdbm_import(), and gdbm_locked(). 3922 39232008-11-30 Sergey Poznyakoff <gray@gnu.org.ua> 3924 3925 * src/lock.c: Remove flock/flock64 distinction. 3926 3927Sat Nov 29 23:22:24 PST 2008 Jason Downs (downsj@downsj.com) 3928 * configure.ac: Add test for lockf. 3929 3930 * src/lock.c: New file, adds _gdbm_unlock_file() and 3931 _gdbm_lock_file() routines. These attempt to use flock(), 3932 lockf(), and fcntl() locking. 3933 * src/proto.h: Add new prototypes. 3934 * src/systems.h: Remove file locking macros. 3935 * src/gdbmopen.c: Rewrite locking code, use _gdbm_lock_file(). 3936 * src/gdbmclose.c, src/gdbmreorg.c: Use _gdbm_unlock_file(). 3937 3938Sat Nov 29 21:19:32 PST 2008 Jason Downs (downsj@downsj.com) 3939 * configure.ac: Add test for sys/termios.h 3940 3941 * src/systems.h: Add macros for Solaris-style 64bit fcntl locks. 3942 * src/testgdbm.c: Add support for opening files without locking. 3943 Add support for opening files without mmap. 3944 Add sys/termios.h include and add check for TIOCWINSZ. 3945 3946 * export/export.c: Add support for opening files without locking. 3947 3948Mon Oct 29 15:14:53 EET 2007 Sergey Poznyakoff (gray@gnu.org.ua) 3949 3950 * configure.ac (AC_INIT): Add bug-reporting email. 3951 * gdbm.texinfo: Use values.texi for version and edition number and 3952 date. 3953 Document testgdbm and gdbmexport. 3954 Remove obsolete chapter describing conv2gdbm. 3955 3956 * export/export.c: Fix check for argc. 3957 Take name of the output file from the second argument. 3958 Accept -h and -v command line options. 3959 3960 * src/Makefile.am (noinst_PROGRAMS): move to bin_PROGRAMS. 3961 * src/flatfile.c (gdbm_export): Add missing break. 3962 * src/gdbmreorg.c (gdbm_reorganize): Call _gdbm_mapped_init if 3963 required. 3964 * src/testgdbm.c: Improve usage and version output to comply to 3965 standards.texi. 3966 Allow to operate on non-nul-terminated ascii data: 3967 (key_z, data_z): New variables. 3968 (key_z_handler, data_z_handler, status_handler): New handlers - 3969 commands 'z', 'Z' and 'S' 3970 All functions using key_data and data_data updated accordingly 3971 (read_from_file): 'r' command takes an optional second arg. 3972 (print_cache_handler): Use pager. 3973 (page_data): Ignore pager for non-interactive usage. 3974 3975Sun Oct 28 15:50:53 PDT 2007 Jason Downs (downsj@downsj.com) 3976 3977 * configure.ac: Add options for gdbmexport. 3978 * export/Makefile.am, export/export.c: New files, stand alone flat 3979 file exporter. 3980 * COPYING, all source files: Update to GPLv3. 3981 * src/Makefile.ac, compat/Makefile.ac: Move gdbm_compat to compat dir. 3982 * compat: New directory, populate with [n]dbm files. 3983 * src/Makefile.ac: Remove getopt.h. 3984 * testgdbm.c, conv2gdbm.c: Remove getopt.h. 3985 * configure.ac: Remove getopt. 3986 * getopt.h, getopt.c: Remove. 3987 3988Fri Oct 26 07:43:18 PDT 2007 Sergey Poznyakoff (gray@gnu.org.ua) 3989 3990 * src/Makefile.am (noinst_PROGRAMS): Remove testdbm, testndbm, 3991 and conv2gdbm 3992 * src/gdbmreorg.c (gdbm_reorganize): Call _gdbm_mapped_unmap 3993 * src/testgdbm.c: Redo command handling. Expect arguments to 3994 follow the command, otherwise prompt for them. 3995 3996Thu Oct 25 09:36:51 PDT 2007 Sergey Poznyakoff (gray@gnu.org.ua) 3997 3998 * src, doc: New directories 3999 * *.[ch], gdbm.proto, gdbm.proto2: Move to src 4000 * gdbm.texi, gdbm.3: Move to doc 4001 * configure.in: Rename to configure.ac, switch to deep structure 4002 * build-aux: Auxiliary dir for autoconf stuff 4003 * Makefile.am, src/Makefile.am, doc/Makefile.am: New file 4004 4005 * src/mmap.c (_gdbm_mapped_remap): Bugfix. 4006 * src/testgdbm.c: New commands '<' - read entries from file and store, 4007 and 'l' - list entire database 4008 4009Tue Oct 23 19:19:36 PDT 2007 Jason Downs (downsj@downsj.com) 4010 4011 * update.c: Force sync if using mmap. 4012 4013 * gdbmclose.c: Unmap file. 4014 4015 * gdbmopen.c: Initialize mmap. 4016 4017 * gdbmdefs.h: Finish adding mmap support. 4018 4019 * Makefile.in: Add mmap.c. 4020 4021 * mmap.c: New mmap() i/o routines, from Sergey Poznyakoff 4022 <gray@gnu.org.ua>. 4023 4024Thu Oct 18 18:16:26 PDT 2007 4025 4026 * gdbmdefs.h: Convert a bunch of flags to bit fields. 4027 4028 * gdbmconst.h, gdbm.proto, gdbm.proto2: Add GDBM_NOMMAP and clean up. 4029 4030 * gdbmerrno.c, gdbmerrno.h: New errnos. 4031 4032 * gdbmconst.h, gdbmdefs.h, gdbmopen.c: Implement new magic number(s). 4033 4034 * bucket.c, falloc.c, findkey.c, gdbmopen.c, gdbmstore.c, update.c: 4035 lseek() becomes __lseek(). 4036 4037 * bucket.c, falloc.c, gdbmopen.c, gdbmstore.c, update.c: write() 4038 becomes __write(). 4039 4040 * bucket.c, falloc.c, findkey.c, gdbmopen.c: read() becomes __read(). 4041 4042 * gdbmclose.c, gdbmopen.c, gdbmreorg.c, gdbmsync.c, update.c: fsync() 4043 becomes __fsync(). 4044 4045 * systems.h: New I/O macros. 4046 4047 * Makefile.in: Library version 4, remove BINOWN/BINGRP. 4048 4049 * autoconf.h.in, configure: Regenerate. 4050 4051 * aclocal.m4, config.guess, config.sub, ltmain.sh: Update. 4052 4053 * systems.h, gdbmfetch.c, gdbmopen.c, gdbmseq.c, gdbmstore.c, 4054 findkey.c: Switch to memcpy() and memcmp(). 4055 4056 * configure.in: Add mmap() support, sizeof off_t check, remove bcopy. 4057 4058 * proto.h, gdbmopen.c, update.c: Fatal function now takes a 4059 const char *. 4060 4061 * All .h and .c files: ANSI function declarations, remove __P macros. 4062 Also minor style fixes. 4063 4064Tue Oct 15 15:00:11 PDT 2002 Jason Downs (downsj@downsj.com) 4065 4066 * samp1.cc: Remove. 4067 4068 * gdbm.3, gdbm.texinfo: 1.8.3. 4069 4070 * version.c: Version 1.8.3., modernize string (release date is in 4071 American format). 4072 4073 * gdbmreorg.c: Remove small memory leak. 4074 4075 * Makefile.in: Use more subs from configure, remove mention of SunOS. 4076 Add support for spec'ing an install time prefix via INSTALL_ROOT. 4077 4078 * INSTALL: Remove extra text from top. 4079 4080 * config.guess, config.sub: Update to latest versions. 4081 4082 * autoconf.h.in: Regenerate. 4083 4084 * configure.in: Modernize. 4085 4086 * systems.h: HAVE_ST_BLKSIZE -> HAVE_STRUCT_STAT_ST_BLKSIZE. 4087 4088Fri Sep 27 16:12:44 PDT 2002 Jason Downs (downsj@downsj.com) 4089 4090 * Makefile.in: Remove `info' target from all, since we don't even 4091 bother installing the one we built anyway. 4092 4093 * Fix a few checks against dbf.read_write. 4094 4095Wed Sep 25 15:19:00 PDT 2002 Jason Downs (downsj@downsj.com) 4096 4097 * Makefile.in: Remove the dbm and ndbm routines from the main 4098 library, moving them to gdbm_compat. install-compat now 4099 installs the compat headers and the library. Increment the 4100 MAJOR number of the shared library due to the removal of 4101 the compat functions. 4102 4103 * gdbm.3, gdbm.texinfo, version.c: 1.8.1; note gdbm_compat. 4104 4105 * proto.h: Change _gdbm_fatal() to void. 4106 4107 * update.c(_gdbm_fatal): Change function declaration to void. 4108 4109 * update.c(_gdbm_fatal): Change default exit status to 1. 4110 4111 * gdbmopen.c(gdbm_open): Remove setting of flags since we always check 4112 it against the mask. 4113 4114 * testdbm.c, testndbm.c: Added stdlib.h inclusions. 4115 4116 * falloc.c(push_avail_block): Fixed extremely rare case where the 4117 header avail table could fill up, causing us to over flow the 4118 table, corrupting memory, and eventually crashing. Also forced 4119 merging of blocks within the scope of this routine (possibly 4120 should force them whenever the header avail table is being used). 4121 4122 * gdbmerrno.c: Fix error count, there are more than 18. 4123 4124 * gdbmerrno.h: Fix typo; GDBM_OPT_ILLEGAL is 20. 4125 4126 * gdbmopen.c: Fix typo; s/GDBM_OPENMASK/GDBM_WRITER/. 4127 4128Tue May 18 19:25:25 PDT 1999 Jason Downs (downsj@downsj.com) 4129 4130 * gdbm.3, gdbm.texinfo: Update for 1.8. 4131 4132 * Makefile.in, configure.in: Switch to using libtool, but without 4133 automake. 4134 4135 * aclocal.m4, config.guess, config.sub, ltconfig, ltmain.sh: New 4136 files (libtool 1.2). 4137 4138Wed May 12 01:26:15 PDT 1999 Jason Downs (downsj@downsj.com) 4139 4140 * gdbmopen.c, gdbmclose.c, gdbmreorg.c: check file_locking before 4141 calling locking macros; add support for setting GDBM_NOLOCK in 4142 gdbm_open(). 4143 4144 * gdbmdefs.h: add file_locking flag to gdbm_file_info. 4145 4146 * gdbmconst.h, gdbm.proto: add GDBM_NOLOCK flag. 4147 4148 * gdbmfdesc.c: new file, adds external gdbm_fdesc() routine. 4149 4150 * gdbm.proto, gdbm.proto2: clean up, use __P, and compress. 4151 4152 * gdbmerrno.h: kill the enum, add defines for errors. 4153 4154 * gdbmsetopt.c, testgdbm.c: support GDBM_SYNC/GDBM_SYNCMODE. 4155 4156 * gdbmopen.c: gdbm_open() now DEFAULTS to ``fast mode''; use 4157 GDBM_SYNC to turn it off. GDBM_FAST is obsolete and ignored. 4158 4159 * gdbmconst.h: add GDBM_SYNC and GDBM_SYNCMODE. 4160 4161 * proto.h, various source files: switch _ARGS to __P. 4162 4163 * systems.h, various source files: kill word_t, just use int 4164 everywhere. 4165 4166 * configure.in, autoconf.h.in: remove alloca() goo and modernize. 4167 4168 * many source files: replace all instances of alloca() with real 4169 malloc()s and free()s. 4170 4171 * update.c: don't deref NULL in _gdbm_fatal(), and don't use stdio. 4172 4173[ The following are entries revived from a dead experimental branch. ] 4174 4175Tue Nov 1 00:35:11 1994 Jason Downs (downsj@downsj.com) 4176 4177 * gdbmopen.c (gdbm_open): actually initialize central_free and 4178 coalesce_blocks. 4179 4180 * gdbmdefs.h: added coalesce_blocks. these should've been bitmapped. 4181 oh well. 4182 4183 * falloc.c (various routines): made block merging an option. 4184 4185 * gdbmsetopt.c (gdbm_setopt): added GDBM_COALESCEBLKS option. 4186 4187 * gdbmconst.h: added GDBM_COALESCEBLKS option. 4188 4189Fri Jun 3 09:45:19 1994 Jason Downs (downsj@downsj.com) 4190 4191 * falloc.c (_gdbm_free): if central_free is set, all blocks are 4192 put into the header. 4193 4194 * gdbmsetopt.c (gdbm_setopt): add GDBM_CENTFREE case. 4195 4196 * gdbmdefs.h, gdbmconst.h, gdbm.proto: add central free option. 4197 4198Fri Jun 3 05:57:36 1994 Jason Downs (downsj@downsj.com) 4199 4200 * falloc.c (pop_avail_block): merge block with header, instead 4201 of replace, since header may not be empty any longer. 4202 4203 * falloc.c (_gdbm_alloc): pop a block off the stack when the 4204 current header is half empty, instead of zero. 4205 4206Fri Jun 3 05:11:33 1994 Jason Downs (downsj@downsj.com) 4207 4208 * gdbmstore.c (gdbm_store): don't alloc new disk if we're replacing 4209 and the records are the same size. suggested by phil a long time 4210 ago. 4211 4212Fri Jun 3 03:47:46 1994 Jason Downs (downsj@downsj.com) 4213 4214 * falloc.c (_gdbm_put_av_elem): allow adjacent blocks to be 4215 merged. inspired by the enhancement by Tim Howes. 4216 4217Thu Jun 2 22:15:19 1994 Jason Downs (downsj@downsj.com) 4218 4219 * Makefile.in: add installation mode, owner, and group. 4220 4221Thu Jun 2 04:24:58 1994 Jason Downs (downsj@downsj.com) 4222 4223 * Makefile.in: run mkinstalldirs before installing files. 4224 4225 * mkinstalldirs: new file. 4226 4227[ End of revived entries. ] 4228 4229Thu May 19 15:50:04 1994 Jason Downs (downsj@downsj.com) 4230 4231 * NEWS, README: update to 1.7.3. 4232 4233 * gdbm.texinfo: update to 1.7.3, slight fixes. 4234 4235 * gdbm.3: update to 1.7.3, slight reformat. 4236 4237Thu May 19 14:45:51 1994 Jason Downs (downsj@downsj.com) 4238 4239 * gdbmconst.h: removed the header magic numbers from this 4240 branch. 4241 4242 * version.c: added an include of autoconf.h, updated version 4243 4244 * gdbm.proto: added a define for GDBM_FASTMODE. 4245 4246Sun May 15 02:39:48 1994 Jason Downs (downsj@downsj.com) 4247 4248 * gdbm.3, gdbm.texinfo: updates for 1.7.2 4249 4250 * README, NEWS, version.c: update for 1.7.2 4251 4252 * Makefile.in: removed files, changed (drastically) how the 4253 package compiles and installs. 4254 4255 * bytewise.c, bytewise.h: removed from this branch. 4256 4257Wed Mar 23 00:44:43 1994 Jason Downs (downsj@downsj.com) 4258 4259 * extern.h: removed bogus (old) function declarations. 4260 4261Mon Mar 14 01:37:09 1994 Jason Downs (downsj@downsj.com) 4262 4263 * Makefile.in: added new files. 4264 4265 * bytewise.c, bytewise.h: new portable byte order conversion 4266 package; supports 64bit longs/16bit ints. 4267 4268Sun Mar 13 22:56:10 1994 Jason Downs (downsj@downsj.com) 4269 4270 * gdbmsetopt.c, gdbmconst.h: added GDBM_FASTMODE option. 4271 4272 * falloc.c: taught _gdbm_alloc() about the header avail table. 4273 hopefully, this will fix the bloating problem. i dunno, though, 4274 as i've never had that problem, myself. 4275 4276Sun Dec 26 05:17:04 1993 Jason Downs (downsj@downsj.com) 4277 4278 * version.c: made gdbm_version const. 4279 4280 * gdbmerrno.c: made gdbm_strerror() and it's array const. 4281 4282 * various files: general clean up, reformating of code. 4283 4284 * systems.h: put <memory.h> inside of a conditional. 4285 4286 * configure.in, autoconf.h.in: added check for <memory.h>. 4287 4288 * systems.h: added a default define of SEEK_SET. 4289 4290 * bucket.c, gdbmopen.c, gdbmseq.c, gdbmdelete.c, gdbmdefs.h: 4291 cleaned up some uses of word_t. 4292 4293Tue Nov 16 03:11:56 1993 Jason Downs (downsj@downsj.com) 4294 4295 * gdbm.3, gdbm.texinfo: updated versions to 1.3 for release 4296 4297 * version.c, README, NEWS: updated versions to 1.7.1 for release 4298 4299Sun Nov 14 17:21:03 1993 Jason Downs (downsj@downsj.com) 4300 4301 * Makefile.in: added $(srcdir) to a few file references. 4302 4303Sat Nov 13 13:56:37 1993 Jason Downs (downsj@downsj.com) 4304 4305 * gdbm.3, gdbm.texinfo: added new gdbm_firstkey()/gdbm_nextkey() 4306 documentation. 4307 4308 * gdbmopen.c: added SGI alloca patch. 4309 4310 * Makefile.in: changed installation prefix semantics. 4311 4312Sat Nov 13 01:52:31 1993 Jason Downs (downsj@downsj.com) 4313 4314 * various source: redid the AIX alloca declaration. any new files 4315 that call alloca will have to start with the same header. 4316 4317 * all source, configure.in, Makefile.in: switched over to using 4318 autoconf.h, rather than packing all of the autoconf defs into 4319 the DEFS line. 4320 4321 * autoconf.h.in: new file. 4322 4323 * Makefile.in: changed rule for tndbm.o, hopefully making it more 4324 portable. 4325 4326 * alloca.c: added inclusion of stdlib.h 4327 4328Fri Nov 12 13:11:03 1993 Jason Downs (downsj@downsj.com) 4329 4330 * Makefile.in, configure.in: fixed getop related bugs. 4331 4332 * systems.h: moved sys/types.h include to top. 4333 4334Wed Nov 3 17:18:59 1993 Jason Downs (downsj@downsj.com) 4335 4336 * version.c: changed version to 1.7, for release. 4337 4338 * gdbmdefs.h: Moved all system includes to systems.h. 4339 4340Sun Oct 31 02:50:12 1993 Jason Downs (downsj@downsj.com) 4341 4342 * version.c: changed version number to 1.7alpha. 4343 4344 * gdbm.texinfo: updated to reflect new routines and changes. 4345 4346 * getopt.c, getopt.h: Added the GNU getopt.c to the dist, for 4347 compilation of testgdbm and conv2gdbm on machines without getopt(). 4348 4349 * various source files: changed all appropiate occurances of 'long' 4350 to type 'off_t'. Added off_t check to configure.in. 4351 4352 * gdbm.3: updated to reflect new routines and changes. 4353 4354Sat Oct 30 05:20:45 1993 Jason Downs (downsj@downsj.com) 4355 4356 * testgdbm.c: Added support for bucket cache and block sizes, 4357 adding -c, -b and -g flags. Must use -g to specify the file 4358 name, now. 4359 4360 * bucket.c, gdbmopen.c, gdbmclose.c, gdbmreorg.c, update.c, 4361 gdbmconst.h, gdbmdefs.h: Implemented dynamic, delayed 4362 initialization, bucket cache. New routine: _gdbm_init_cache(). 4363 4364 * proto.h, gdbmerrno.c, gdbmerrno.h: Added gdbm_setopt() errors 4365 and prototypes. 4366 4367 * gdbmsetopt.c: New file, implements the gdbm_setopt() routine. 4368 4369 * testgdbm.c, testndbm.c, testdbm.c, conv2gdbm.c: cleaned up 4370 compiler warnings. 4371 4372 * update.c: repaired declarations and added prototypes for 4373 static routines, repaired declaration of _gdbm_fatal(). 4374 4375 * falloc.c: repaired declarations and added prototypes for 4376 static routines. 4377 4378 * gdbmstore.c: commented out unsed variables in gdbm_store(). 4379 4380 * proto.h: added prototypes for _gdbm_read_entry(), 4381 _gdbm_find_key(), and gdbm_sync(). 4382 4383 * bucket.c, proto.h: changed _gdbm_get_bucket() and 4384 _gdbm_write_bucket() over to type void. 4385 4386Sat Oct 30 00:56:24 1993 Jason Downs (downsj@downsj.com) 4387 4388 * gdbmerrno.c, gdbmexists.c, close.c, dbmrdonly.c: New files, 4389 adding the routines gdbm_strerror(), gdbm_exists(), and for 4390 better compatibility with the old dbm/ndbm libraries, the 4391 dbmclose() and dbm_rdonly() routines. 4392 4393 * various headers: Added prototypes for the new routines, and 4394 rearranged how gdbm.h is generated. 4395 4396Fri Oct 29 07:02:41 1993 Jason Downs (downsj@downsj.com) 4397 4398 * README: split into README, INSTALL, and NEWS. INSTALL 4399 includes more tips on compiling. NEWS contains the 'short form' 4400 ChangeLog. 4401 4402 * Makefile.in, configure.in: Redid parts of the autoconf 4403 stuff, and repaired many bugs. 4404 4405 * systems.h: Repaired the alloca declarations, among other 4406 things. 4407 4408 * various source files: changed all relevant usage of type 4409 'long' to type 'word_t', which will always be 32bits wide. 4410 'word_t' is defined in systems.h. 4411 4412Fri Jul 30 13:27:24 1993 Phil Nelson (phil@cs.wwu.edu) 4413 4414 * findkey.c: Added a check of elem_loc == -1 in determining if 4415 the data cache held the item being looked for. 4416 4417Tue Jul 20 13:08:47 1993 Phil Nelson (phil at cs.wwu.edu) 4418 4419 * gdbm.texinfo: Fixed some errors. 4420 4421 * Makefile.in: Fixed some errors. 4422 4423 * version.c: Set version to 1.6 for release. 4424 4425Mon Jul 19 15:02:40 1993 Phil Nelson (phil at cs.wwu.edu) 4426 4427 * COPYING: Replaced Version 1 with Version 2. Also updated 4428 all file notices to refer to version 2. 4429 4430 * gdbm.texinfo: Updated the documentation. 4431 4432 * README: Updated to current version. 4433 4434 * Makefile: updated clean and install. 4435 4436Wed Jul 14 13:37:44 1993 Phil Nelson (phil at cs.wwu.edu) 4437 4438 * Makfile.in: Added samp1.cc to the list of distributed files. 4439 4440Sat Jun 5 21:35:59 1993 Phil Nelson (phil at cs.wwu.edu) 4441 4442 * gdbm.proto, Makefile.in: Added #ifndef _GDBM_H_ protection 4443 for the final gdbm.h file. Also added prototypes and C++ 4444 support. 4445 4446 * gdbmseq.c: Added gdbm_errno initialization to gdbm_nextkey. 4447 4448 * gdbmerrno.h and others: Moved the extern definition of 4449 gdbm_erron to gdbmerrno.h from the other files. 4450 4451Mon May 17 12:32:02 1993 Phil Nelson (phil at cs.wwu.edu) 4452 4453 * gdbm.proto: Added GDBM_FAST to the read_write flags. 4454 4455Sun May 16 12:50:01 1993 Phil Nelson (phil at cs.wwu.edu) 4456 4457 * configure.in, Makefile.in: Added autoconf configuration 4458 to gdbm. 4459 4460Tue Mar 30 00:08:48 1993 Phil Nelson (phil at cs.wwu.edu) 4461 4462 * global.c: Set gdbm_errno to GDBM_NO_ERROR to force 4463 it into the data segment. 4464 4465Sun Mar 28 22:51:40 1993 Phil Nelson (phil at cs.wwu.edu) 4466 4467 * gdbmfetch.c: Set return_val.dsize to 0 as a default return 4468 value. (I was told that was more compatible with dbm/ndbm.) 4469 4470 * gdbmopen.c: Changed a "sizeof(int)" to "sizeof(long)". 4471 4472 * testgdbm.c: Changed "char opt" to "int opt" to make sure 4473 opt can be -1. 4474 4475 * hash.c: Added "unsigned" to declaration of value for 4476 better overflow operation. 4477 4478 * gdbmreorg.c: Added a free for data.dptr in the main loop. 4479 Also changed the malloc for new_name to an alloca. 4480 Removed all frees on new_name. 4481 4482Sat Mar 27 23:25:14 1993 Phil Nelson (phil at cs.wwu.edu) 4483 4484 * gdbmconst.h, gdbmdefs.h, gdbmopen.c, gdbmreorg.c, 4485 testgdbm.c, update.c, gdbm.h: Added code to allow for a 4486 GDBM_FAST mode in which fsync is not called during 4487 database update mode. Added a new flag "-f" to 4488 testgdbm to make use of the new fast mode. 4489 4490 * gdbmsync.c: Added this function to allow a programmer 4491 to use the GDBM_FAST mode but still be able to sync 4492 a database. 4493 4494 * gdbmopen.c, gdbmdelete.c, gdbmfetch.c, gdbmseq.c, gdbmstore.c, 4495 gdbmreorg.c: Added initialization of gdbm_errno to GDBM_NO_ERROR. 4496 4497Mon Mar 22 23:03:36 1993 Phil Nelson (phil at cs.wwu.edu) 4498 4499 * gdbmclose.c: (gdbmclose) Added a fsync before close to make 4500 sure the file is written to disk before continuing. 4501 4502Sun Mar 21 21:33:31 1993 Phil Nelson (phil at cs.wwu.edu) 4503 4504 * proto.h: Added this as a new file. It adds ANSI prototypes 4505 for ANSI compilers. 4506 4507 * gdbmdefs.h: Added an include of proto.h. 4508 4509 * Makefile: Added proper references to proto.h 4510 4511 * gdbmopen.c: Changed (int *) casts to (long *) and added 4512 an initialization to dbf->header. 4513 4514 * gdbmreorg.c: Added an "end update" on the new database and 4515 correctly set up the bucket cache. 4516 4517 * update.c: (_gdbm_end_update) Added type void to header. 4518 4519Wed Mar 17 19:14:27 1993 Phil Nelson (phil at cs.wwu.edu) 4520 4521 * Changed copyright on all files to include 1993. Also deleted 4522 all references to my phone number. 4523 4524Thu Feb 28 17:05:09 1991 Phil Nelson (phil at strawberry.cs.wwu.edu) 4525 4526 * Added 1991 to copyright lines on all files. 4527 4528 * gdbmfetch.c: Fixed a bug introduced by previous changes. 4529 4530 * version.c: Updated version to 1.5. 4531 4532Fri Feb 8 12:27:13 1991 Phil Nelson (phil at strawberry.cs.wwu.edu) 4533 4534 * Change author's e-mail address in all comments. 4535 4536 * gdbmopen.c, systems.h: Changed opening sequence so that a 4537 database will not be truncated in NEWDB mode until the 4538 write has locked the file. 4539 4540 * testgdbm.c: Fixed a bug that caused a segmentation fault on 4541 one computer. Also added the flags "-r" for opening the 4542 database as a READER and "-n" for opening the database as 4543 a NEWDB writer. The default mode remains the WRCREAT mode. 4544 4545 * Various source files, changed the data types of various 4546 variables from int to long. This should not make any difference 4547 to systems where sizeof(int) = sizeof(long). It should make 4548 it easier to move to other systems. 4549 4550 * gdbmstore.c: Added a check for NULL key or content dptr. Due to 4551 NULLs being used as error indications, data cannot be NULL also. 4552 4553 * gdbmfetch.c, gdbmseq.c, fetch.c: Added checks for zero sized 4554 key and content so malloc will not try to allocate zero bytes. 4555 4556 * gdbmconst.h: Added this file so that all constants are in one 4557 central place. A few constants can be changed without changing 4558 the header sizes. 4559 4560Tue Aug 14 13:08:43 1990 Phil Nelson (phil at unicorn.wwu.edu) 4561 4562 * Version 1.4 released. (version.c: Updated to correct version.) 4563 4564 * Makefile: Added $(LIBS) to link for conv2gdbm. 4565 4566 * README: Updated to version 1.4 and added a 1.0-1.4 change 4567 statement. 4568 4569Wed Aug 8 16:57:29 1990 Phil Nelson (phil at unicorn.wwu.edu) 4570 4571 * gdbmopen.c: Restructured some code to initialize dbf 4572 more completely. 4573 4574 * dbm.h: Added a null define to satisfy some versions that 4575 require a dbmclose() call. 4576 4577 * findkey.c: (_gdbm_findkey) Added a check for the NULL 4578 pointer in ...ca_data.dptr. 4579 4580 * gdbmdelete.c: Added code to more completely remove the 4581 cache entry for a deleted item. 4582 4583 * gdbmreorg.c: Added code to finish the transfer of information 4584 from the new_dbf to the orginal dbf. 4585 4586Fri May 30 08:29:16 1990 Phil Nelson (phil at unicorn.wwu.edu) 4587 4588 * gdbmstore.c: Changed a strncpy to bcopy. 4589 4590Tue May 15 09:55:21 1990 Phil Nelson (phil at unicorn.wwu.edu) 4591 4592 * Version 1.3 released. 4593 4594 * systems.h: Changed the defines for alloca to use the 4595 name builtin_alloca to depend on BUILTIN_ALLOCA instead 4596 of __GNUC__. Added a definition of BUILTIN_ALLOCA for 4597 GNUC and for sun sparc. 4598 4599Fri May 11 12:15:56 1990 Phil Nelson (phil at unicorn.wwu.edu) 4600 4601 * systems.h: Removed the include for <sys/types> and now 4602 systems.h requires <sys/types> included before it. 4603 4604 * Makefile: Corrected the makefile to include a file that 4605 was missing before. Also, switched order of conv2gdbm 4606 and alldbm in the all option. 4607 4608 * findkey.c (_gdbm_read_entry): Reordered some statements 4609 to make the code more readable. 4610 4611 * update.c (_gdbm_fatal): Changed fatal message from "dbm fatal:" 4612 to "gdbm fatal:". 4613 4614Mon Apr 30 10:18:24 1990 Phil Nelson (phil at unicorn.wwu.edu) 4615 4616 * Version 1.2 released. 4617 4618Fri Apr 27 09:49:59 1990 Phil Nelson (phil at unicorn.wwu.edu) 4619 4620 * Makefile: Added the dist option. Similar to the 4621 addition from hack@ai.mit.edu, but correct. 4622 4623 * falloc.c (push_avail_block): Change the avail count 4624 to reflect the correct number of entries. 4625 4626 * dbminit.c (dbminit): Changed the stat call to stat the 4627 ".dir" file as is done in dbmopen.c (dbm_open). 4628 4629Tue Apr 10 12:18:40 1990 Phil Nelson (phil at unicorn.wwu.edu) 4630 4631 * Version 1.1. released. 4632 4633 * gdbmopen.c (gdbm_open): Clear out bucket cache. 4634 4635 4636 4637 4638Local Variables: 4639mode: change-log 4640version-control: never 4641buffer-read-only: t 4642End: 4643