#940293 less: with a pipe, [End] + Ctrl-C sends back to the beginning of the file

Package:
less
Source:
less
Description:
pager program similar to more
Submitter:
Vincent Lefevre
Date:
2024-05-01 02:03:04 UTC
Severity:
normal
Tags:
#940293#5
Date:
2019-09-15 10:47:28 UTC
From:
To:
Run the following command:

  ( trap '' INT; while true; do echo foo; done; ) | less -M

Then type one or a few [PageDown], and type [End] to go to the end,
but since this is an infinite loop here[*], this will hang. Type
Ctrl-C to abort. One is back to the beginning of the file, at line 1
(less shows something like "lines 1-59") instead of remaining at
the same position (or going to some higher position). In case of
interrupted [End], less should never go backward.

I can also reproduce this bug with less 481 (Debian/stretch) and 487.

[*] In practice, this can just be a command with a lot of output, but
which hasn't finished yet.