From: Phillip Wood Date: Mon, 09 Nov 2026 15:07:19 GMT Subject: Re: [PATCH 01/15] rebase -i: handle NULL value for rebase.missingCommitsCheck Message-ID: <226aff79-b0b8-41b1-92ce-78554f6b2f8b@gmail.com> In-Reply-To: Hi Thomas On 07/11/2026 08:42, Thomas Bachem via GitGitGadget wrote: > From: Thomas Bachem > > A rebase.missingCommitsCheck without a value, as in > > [rebase] > missingCommitsCheck > > or "git -c rebase.missingCommitsCheck", makes "git rebase -i" > segfault as it writes the todo list: get_missing_commit_check_level() > passes the NULL value to strcasecmp(). > > The setting takes "ignore", "warn" or "error", not a bool. Read it > with repo_config_get_string_tmp(), which rejects a missing value with > config_error_nonbool(), as ba176db511 (config: handle NULL value when > parsing non-bools, 2023-12-07) did for other settings. If the user sets an invalid value for this config option then we print a warning and default to "ignore". It would seem reasonable to me to do the same for a missing value rather than erroring out. Thanks for fixing these segfaults Phillip > > Assisted-by: Claude Fable 5.1 > Signed-off-by: Thomas Bachem > --- > rebase-interactive.c | 2 +- > t/t3404-rebase-interactive.sh | 7 +++++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/rebase-interactive.c b/rebase-interactive.c > index 809f76a87b..4eb628ee8f 100644 > --- a/rebase-interactive.c > +++ b/rebase-interactive.c > @@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void) > { > const char *value; > > - if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) || > + if (repo_config_get_string_tmp(the_repository, "rebase.missingcommitscheck", &value) || > !strcasecmp("ignore", value)) > return MISSING_COMMIT_CHECK_IGNORE; > if (!strcasecmp("warn", value)) > diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh > index ff11abb2f2..813ad2a83d 100755 > --- a/t/t3404-rebase-interactive.sh > +++ b/t/t3404-rebase-interactive.sh > @@ -1562,6 +1562,13 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' ' > test B = $(git cat-file commit HEAD^ | sed -ne \$p) > ' > > +test_expect_success 'rebase -i rejects rebase.missingCommitsCheck without a value' ' > + rebase_setup_and_clean missing-commit && > + test_when_finished "test_might_fail git rebase --abort" && > + test_must_fail git -c rebase.missingCommitsCheck rebase -i --root 2>err && > + test_grep "missing value for .rebase.missingcommitscheck." err > +' > + > test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ignore' ' > test_config rebase.missingCommitsCheck ignore && > rebase_setup_and_clean missing-commit &&