summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-03-07 18:34:26 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-03-07 18:34:26 -0800
commitd92391abf99df1f6fccbb93b5879daf888e906ce (patch)
tree03ce72515e337c641bac15a628568e4d3f216194
parent26f1f25a07a2b85b5481f0f5f1612c64bc76d910 (diff)
downloadtxr-d92391abf99df1f6fccbb93b5879daf888e906ce.tar.gz
txr-d92391abf99df1f6fccbb93b5879daf888e906ce.tar.bz2
txr-d92391abf99df1f6fccbb93b5879daf888e906ce.zip
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.
-rw-r--r--parser.c2
1 files changed, 1 insertions, 1 deletions
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;