summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gdbm_test_parse_args_v: bugfixgdbmtestSergey Poznyakoff2022-01-101-1/+1
|
* Initial implementation of the gdbm_test frameworkSergey Poznyakoff2022-01-1022-745/+1596
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tools/Makefile.am: Build libgdbmtest.a * tools/gdbm_load.c: Use strtosize to convert numbers. * tools/gdbmapp.h (strtosize): New proto. (struct gdbm_symmap): New datatype. (gdbm_symmap_string_to_int) (gdbm_symmap_int_to_string): New protos. * tools/gdbmtest.c: New file. * tools/gdbmtest.h: New file. * tools/nonls.c: New file. * tools/util.c (strtosize) (gdbm_symmap_string_to_int) (gdbm_symmap_int_to_string): New functions. * tools/var.c: Use gdbm_symmap_ functions. * tests/Makefile.am: Change LDADD variables * tests/blocksize00.at: Change gtload options. * tests/blocksize01.at: Likewise. * tests/blocksize02.at: Likewise. * tests/dtdel.c: Remove unnecessary options. * tests/dtdump.c: Likewise. * tests/dtfetch.c: Likewise. * tests/dtload.c: Likewise. * tests/gtopt.c: Likewise. * tests/gtdel.c: Rewrite using gdbm_test framework. * tests/gtdump.c: Likewise. * tests/gtfetch.c: Likewise. * tests/gtload.c: Likewise. * tests/gtrecover.c: Likewise.
* One more fix in wordwrapSergey Poznyakoff2022-01-081-1/+1
|
* Bugfixes in parseopt and wordwrapSergey Poznyakoff2022-01-082-8/+21
| | | | | | | | | | | * tools/parseopt.c (print_option): Add newlines around group header text. Insert a comma between the short and corresponding long option. (parseopt_print_help): Don't use parseopt_program_args if it's NULL or empty. * tools/wordwrap.c (wordwrap_set_left_margin): Always force reindent of the following line. (flush_line): Fix the "full write" condition.
* BugfixesSergey Poznyakoff2022-01-082-2/+2
| | | | | | * src/bucket.c (_gdbm_cache_init): Accept sizes greater than the directory size. * src/gdbmsetopt.c (setopt_gdbm_getdbformat): Return 0 on success.
* Minor fixSergey Poznyakoff2022-01-071-1/+1
| | | | | * src/bucket.c (lru_unlink_elem): Take into account the possibility that dbf->cache_mru can be NULL.
* Speed up flushing the bucket cache on diskSergey Poznyakoff2022-01-0614-82/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of _gdbm_cache_flush becomes prohibitively inefficient during extensive updates of large databases. The bug was reported at https://github.com/Perl/perl5/issues/19306. To fix it, make sure that all changed cache entries are placed at the head of the cache_mru list, forming a contiguous sequence. This way a potentially long iteration over all cache entries can be cut off at the first entry with ca_changed == FALSE. This commit also gets rid of several superfluous fields in struct gdbm_file_info: - cache_entry Not needed, because the most recently used cache entry (cache_mru) is always the current one. - bucket_changed dbf->cache_mru->ca_changed reflects the status of the current bucket. - second_changed Not needed because _gdbm_cache_flush, which flushes all changed buckets, is now invoked unconditionally by _gdbm_end_update (and also whenever dbf->cache_mru changes). * src/gdbmdefs.h (struct gdbm_file_info): Remove cache_entry. The current cache entry is cache_mru. Remove bucket_changed, and second_changed. All uses changed. * src/proto.h (_gdbm_current_bucket_changed): New inline function. * src/bucket.c (_gdbm_cache_flush): Assume all changed elements form a contiguous sequence beginning with dbf->cache_mru. (set_cache_entry): Remove. All callers changed. (lru_link_elem,lru_unlink_elem): Update dbf->bucket as necessary. (cache_lookup): If the obtained bucket is not changed and is going to become current, flush all changed cache elements. * src/update.c (_gdbm_end_update): Call _gdbm_cache_flush unconditionally. * src/findkey.c: Use dbf->cache_mru instead of the removed dbf->cache_entry. * src/gdbmseq.c: Likewise. * tools/gdbmshell.c (_gdbm_print_bucket_cache): Likewise. * src/falloc.c: Use _gdbm_current_bucket_changed to mark the current bucket as changed. * src/gdbmstore.c: Likewise. * src/gdbmdelete.c: Likewise. Use _gdbm_current_bucket_changed. * tests/gtcacheopt.c: Fix typo. * tests/gtload.c: New option: -cachesize
* Update copyright yearsSergey Poznyakoff2022-01-02156-157/+157
|
* Rearrange the directory structureSergey Poznyakoff2021-11-2033-88/+107
| | | | | | Sources for the libgdbm library reside in src/. Sources for building accompanying tools are moved to the tools/ subdirectory.
* Update POTFILES.inSergey Poznyakoff2021-11-181-1/+4
|
* Fix typosSergey Poznyakoff2021-11-1817-20/+20
|
* Fix shell command in gdbmtoolSergey Poznyakoff2021-11-182-16/+27
| | | | | | | | | | Trailing whitespace was erroneously recognized as argument. * src/lex.l (string_end): Optionally return NULL if the collected string is of zero length. When leaving the SHELL condition, don't return T_WORD for trailing whitespace. * src/gdbmshell.c (shell_handler): Perror after failed execv.
* Fix gdbmtool import commandSergey Poznyakoff2021-11-181-3/+2
| | | | | | * src/gdbmshell.c (import_handler): Fix option addressing (see https://puszcza.gnu.org.ua/bugs/?535). Fix freeing of the uninitialized variable.
* Word wrapping output functions for gdbm appsSergey Poznyakoff2021-11-1810-155/+1235
| | | | | | | | | | | | | | * src/Makefile.am (libgdbmapp_a_SOURCES): Add wordwrap.c * src/wordwrap.c: New file. * tests/Makefile.am: Add t_wordwrap and wordspit.at * tests/testsuite.at: Add new test. * tests/t_wordwrap.c: New file. * src/gdbmshell.c (help_handler): Use wordwrap functions. * src/parseopt.c: Rewrite help output using wordwrap. Add support for the ARGP_HELP_FMT environment variable. Make sure no empty strings are ever passed to gettext.
* Minor fixSergey Poznyakoff2021-11-161-1/+4
|
* Fix memory leaks in gdbmshellSergey Poznyakoff2021-11-168-47/+112
| | | | | | | | | | | | | | | | | | | | | | * configure.ac: Don't use $YACC and $LEX (undefined since f4c143fbdf). * src/gdbmshell.c (run_command): Free arglist if not saved to last_args. * src/gdbmtool.c (gdbmtool_init): Correctly report unrecognized long options. * src/gdbmtool.h (YY_LOCATION_PRINT): Define to locus_print. (locus_print): New proto. * src/gram.y: Define destructors for various symbols. * src/lex.l: Save source file names in a linked list. Don't free source name in input_context_pop, because yypush might refer to it via yyloc stack even after readinf eof (e.g. when printing location). The collected list is freed at program exit. (locus_print): New function. * src/parseopt.c (parseopt_free): New function. (parseopt_first): Call parseopt_free. (parseopt_next): Call parseopt_free, depending on the result. * src/var.c (variable) <freehook>: New member. (errormask_freehook): New function. Set it as freehook for errorexit and errormask. (variables_free): Call freehook, if defined.
* gdbmtool: bugfixesSergey Poznyakoff2021-11-161-10/+35
|
* gdbmshell: fix exit on error and improve directory/bucket inspection.Sergey Poznyakoff2021-11-151-148/+332
| | | | | | | | | | | | | | Output from the "dir" command includes, for each directory entry, the corresponding hash prefix. The "bucket" command, when used without arguments, assumes current bucket. Its output includes: bucket local depth, number of directory entries pointing to that bucket (references), and, if the latter is greater than one, indexes to the first and last directory entries where it is referenced. New command "sibling" inspects the sibling bucket of the current one, i.e. the bucket corresponding to the hash prefix with the last bit inverted.
* Version 1.22.90Sergey Poznyakoff2021-11-142-1/+29
|
* Switch to hash table cache implementationSergey Poznyakoff2021-11-1415-717/+716
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/cachetree.c: Remove. * src/Makefile.am: Remove cachetree.c * doc/gdbm.texi: Document the changes. * src/bucket.c (cache_tab_lookup_slot) (cache_tab_resize): New function. (cache_elem_new): Initialize ca_coll. (cache_elem_free, cache_lookup) (_gdbm_cache_init,_gdbm_cache_free): Rewrite with hash-based cache lookup. (_gdbm_fetch_data): Remove unused function. * src/gdbm.h.in (GDBM_GETDBFORMAT, GDBM_GETDIRDEPTH) (GDBM_GETBUCKETSIZE, GDBM_GETCACHEAUTO, GDBM_SETCACHEAUTO): New option codes. * src/gdbmdefs.h (cache_node): Remove. (cache_elem): Remove ca_node. Add ca_coll (collision resolution pointer). (gdbm_file_info): New members: cache_auto, cache_bits, cache. * src/gdbmopen.c (gdbm_fd_open): Change cache initialization. * src/gdbmsetopt.c (GDBM_GETDBFORMAT,GDBM_GETDIRDEPTH) (GDBM_GETBUCKETSIZE,GDBM_GETCACHEAUTO) (GDBM_SETCACHEAUTO): Implement new options. (setopt_gdbm_getflags): Reflect the state of GDBM_CLOEXEC and GDBM_NUMSYNC. * src/proto.h (_gdbm_fetch_data,_gdbm_cache_tree_alloc) (_gdbm_cache_tree_destroy,_gdbm_cache_tree_delete) (_gdbm_cache_tree_lookup): Remove protos. * src/recover.c (_gdbm_finish_transfer): Restore original cache settings. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise. * tests/gtcacheopt.c: New file. * tests/setopt02.at: New test case.
* Include timestamp in the NEWS entrySergey Poznyakoff2021-10-191-1/+1
|
* Version 1.22v1.22Sergey Poznyakoff2021-10-193-5/+4
|
* gdbm_recover does not disable crash toleranceSergey Poznyakoff2021-10-182-8/+0
| | | | | * src/recover.c (_gdbm_finish_transfer): Remove call to _gdbmsync_done. * doc/gdbm.texi: Reflect the changes.
* Revise the GDBM ManualSergey Poznyakoff2021-10-182-189/+229
|
* Escape Makefile variable references in AC_PATH_PROGSergey Poznyakoff2021-10-171-2/+2
|
* Change build process: explicitly require bison and flexSergey Poznyakoff2021-10-174-11/+17
|
* Update the docsSergey Poznyakoff2021-10-178-407/+967
| | | | | | | | | | | | * Makefile.am: Use plain git log to format the ChangeLog. * git2chg.awk: Remove. * NOTE-WARNING: Update. * README: Likewise. * README-alpha: Likewise. * README-hacking: Likewise. * doc/gdbm.3: Likewise. * doc/gdbm.texi
* Improve documentationSergey Poznyakoff2021-10-112-1/+49
|
* Update configure.acSergey Poznyakoff2021-10-101-16/+39
| | | | | | | | | That should fix https://puszcza.gnu.org.ua/support/?349 * configure.ac: Don't use obsolete macros. Use AM_GNU_GETTEXT_REQUIRE_VERSION (and require gettext 0.19), if available. Install a kludge for that to work on autoconf 2.69. Don't check for libdbm and libnbml.
* Fix key verification in sequential access.Sergey Poznyakoff2021-09-193-18/+20
| | | | | | | | | | This fixes https://oss-fuzz.com/testcase-detail/6317999997452288 and improves 4046a0af. * src/bucket.c (gdbm_dir_entry_valid_p): Move to proto. * src/proto.h (gdbm_dir_entry_valid_p): New inline function. * src/gdbmseq.c (gdbm_valid_key_p): Use gdbm_dir_entry_valid_p to validate the buffer index. Reorder the checks.
* Fix computation of dbf->avail->count after pushing new avail block.Sergey Poznyakoff2021-09-161-2/+2
| | | | | | | This is a very long-standing bug that caused a loss of an avail entry if the original avail table had odd number of entries. * src/falloc.c (push_avail_block): Fix computation of dbf->avail->count.
* Fix typoSergey Poznyakoff2021-09-161-1/+1
|
* Remove a left-over note from the READMESergey Poznyakoff2021-09-151-6/+0
|
* Add missing includeSergey Poznyakoff2021-09-091-0/+1
| | | | * src/gdbmtool.h: Include string.h
* Fix stack overflow in print_usageSergey Poznyakoff2021-09-091-1/+1
| | | | | * src/parseopt.c (print_usage): Fix length calculation for long options.
* Reset TERM for dejagnu testsuiteSergey Poznyakoff2021-09-071-0/+1
| | | | | | See https://puszcza.gnu.org.ua/bugs/index.php?520 * tests/gdbmtool/config/default.exp: Set TERM to empty string.
* Fix testing with DejaGNU 1.6.3Sergey Poznyakoff2021-09-075-33/+35
| | | | | | | | | | | | | DejaGNU starting from version 1.6.3 looks for the testsuite in the directory testsuite. See https://puszcza.gnu.org.ua/bugs/index.php?519 * configure.ac: Register tests/gdbmtool/Makefile * tests/Makefile.am: Move dejagnu tests to the gdbmtool subdir. * tests/gdbmtool/Makefile.am: New file. * tests/config/default.exp: Move to tests/gdbmtool/config/default.exp * tests/gdbmtool/base.exp: Move to tests/gdbmtool/testsuite/gdbmtool/base.exp
* Determine if st_mtim is present in struct statSergey Poznyakoff2021-09-074-7/+27
| | | | | | | | | | | | | * configure.ac: Check for st_mtim and st_mtimespec in struct stat. The former is POSIX, the latter is used instead of it on some systems (reportedly, Darwin and NetBSD). * src/systems.h [!HAVE_STRUCT_STAT_ST_MTIM]: Use st_mtimespec if available. * src/gdbmshell.c (print_snapshot): Fall back to st_mtime if nanosecond precision is not available. * src/gdbmsync.c (timespec_cmp): Take two pointers to struct stat as arguments. Use the right time field, depending on the configuration settings. All uses changed.
* Fix file header validationSergey Poznyakoff2021-09-051-2/+2
| | | | | * src/gdbmopen.c (validate_header_std) (validate_header_numsync): Check if bucket_size is > 0.
* Revert "Request gettext version 0.18 or newer"Sergey Poznyakoff2021-09-051-1/+1
| | | | This requires autoconf 2.70. Reverted until it is spread wide enough.
* Request gettext version 0.18 or newerSergey Poznyakoff2021-09-041-1/+1
|
* Minor changeSergey Poznyakoff2021-09-031-1/+1
|
* gdbm_fuzzer: use atexit to free memory allocated for script bufferSergey Poznyakoff2021-09-031-0/+12
| | | | | * fuzz/gdbm_fuzzer.c: (fuzzer_exit): New function. (LLVMFuzzerInitialize): Register atexit handler.
* Add seed builder script and runcom file for gdbm_fuzzerSergey Poznyakoff2021-09-032-0/+140
|
* Add gdbm_fuzzer.cSergey Poznyakoff2021-09-031-0/+188
|
* Change semantics of the errorexit variable.Sergey Poznyakoff2021-09-034-182/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "errorexit" variable is a string variable with the same syntax as errormask. If a GDBM error is reported and the corresponding gdbm_errno value is listed in this variable, further script execution is aborted. Setting it as boolean value is equivalent to set errorexit="all". * src/gdbmshell.c (all handlers): Return a GDBMSHELL_* error code. (closedb): Unset the fd variable only after closing the database. (run_command): If handler reported GDBM error and gdbm_errno is listed in the errorexit variable, return 1 (which will cause YYABORT in parser). * src/gdbmtool.h (VAR_ERR_GDBM): New variable error code. (variable_has_errno): New function. (gdbm_error_is_masked): Rewrite using variable_has_errno. * src/gram.y: Abort if run_command or run_last_command return !0. Handle VAR_ERR_GDBM. * src/var.c (variable): New member: data. (errorexit variable): Change type to VART_STRING; install sethook and typeconv. (variable_unset): When unsetting string variable, free and reset its value. (cachesize_sethook,centfree_sethook) (coalesce_sethook): Return VAR_ERR_GDBM on gdbmshell_setopt error. (errormask_sethook): Keep the mask vector in the data member. Handle conversions from boolean. (errorexit_sethook): Call errormask_sethook unless in interactive session.
* Minor changeSergey Poznyakoff2021-09-031-1/+4
| | | | * tests/gtconv.c (main): Free allocated memory before exit.
* bootstrap: options for disable po download and for updating po filesSergey Poznyakoff2021-09-031-27/+69
|
* Minor changeSergey Poznyakoff2021-09-031-233/+380
| | | | | * src/gdbmshell.c (command_type): Change initializer. (gdbmshell_run): Initialize the .len member.
* gdbmtool: new command "perror"; new options -t, -T; improve timing outputSergey Poznyakoff2021-09-033-14/+162
| | | | | | | | * doc/gdbm.texi: Document the perror command. * src/gdbmshell.c: New command: perror. (run_command): In timing mode, print also user and system CPU times. Print traces on stderr. * src/gdbmtool.c: New options: -t (--trace) and -T (--timing).