1556 Commits
Author SHA1 Message Date
pancake 8edd753d2e ArQC instead of ArQ 2026-11-02 21:30:25 +01:00
pancake 493d5ced7e Release 2.6.2 2.6.2 2026-10-30 11:50:07 +01:00
pancake fe2d2cc696 Use Ubuntu 24.04 for MinGW CI 2026-10-30 11:00:47 +01:00
pancake e9d777ba6e Repro mingw build issues 2026-10-30 10:58:39 +01:00
pancake 9dc4616248 Release 2.6.0 2026-10-30 10:33:40 +01:00
Andrei Bacescu ecd765c0e3 Free the key and value copies when sdb_ht_insert fails 2026-10-30 09:33:51 +01:00
pancake ce6d0d8e3f Move file and database lock handling out of disk.c
Portable file primitives (open with delete sharing, unlink, mkdir,
mkdirp and atomic replace) live in file.c with a single UTF-16 path
conversion, leaving disk.c with the cdb write logic only.

sdb_lock_db and sdb_unlock_db are now the only way to take or release
a database lock, replacing the copies in sdb.c, main.c and tool.c.
2026-10-30 09:29:00 +01:00
pancake 0e45f58945 Replace databases on Windows while other processes have them open
MoveFileEx cannot replace a file that another process keeps open, so
syncing a database failed while any reader such as radare2 had it open.
Open databases with FILE_SHARE_DELETE and replace them with a POSIX
semantics rename, falling back to MoveFileEx where it is unsupported.
2026-10-30 09:22:33 +01:00
pancake b0038d5d31 Rebuild databases from scratch and fail sdb -r on write errors
sdb -r and "sdb db =" opened the existing database before loading the
text, so keys removed from the source were merged back in. Build into
an empty database instead, holding the lock on the target path.

sdb -r also exited 0 when a .sdb or .c output could not be written,
and succeeded as long as any single file did.
2026-10-30 09:17:35 +01:00
pancake 0bd51cb341 Only wait in sdb_lock_wait while another process holds the lock
Any failure to create the lock file was retried forever, so writing a
database into a read-only directory hung instead of failing.
2026-10-30 09:17:35 +01:00
pancakeandClaude Opus 5.5 b6e8dcf569 Only release database locks that were actually taken
sdb_new() recorded the lock mode even when no lock was taken for
unnamed databases, so sdb_fini() passed an uninitialized path to
sdb_unlock(). sdb_file() ignored lock path and lock failures, letting a
later unlock remove a lock owned by another process, and the sdb_new()
fail path leaked the lock it had just taken.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:27:33 +01:00
pancakeandClaude Opus 5.5 c42463d94c Report sdb_sync failures when creating and synchronizing databases
createdb() ignored the result of sdb_sync() and always exited 0, even
when nothing could be written. sdb_ns_sync() now returns whether every
namespace was saved, and SIGHUP keeps the unsaved changes in memory
instead of reopening the database from disk when the sync fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:20:34 +01:00
pancakeandClaude Opus 5.5 ab74619fed Lock the database when updating it from the sdb command line
Parallel "sdb db key=value" runs opened the database without a lock,
rewrote it through the same .tmp file and the last writer dropped the
other keys; on Windows the MoveFileEx replace also failed while another
process had the database open. Wait on the database lock for queries,
release it before exiting and before SIGHUP reopens the database.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:19:02 +01:00
pancakeandClaude Opus 5.5 f57d91c368 Remove the lock file when writing the pid fails
sdb_lock() returned false but left the newly created .lock file behind,
so sdb_lock_wait() kept retrying against its own lock forever.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:16:45 +01:00
pancakeandClaude Opus 5.5 6245caf543 Serialize parallel sdb-tool builds with an auto-released lock on Windows
Running several sdb-tool instances on the same .sdb.txt raced on the
shared .tmp file and on MoveFileEx, silently leaving stale or missing
databases. dothesdb now waits on the db lock and reports sync failures.

On Windows the lock is an exclusive FILE_FLAG_DELETE_ON_CLOSE handle,
so the OS releases it when the owner exits or crashes and waiters
never hang on a stale lock file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:00:10 +01:00
pancake 7eb5e5483e Fix use-after-free when generated C output cannot be written 2026-10-30 07:33:21 +01:00
Andrei Bacescu 3c8c579a59 Keep shared descendants when unsetting a namespace
When sdb_ns_unset() released the last reference to the removed
namespace, sdb_free() went through sdb_ns_free(), which forces the
references of every descendant to 1 and frees them, even those still
owned by a sibling namespace or by the caller; a backreference could
free the parent. Reset the namespaces with the reference-aware
sdb_ns_reset() before releasing the last reference.

