build: eliminate all remaining compile warnings
Production (hand-fixed, semantics preserved with width-limited %.*s): - persist.c (33 sites): workdir/name joins share the destination budget; WAL segment/snapshot paths via a WAL_SEG_WALPATH_MAX macro derived from seg_path's own declared size; trim loops use d_name's NAME_MAX (255) cap. - config_repl.c (16 sites) and ha.c's config-hash twin: same half-split and fixed-literal-tail budgets, byte-identical path construction kept between ha.c and conf_save_config. - main.c: certdir/key/cert paths leave room for their fixed suffixes. Test suites (-Wno-format-truncation, rationale in-tree): the 68 remaining sites are all snprintf(dir, 4096, "%s/<literal>") fixture scratch paths under mkdtemp /tmp/xce_* dirs that never approach PATH_MAX -- gcc cannot prove the tail fits, but every one is a false positive. Applied as a compile_args declare_dependency on each suite's shared deps list. Vendored c-capnproto: -Wno-switch (~40 exhaustive-dispatch false positives), -Wno-unused-function (empty define_encode_function stub), -Wno-format-overflow (255-byte uniontag + 3-byte prefix vs 256-byte buf, unreachable schema lengths). Both the wrap checkout and the packagefiles overlay patched identically. Also: test_worker_launch_type_dispatch removes its fixed-path fake-xrun /tmp fixture at exit (bug-924 /tmp hygiene; the mkdtemp shim can't see it). Verified: fresh full recompile of every source = 0 warnings (gcc 13.3, -Wall asan profile); meson test 134/134 green; no /tmp/xce_* residue. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
d4957bd290
commit
e723c9c234
9 changed files with 186 additions and 53 deletions
|
|
@ -164,9 +164,13 @@ static int upgrade_materialization_read_live_config_sha256(cluster_t *c,
|
|||
return -ENOENT;
|
||||
|
||||
/* effective_dir = workdir/name — must match conf_save_config's own path
|
||||
* construction (config_repl.c) exactly, mirroring local_config_sha256. */
|
||||
* construction (config_repl.c) exactly, mirroring local_config_sha256.
|
||||
* Width-limited %.*s: workdir/name fit conf_dir so "/conf/<fname>" (fixed
|
||||
* + 256-byte tail) provably fits path (4096+256) below. */
|
||||
char conf_dir[4096];
|
||||
snprintf(conf_dir, sizeof(conf_dir), "%s/%s", mc->workdir, mc->name);
|
||||
snprintf(conf_dir, sizeof(conf_dir), "%.*s/%.*s",
|
||||
(int)(sizeof(conf_dir) / 2), mc->workdir,
|
||||
(int)(sizeof(conf_dir) / 2 - 2), mc->name);
|
||||
|
||||
char fname[256] = {0};
|
||||
int rc = conf_read_current_filename(conf_dir, fname, sizeof(fname));
|
||||
|
|
@ -174,7 +178,9 @@ static int upgrade_materialization_read_live_config_sha256(cluster_t *c,
|
|||
return -ENOENT; /* no local bytes yet — caller fences + retries */
|
||||
|
||||
char path[4352];
|
||||
snprintf(path, sizeof(path), "%s/conf/%s", conf_dir, fname);
|
||||
snprintf(path, sizeof(path), "%.*s/conf/%.*s",
|
||||
(int)(sizeof(path) - sizeof("/conf/") - 256), conf_dir, 256,
|
||||
fname);
|
||||
|
||||
uint8_t *bytes = NULL;
|
||||
size_t blen = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue