[PATCH] client: set rl_prompt after saving

Justin Bronder <[email protected]> Sat, 18 Oct 2025 17:24:11 -0400
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Readline 8.3 crashes when rl_save_prompt() is called without
rl_set_prompt() being called first [1].  This means that interactive
connmanctl immediately crashes upon invocation. As we're about to clear
the line anyways, we can just set the buffer to an empty string as well.

Alternatively, I believe that both rl_set_prompt() and rl_replace_line()
could be replaced by a call to rl_message("") but I don't want to
expand the scope of this patch.

1. https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html

Signed-off-by: Justin Bronder <[email protected]>
---
 client/input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client/input.c b/client/input.c
index 78319ff8..27c281d1 100644
--- a/client/input.c
+++ b/client/input.c
@@ -62,6 +62,7 @@ void __connmanctl_save_rl(void)
 		saved_point = rl_point;
 		saved_line = rl_copy_text(0, rl_end);
 		rl_save_prompt();
+		rl_set_prompt("");
 		rl_replace_line("", 0);
 		rl_redisplay();
 	}
-- 
2.51.0