From 5c8f5f171d5621a2bc540c21cc62f308a43d4fc5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 2 May 2022 12:57:13 +0200 Subject: [PATCH] more: avoid infinite loop on --squeeze The command 'echo | more -s' ends in infinite loop if exit-on-EOF is disabled (default now). We need to call more_key_command() to ask for user's reaction. Fixes: https://github.com/util-linux/util-linux/issues/1669 Signed-off-by: Karel Zak --- text-utils/more.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text-utils/more.c b/text-utils/more.c index a0d62bd5bf..e3e2a43364 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -1828,7 +1828,7 @@ static void screen(struct more_control *ctl, int num_lines) putp(ctl->clear_rest); return; } - if (ctl->squeeze_spaces && length == 0 && prev_len == 0) + if (ctl->squeeze_spaces && length == 0 && prev_len == 0 && !ctl->is_eof) continue; prev_len = length; if (ctl->bad_stdout -- 2.47.2