• Bug in 'more' command

    From Jim Anderson@21:1/5 to All on Mon Oct 14 21:20:01 2024
    This is a multi-part message in MIME format.
    I'm not sure why the Debian developers chose to change the behavior of
    the 'more' command, but the Debian release 12 has the annoying habit,
    upon reaching end of the file, of displaying extra empty lines to fill a terminal window, then inserting the text:

      (END)

    at the end of file. This requires entering an unnecessary and annoying
    carriage return to restore the window to the terminal screen prompt.

    One time usage is not bad, but if you use 'more' often, as I do, this
    behavior is a repeating waste of time. I hope the developers will revert
    to the traditional behavior.


    Jim Anderson

    <html>
    <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <p><br>
    </p>
    <p>I'm not sure why the Debian developers chose to change the
    behavior of the 'more' command, but the Debian release 12 has the
    annoying habit, upon reaching end of the file, of displaying extra
    empty lines to fill a terminal window, then inserting the text:</p>
    <p>  (END)</p>
    <p>at the end of file. This requires entering an unnecessary and
    annoying <span style="font-family:monospace"></span>carriage
    return to restore the window to the terminal screen prompt.</p>
    <p>One time usage is not bad, but if you use 'more' often, as I do,
    this behavior is a repeating waste of time. I hope the developers
    will revert to the traditional behavior.</p>
    <p><br>
    </p>
    <p>Jim Anderson <br>
    </p>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to David Wright on Mon Oct 14 22:30:02 2024
    On Mon, Oct 14, 2024 at 15:09:48 -0500, David Wright wrote:
    On Mon 14 Oct 2024 at 14:38:36 (-0400), Jim Anderson wrote:
    I'm not sure why the Debian developers chose to change the behavior of
    the 'more' command, but the Debian release 12 has the annoying habit,
    upon reaching end of the file, of displaying extra empty lines to fill
    a terminal window, then inserting the text:

    (END)

    at the end of file. This requires entering an unnecessary and annoying carriage return to restore the window to the terminal screen prompt.

    I think you now need -e in a terminal:

    -e, --exit-on-eof
    Exit on End-Of-File, enabled by default if not executed on terminal.

    Perhaps alias it?

    One could also set the desired option(s) in one's environment, e.g.

    export MORE=-e

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Wright@21:1/5 to Jim Anderson on Mon Oct 14 22:20:01 2024
    On Mon 14 Oct 2024 at 14:38:36 (-0400), Jim Anderson wrote:

    I'm not sure why the Debian developers chose to change the behavior of
    the 'more' command, but the Debian release 12 has the annoying habit,
    upon reaching end of the file, of displaying extra empty lines to fill
    a terminal window, then inserting the text:

      (END)

    at the end of file. This requires entering an unnecessary and annoying carriage return to restore the window to the terminal screen prompt.

    One time usage is not bad, but if you use 'more' often, as I do, this behavior is a repeating waste of time. I hope the developers will
    revert to the traditional behavior.

    I think you now need -e in a terminal:

    -e, --exit-on-eof
    Exit on End-Of-File, enabled by default if not executed on terminal.

    Perhaps alias it?

    Cheers,
    David.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Todd Zullinger@21:1/5 to Jim Anderson on Tue Oct 15 06:10:01 2024
    Jim Anderson wrote:
    I'm not sure why the Debian developers chose to change the
    behavior of the 'more' command, but the Debian release 12
    has the annoying habit, upon reaching end of the file, of
    displaying extra empty lines to fill a terminal window,
    then inserting the text:

    (END)

    at the end of file. This requires entering an unnecessary
    and annoying carriage return to restore the window to the
    terminal screen prompt.

    David and Greg covered the practical side of this already.

    For additional (and _possibly_ interesting) context, this
    isn't a Debian-specific change. It's part of the upstream
    util-linux-2.38 release. It was submitted to the
    util-linux mailing list in 2021 and referenced the POSIX
    specification as the rationale.

    https://github.com/util-linux/util-linux/blob/master/Documentation/releases/v2.38-ReleaseNotes#L784
    https://github.com/util-linux/util-linux/commit/df6b29d3b
    (more: POSIX compliance patch preventing exit on EOF
    without -e, 2021-09-29)
    https://lore.kernel.org/util-linux/20210624125918.GB2541@contractcoder.biz/
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html

    --
    Todd

    -----BEGIN PGP SIGNATURE-----

    iHUEARYIAB0WIQSvlwC4tRNlCF6x+moHOcdGE+n45gUCZw3qSgAKCRAHOcdGE+n4 5oAJAQDxgXL8niNGORRzB093B38t56HnUMRehUfa8ZLwOiA+rQD+J/wkkq37Gp/q pHolYi5GVyKS3+3iWu/fIyDxMzLzEQ0=
    =aDq6
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Jim Anderson on Tue Oct 15 15:10:01 2024
    Jim Anderson <jjanders@ptd.net> writes:

    One time usage is not bad, but if you use 'more' often, as I do, this behavior is a repeating waste of time. I hope the developers will
    revert to the traditional behavior.

    I doubt that but who knows.

    For decades, I've had an alias like this:

    alias l="ls -lF|more"

    Convenient, no pager unless the directory listing is long. And now it's
    become this code:

    more_version=$(more --version|awk '{print $4}'|cut -d. -f1-2)
    if [[ $more_version -ge 2.38 ]]
    then
    alias l='ls -lF|more --exit-on-eof'
    else
    alias l='ls -lF|more'
    fi

    While it's probably fragile it works well enough in my usual Linux
    environments which are Debian 11 & 12, Ubuntu 20.04, RedHat 8.

    I mostly use less as a pager but increasingly bat for its color syntax highlighting support for loads of formats.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Anssi Saari on Tue Oct 15 15:20:01 2024
    On Tue, Oct 15, 2024 at 16:01:41 +0300, Anssi Saari wrote:
    For decades, I've had an alias like this:

    alias l="ls -lF|more"

    Convenient, no pager unless the directory listing is long. And now it's become this code:

    more_version=$(more --version|awk '{print $4}'|cut -d. -f1-2)
    if [[ $more_version -ge 2.38 ]]
    then
    alias l='ls -lF|more --exit-on-eof'
    else
    alias l='ls -lF|more'
    fi

    Why did you make it so complicated? What's wrong with simply:

    alias l='ls -lF|more -e'

    or perhaps:

    export MORE=-e
    alias l='ls -lF|more'

    And by the way, this line:

    if [[ $more_version -ge 2.38 ]]

    is not correct. Bash can't do a floating point numeric comparison. This syntax simply gives an error message:

    hobbit:~$ [[ 2.1 -ge 2.2 ]]
    bash: [[: 2.1: syntax error: invalid arithmetic operator (error token is ".1")

    Are you using some other shell, maybe? Like zsh?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Todd Zullinger@21:1/5 to Jeffrey Walton on Tue Oct 15 19:50:01 2024
    Jeffrey Walton wrote:
    On Tue, Oct 15, 2024 at 3:40 AM Todd Zullinger <tmz@pobox.com> wrote:
    For additional (and _possibly_ interesting) context, this
    isn't a Debian-specific change. It's part of the upstream
    util-linux-2.38 release¹. It was submitted to the
    util-linux mailing list in 2021² and referenced the POSIX
    specification as the rationale³.

    ¹ https://github.com/util-linux/util-linux/blob/master/Documentation/releases/v2.38-ReleaseNotes#L784
    https://github.com/util-linux/util-linux/commit/df6b29d3b
    (more: POSIX compliance patch preventing exit on EOF
    without -e, 2021-09-29)
    ² https://lore.kernel.org/util-linux/20210624125918.GB2541@contractcoder.biz/
    ³ https://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html

    Unexpected behavioral changes are always a pain. It is too bad it was
    not hidden behind a variable like POSIXLY_CORRECT, like Bash does. See <https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html>.

    That's just what was done in 2.39, as Max noted. I didn't
    follow the git log deeply enough last night, so I only told
    part of the story.

    This may be something the Debian maintainer(s) would be
    willing to backport?

    --
    Todd

    -----BEGIN PGP SIGNATURE-----

    iHUEARYIAB0WIQSvlwC4tRNlCF6x+moHOcdGE+n45gUCZw6p5QAKCRAHOcdGE+n4 5t20AP9Lny+N5ciy/v0wZhWwHNfAUIPH4pf/CbLjCfEdXH85WwD+IKoA6F0PG5b4 qrqgfddiAK15BGlQZ2T+a4JUaN5sew8=
    =g3rl
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Greg Wooledge on Wed Oct 16 14:40:02 2024
    Greg Wooledge <greg@wooledge.org> writes:

    Why did you make it so complicated? What's wrong with simply:

    alias l='ls -lF|more -e'

    or perhaps:

    export MORE=-e
    alias l='ls -lF|more'

    $ ls|more -e
    more: unknown option -e
    Try 'more --help' for more information.

    I included the reason in my post by listing the Linux environments I use
    and where I expect this to work. Interestingly the man page for more in
    Debian 11 doesn't list -e but it seems to work anyway. But not on the
    others I mentioned.

    Are you using some other shell, maybe? Like zsh?

    Of course. Should've noted that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Greg Wooledge on Wed Oct 16 15:50:02 2024
    On Wed, Oct 16, 2024 at 09:41:41AM -0400, Greg Wooledge wrote:
    On Wed, Oct 16, 2024 at 15:34:51 +0300, Anssi Saari wrote:
    $ ls|more -e
    more: unknown option -e
    Try 'more --help' for more information.

    I included the reason in my post by listing the Linux environments I use and where I expect this to work. Interestingly the man page for more in Debian 11 doesn't list -e but it seems to work anyway. But not on the others I mentioned.

    I don't have access to a plethora of Linux distributions, so I wasn't
    aware of how the -e option was treated by all of them.

    Does the "export MORE=-e" variant work on the ones where -e is not
    accepted as a command-line option? I would (perhaps naively) expect
    that any unknown options in the MORE environment variable would be
    silently ignored. But if that does throw an error, then... um... sorry,
    I tried?

    Hm Debian stable (bookworm) here. More accepts -e, more --help mentions
    it, man page too.

    More itself says:

    tomas@caliban:~$ more --version
    more from util-linux 2.38.1

    Exporting MORE set to some unknown option (I did MORE=-q) leads to
    more complaining and refusing service (so it seems to behave as if
    one passed that option directly in the command line).

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZw/EEQAKCRAFyCz1etHa Rp2YAJ981Ihq1VUhP80y6/PhAnF2KjYnPgCfXgk/YPPj+xon997VNQ36lGvUdhE=
    =Z4V7
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Anssi Saari on Wed Oct 16 15:50:02 2024
    On Wed, Oct 16, 2024 at 15:34:51 +0300, Anssi Saari wrote:
    $ ls|more -e
    more: unknown option -e
    Try 'more --help' for more information.

    I included the reason in my post by listing the Linux environments I use
    and where I expect this to work. Interestingly the man page for more in Debian 11 doesn't list -e but it seems to work anyway. But not on the
    others I mentioned.

    I don't have access to a plethora of Linux distributions, so I wasn't
    aware of how the -e option was treated by all of them.

    Does the "export MORE=-e" variant work on the ones where -e is not
    accepted as a command-line option? I would (perhaps naively) expect
    that any unknown options in the MORE environment variable would be
    silently ignored. But if that does throw an error, then... um... sorry,
    I tried?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to tomas@tuxteam.de on Wed Oct 16 16:00:01 2024
    On Wed, Oct 16, 2024 at 15:48:07 +0200, tomas@tuxteam.de wrote:
    Exporting MORE set to some unknown option (I did MORE=-q) leads to
    more complaining and refusing service (so it seems to behave as if
    one passed that option directly in the command line).

    D'oh!

    What a disaster. OK, now I have a better understanding of why people
    are complaining so vocally about this change.

    I still think that *conditionally* exporting MORE=-e (after performing
    whatever version-number-checking backflips are needed) is going to be
    a better solution than changing individual aliases one by one.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nicolas George@21:1/5 to All on Wed Oct 16 16:20:01 2024
    Greg Wooledge (12024-10-16):
    I still think that *conditionally* exporting MORE=-e (after performing whatever version-number-checking backflips are needed)

    Do not check the version number, check if the option is supported:

    if more -e /dev/null; then
    MORE=-e
    export MORE
    fi

    Regards,

    --
    Nicolas George

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Greg Wooledge on Wed Oct 16 16:20:02 2024
    On Wed, Oct 16, 2024 at 09:54:32AM -0400, Greg Wooledge wrote:
    On Wed, Oct 16, 2024 at 15:48:07 +0200, tomas@tuxteam.de wrote:
    Exporting MORE set to some unknown option (I did MORE=-q) leads to
    more complaining and refusing service (so it seems to behave as if
    one passed that option directly in the command line).

    D'oh!

    What a disaster. OK, now I have a better understanding of why people
    are complaining so vocally about this change.

    :-)

    On a second reading I realize that my "more complaining" above can be
    read in two ways. Somehow... cute.

    I still think that *conditionally* exporting MORE=-e (after performing whatever version-number-checking backflips are needed) is going to be
    a better solution than changing individual aliases one by one.

    Absolutely. Here's a rough sketch of what I'd go with:

    tomas@caliban:~$ more -e /dev/null > /dev/null 2>&1 && echo success
    => success

    tomas@caliban:~$ more -q /dev/null > /dev/null 2>&1 && echo success
    =>

    So if more gets some funky option, it returns with a "bad" exit code.

    This might be a basis to set the MORE env var in some session-founding
    script.

    Besides, that dual (trial?) use of /dev/null is kinda... magic ;-)

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZw/JcwAKCRAFyCz1etHa RhEfAJ9Di72mVfVMmOBpt1OQ1TUlObWgXACeJdXB2zdfXeHss/hNOGcFuzN1jk8=
    =vLLk
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to Greg Wooledge on Wed Oct 16 16:30:01 2024
    Greg Wooledge <greg@wooledge.org> wrote:
    On Wed, Oct 16, 2024 at 15:48:07 +0200, tomas@tuxteam.de wrote:
    Exporting MORE set to some unknown option (I did MORE=-q) leads to
    more complaining and refusing service (so it seems to behave as if
    one passed that option directly in the command line).

    D'oh!

    What a disaster. OK, now I have a better understanding of why people
    are complaining so vocally about this change.

    I still think that *conditionally* exporting MORE=-e (after performing whatever version-number-checking backflips are needed) is going to be
    a better solution than changing individual aliases one by one.

    Hasn't the whole linus/unix world moved to using less instead or more?

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Chris Green on Wed Oct 16 16:40:01 2024
    On Wed, Oct 16, 2024 at 15:14:20 +0100, Chris Green wrote:
    Greg Wooledge <greg@wooledge.org> wrote:
    On Wed, Oct 16, 2024 at 15:48:07 +0200, tomas@tuxteam.de wrote:
    Exporting MORE set to some unknown option (I did MORE=-q) leads to
    more complaining and refusing service (so it seems to behave as if
    one passed that option directly in the command line).

    D'oh!

    What a disaster. OK, now I have a better understanding of why people
    are complaining so vocally about this change.

    I still think that *conditionally* exporting MORE=-e (after performing whatever version-number-checking backflips are needed) is going to be
    a better solution than changing individual aliases one by one.

    Hasn't the whole linus/unix world moved to using less instead or more?

    This isn't about what "the whole world" uses. There are people who
    want to use more(1), because it better fits their needs, or for any
    other reason. Just as I use fvwm instead of a Desktop Environment,
    regardless of what other people may prefer, the OP of this thread is
    free to use more instead of less as their pager.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to Dan Ritter on Wed Oct 16 16:50:01 2024
    On Wed, Oct 16, 2024 at 10:26:33AM -0400, Dan Ritter wrote:
    Chris Green wrote:

    Hasn't the whole linus/unix world moved to using less instead or more?

    If it continues to build and work, there's no reason to discard
    it.

    Some people have habits ingrained over 40 years, more or less.

    Yes, but on many systems (most?), when you type 'more' you actually get
    'less'. You'd have to go out of your way to get the real more. :-)

    --
    Chris Green

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Lehmann@21:1/5 to All on Wed Oct 16 17:30:01 2024
    Hi all,

    Am 16.10.2024 um 16:45 schrieb Chris Green:
    On Wed, Oct 16, 2024 at 10:26:33AM -0400, Dan Ritter wrote:
    Chris Green wrote:

    Hasn't the whole linus/unix world moved to using less instead or more?

    If it continues to build and work, there's no reason to discard
    it.

    Some people have habits ingrained over 40 years, more or less.

    Yes, but on many systems (most?), when you type 'more' you actually get 'less'. You'd have to go out of your way to get the real more. :-)

    Actually...

    $ man more | head -n 11
    MORE(1) User Commands MORE(1)

    NAME
    more - file perusal filter for crt viewing

    SYNOPSIS
    more [options] file...

    DESCRIPTION
    more is a filter for paging through text one screenful at a time. This version is especially prim‐
    itive. Users should realize that less(1) provides more(1) emulation plus extensive enhancements.
    (on a Debian 11 system which started out as Debian 10, no particular
    settings or choices.)

    So, at least on what I consider a typical Debian system, I still find
    more. less is also available, but those decades of habits...

    Anyway, regarding all other considerations -- more is part of the POSIX
    specs, less is not, and that is a good reason to have it available and
    use it. Eventually, you may end up sitting at a csh session in a dumb
    terminal and having to work with whatever some stale Solaris
    installation offers...

    Cheers,

    Arno

    --
    Arno Lehmann

    IT-Service Lehmann
    Sandstr. 6, 49080 Osnabrück

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charles Curley@21:1/5 to Jeffrey Walton on Thu Oct 17 06:10:01 2024
    On Wed, 16 Oct 2024 16:49:20 -0400
    Jeffrey Walton <noloader@gmail.com> wrote:

    Some people have habits ingrained over 40 years, more or less.

    This could be the next big emacs vs vi religious debate.

    More or less.

    --
    Does anybody read signatures any more?

    https://charlescurley.com
    https://charlescurley.com/blog/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Chris Green on Thu Oct 17 06:30:01 2024
    On Wed, Oct 16, 2024 at 03:45:44PM +0100, Chris Green wrote:
    On Wed, Oct 16, 2024 at 10:26:33AM -0400, Dan Ritter wrote:
    Chris Green wrote:

    Hasn't the whole linus/unix world moved to using less instead or more?

    If it continues to build and work, there's no reason to discard
    it.

    Some people have habits ingrained over 40 years, more or less.

    Yes, but on many systems (most?), when you type 'more' you actually get 'less'. You'd have to go out of your way to get the real more. :-)

    One of the things which attracted me to free software in the first
    place is that other people didn't try to force me to use whatever
    they think is right (or what they profit from, that line is blurry).

    I mean: do use less as much as you want. Let others use more.

    (I do use less, FWIW).

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZxCQzgAKCRAFyCz1etHa RhLGAJ96AnLnLinLTduO/oQn0P/x3TGYigCaA0nSTq3F/o/Rmgn/PytU0VH8cd0=
    =zWqc
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Monnier@21:1/5 to All on Thu Oct 17 15:20:02 2024
    (I do use less, FWIW).

    FWIW, I do use less more as well, but I also use more, tho less so.


    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)