From d92391abf99df1f6fccbb93b5879daf888e906ce Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 7 Mar 2025 18:34:26 -0800 Subject: repl: fix abort: tab completion over nonexistent package. This is a problem caused by b7a7370a921bbc02b54d87600ff74d5cb9efde28, on Feb 4, 2020, which adds unwinding logic into the provide_completions function. Two return statements are correctly turned into "goto out", but one is overlooked. When this stray return statement is executed, it leaves dangling unwind frames in the unwind stack, causing an assertion when control returns to the repl function which calls uw_pop_frame to remove an unwind frame that it pushed. Steps to reproduce: 1. complete a symbol with a nonexistent package 1> (foo:bar[Tab] 2. Backspace over it (or use Ctrl-U) and hit Enter: 1> txr: unwind.c:296: uw_pop_frame: Assertion `fr == uw_stack' failed. Aborted (core dumped) * parser.c (provide_completions): When find_package fails, return by executing goto out, rather than return, so that the catch frame is removed. --- parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser.c b/parser.c index 9fd5b538..d36ea13d 100644 --- a/parser.c +++ b/parser.c @@ -1234,7 +1234,7 @@ static void provide_completions(const wchar_t *data, val package_name = string(pkg_copy); package = find_package(package_name); if (!package) - return; + goto out; } end = pkg; -- cgit v1.2.3