]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
more: avoid infinite loop on --squeeze
authorKarel Zak <kzak@redhat.com>
Mon, 2 May 2022 10:57:13 +0000 (12:57 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 2 May 2022 10:57:13 +0000 (12:57 +0200)
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 <kzak@redhat.com>
text-utils/more.c

index a0d62bd5bf33c661f1f89f7c06fc2c0dc69c80eb..e3e2a4336465307b77b33e9a6e3dce126629a515 100644 (file)
@@ -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