Discussion:
MANPAGER
Heinrich Rebehn
2021-05-29 19:37:40 UTC
Permalink
Hi all,

I noticed that OpenBSD 6.8 switched to using less(1) for the manager. While this seems to offer many new useful options, I really dislike the clrscreen upon exit.
I browsed through the less(1) manage to find an option to disable this behavior, but to no avail.
Can anyone tell me how to restore the old behavior without reverting to using more(1)?
I am really used to still seeing the output of the man command when issuing the command that i consulted man for.

Many thanks in advance,

Heinrich
Omar Polo
2021-05-29 20:48:22 UTC
Permalink
Post by Heinrich Rebehn
Hi all,
I noticed that OpenBSD 6.8 switched to using less(1) for the manager. While this seems to offer many new useful options, I really dislike the clrscreen upon exit.
I browsed through the less(1) manage to find an option to disable this behavior, but to no avail.
Can anyone tell me how to restore the old behavior without reverting to using more(1)?
I am really used to still seeing the output of the man command when issuing the command that i consulted man for.
Many thanks in advance,
Heinrich
never used more, but the manpage of less mentions a LESS_IS_MORE env
variable to make less a bit more like, hum, more.

LESS_IS_MORE=1 less ...

doesn't clrscreen at exit.

HTH
Allan Streib
2021-05-29 21:18:27 UTC
Permalink
Post by Heinrich Rebehn
I noticed that OpenBSD 6.8 switched to using less(1) for the
manager. While this seems to offer many new useful options, I really
dislike the clrscreen upon exit.
Have a look at -X argument to less(1):

-X | --no-init
Disables sending the termcap initialization and
deinitialization strings to the terminal. This is
sometimes desirable if the deinitialization string
does something unnecessary, like clearing the
screen.

Allan
Christian Groessler
2021-05-30 12:58:54 UTC
Permalink
Post by Allan Streib
Post by Heinrich Rebehn
I noticed that OpenBSD 6.8 switched to using less(1) for the
manager. While this seems to offer many new useful options, I really
dislike the clrscreen upon exit.
-X | --no-init
Disables sending the termcap initialization and
deinitialization strings to the terminal. This is
sometimes desirable if the deinitialization string
does something unnecessary, like clearing the
screen.
Yeah. PAGER="less -X" is what I am using...

regards,
chris
Heinrich Rebehn
2021-05-30 08:02:41 UTC
Permalink
Date: Sat, 29 May 2021 21:37:40 +0200
Hi all,
I noticed that OpenBSD 6.8 switched to using less(1) for the manager. While this seems to offer many new useful options, I really dislike the clrscreen upon exit.
I browsed through the less(1) manage to find an option to disable this behavior, but to no avail.
Can anyone tell me how to restore the old behavior without reverting to using more(1)?
I am really used to still seeing the output of the man command when issuing the command that i consulted man for.
Many thanks in advance,
Heinrich
Use the -X option. Add `export MANPAGER="less -X"` to ~/.profile to
enable it for man(1), or `export LESS="-X"` to enable it for everything.
Thanks to all who replied!
I did see LESS_IS_MORE, but there were probably good reasons for the OpenBSD devs to switch to less(1).

'MANPAGER="less -X”` does the trick, I was not aware that "termcap initialization and deinitialization” is responsible for clrscreen. I hope that disabling it completely will not have any adverse side affects.

-Heinrich
Ingo Schwarze
2021-06-04 12:54:30 UTC
Permalink
Hi Heinrich,
Post by Heinrich Rebehn
I did see LESS_IS_MORE, but there were probably good reasons for
the OpenBSD devs to switch to less(1).
Prosaic as it may seem, and featurism indeed feeling not too typical
for OpenBSD, my reason for switching basically was that less(1) has
more features and more(1) feels slightly antiquated. Besides, our
implementation of more(1) is less(1) anyway under the hood, so there
is little reason to artificially restrict its functionality. Also,
having :t tagging enabled by default and yet calling it "more" felt a
bit weird. Finally, POSIX allows using an implementation-specific
pager by default as long as that is documented:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html
see the "PAGER" entry below "ENVIRONMENT VARIABLES":

If the PAGER variable is null or not set, the command shall be
either "more" or another paginator utility documented in the system
documentation.
Post by Heinrich Rebehn
'MANPAGER="less -X" does the trick, I was not aware that "termcap
initialization and deinitialization" is responsible for clrscreen.
I hope that disabling it completely will not have any adverse side
affects.
Reading less/opttbl.c, -X sets the global no_init variable,
and judging from "grep -RF no_init /usr/src/usr.bin/less/",
that's only used at two places in less/screen.c, using tputs(3)
to send the enter_ca_mode and exit_ca_mode strings defined in <term.h>.
According to terminfo(5), these two capabilities are terminal-dependent.
So -X has different effects depending on which terminal or teminal
emulator you are using and with which setting of the TERM variable.
The worst that might happen on some terminals is that less(1) might
display gibberish and/or leave the terminal in an unusable state when
exiting. But i assume you will notice if -X has undesirable effects
on the terminal you are using.

Theoretically, fiddling with such low-level options might have security
implications, putting the terminal into a state where it interprets
what you are typing afterwards in a way you never intended. Then
again, while printing random binary data to a terminal can definitely
have security implications depending on how the terminal is configured -
the default configuration of xterm(1) being quite sane on OpenBSD -
i never heard about real-world security issues caused by partially
skipping terminal initialization or de-initialization, so they seem
somewhat unlikely. This isn't a definite statement that none exist
on any terminal, though.

In any case, whether less(1) clears the screen when exiting is terminal-
dependent. I just tried at the PC console (Strg-Alt-F2) on the same
amd64-current machine where less(1) in xterm(1) does clear the screen:
at the console, at least with TERM=vt220, it does not.

Yours,
Ingo

Loading...