Fix and tests as suggested by trufae in review.
2026-10-27 06:01:26 +01:00
Andrei Bacescu 3694329c0e Free the namespace and release its sdb in sdb_ns_unset 2026-10-27 06:01:26 +01:00
pancake 2d086e18e8 Name the 1970-1601 epoch offset constant 2026-10-05 15:41:03 +02:00
pancake a57df8d063 Release 2.5.8 2.5.8 2026-10-04 11:28:27 +02:00
pancake 5fcc1cc908 Link internal database tests against static SDB 2026-10-04 11:05:29 +02:00
pancake 02a1653545 Fix database rereads without mmap 2026-10-04 11:05:29 +02:00
pancake 340cd2be0d Fix truncated escapes in generated databases 2026-10-04 11:05:29 +02:00
pancake e21cfda10a Release 2.5.6 2.5.6 2026-10-04 09:40:39 +02:00
pancake 105c54560e Fix C output filenames in recursive database generation 2026-10-04 09:35:39 +02:00
pancake 070d0bd5e3 Fix exit status and output of terminal CLI options 2026-10-04 09:23:22 +02:00
pancake 24edf75066 Release 2.5.4 2.5.4 2026-10-04 08:59:12 +02:00
curoky 0245bf42cf Honor static Meson library compilation ##build 2026-10-03 07:22:34 +02:00
dependabot[bot] 1a6fe8e5a7 Bump gha/release from 302 to 303 2026-09-07 08:45:02 +02:00
pancake f02312d334 Fix buffer overflow in json indent 2026-09-06 17:29:52 +02:00
pancake bf06fca93c Fix heap overflow via integer wrap-around 2026-09-06 17:12:28 +02:00
pancake 995dee739f Fix buffer overflow in sdb_json_format 2026-09-06 15:50:04 +02:00
pancake 0b72c123a9 Fix underflow pointer bug on strcpy 2026-09-06 15:39:21 +02:00
pancake 7723315732 Repair newlisp bindings 2026-09-06 13:28:48 +02:00
pancake 248611dc1e Fix character replacement advance in escape() 2026-09-06 13:03:42 +02:00
pancake 68dc921992 Fix sdb_unlink never deleting the database file 2026-09-06 11:08:20 +02:00
pancake 2c70014c74 Rename cdb_free to cdb_fini for consistency with cdb_init 2026-09-06 01:52:14 +02:00
pancake fb36a38b65 Release 2.5.2 2.5.2 2026-09-05 16:41:03 +02:00
pancake 8ae4163965 Fix off-by-one in sdb_exists/sdb_expire_set cdb_findnext key length 2026-09-05 04:42:56 +02:00
pancake 6998c96f91 Add missing NULL guards and fix the strbuf_append OOM leak 2026-08-14 00:46:45 +02:00
pancake 84c15597c5 Add glob matching support to sdb_match 2026-08-13 21:38:45 +02:00
pancake 61b212fd71 Fix public API boolification 2026-08-13 20:37:41 +02:00
pancake b2e3e25885 Refactored sdb_queryf megafunction 2026-08-13 12:48:28 +02:00
pancake 242542a30b Do not strlen twice in array.c 2026-08-13 11:38:00 +02:00
pancake 03a4e559ce Handle allocation failures in sdb_new, sdb_reset, hooks and ns walkers 2026-08-13 11:37:12 +02:00
pancake 73b842bee1 Deduplicate the cwisstable hashmap wrappers 2026-08-13 11:27:55 +02:00
pancake 9279f4f8bf Use sdb_gh_free for heap-allocated strings in text, fmt and tool code 2026-08-13 11:07:38 +02:00
pancake e733771663 Fix inverted logic in dict_add making it never insert new keys 2026-08-13 10:55:39 +02:00
pancake 72ff1b2d49 Add sdb_existf and sdb_getf format apis 2026-08-12 18:25:43 +02:00
pancake 14e37176ca Deduplicate key formatting primitives 2026-08-12 18:22:25 +02:00