From: Derrick Stolee Date: Mon, 09 Nov 2026 13:32:13 GMT Subject: Re: [PATCH 12/15] scalar: handle NULL value for scalar.repo Message-ID: In-Reply-To: On 11/7/2026 3:42 AM, Thomas Bachem via GitGitGadget wrote: > From: Thomas Bachem > > A scalar.repo without a value makes "scalar reconfigure --all" > segfault: get_scalar_repos() passes the NULL value to > string_list_append(), which copies it with xstrdup(). > > Reject a missing value with config_error_nonbool(). This cannot break > a working setup, as "scalar register" always writes scalar.repo with > a path. > - if (!strcmp(key, "scalar.repo")) > + if (!strcmp(key, "scalar.repo")) { > + if (!value) > + return config_error_nonbool(key); > string_list_append(list, value); > + } I had to look up the definition of 'config_error_nonbool' to be sure that this was the right method to call, but it is: /* * Call this to report error for your variable that should not * get a boolean value (i.e. "[my] var" means "true"). */ #undef config_error_nonbool int config_error_nonbool(const char *var) { return error(_("missing value for '%s'"), var); } > +test_expect_success '`reconfigure -a` rejects scalar.repo without a value' ' > + test_must_fail scalar -c scalar.repo reconfigure -a 2>err && > + test_grep "missing value for .scalar.repo." err > +' Thank you for testing. -Stolee