Project

General

Profile

Bug #10585

Non-standard definition of $PAGER in /etc/profile

Added by Hubert Garavel 7 months ago. Updated 1 day ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2019-03-25
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:

Description

File /etc/profile contains the following definition:

  PAGER="/usr/bin/less -ins" 

Such replacement of "more" by "less -ins" is not standard. It modifies the behaviour
of the command, since the user must type a key to exit the pager.

Such a redefinition cannot be found on other systems, such as Solaris or Debian Linux.

I suggest to remove this system-wide definition of $PAGER, and let the users set
$PAGER according to their own preferences.


Related issues

Related to illumos gate - Bug #6723: etc/skel needs cleanupClosed2016-03-05

Actions
Related to illumos gate - Bug #11822: Wrong description of default pager when PAGER variable is not setNew

Actions

History

#1

Updated by Michal Nowak 5 months ago

  • Status changed from New to Feedback
  • Tags deleted (needs-triage)

I believe PAGER is set like this to satisfy man(1) needs. Unless PAGER is set more -s is used (which is horrible in my mind).

None of those options makes less to be quited by q, I believe that's how less works everywhere:

-i or --ignore-case
       Causes searches to ignore case
-n or --line-numbers
       Suppresses line numbers.
-s or --squeeze-blank-lines
       Causes consecutive blank lines to be squeezed into a single
       blank line.  This is useful when viewing nroff output.

I believe user is still able to set PAGER however they wishes in their shell profile.

I am inclined to keep things as-is.

#2

Updated by Michal Nowak about 1 month ago

  • Status changed from Feedback to Rejected
#3

Updated by Hubert Garavel about 1 month ago

Sorry, we are not convinced by the arguments that led to bug rejection.

First, $PAGER is not only related to the needs of "man"; other software is using $PAGER too.

Second, the differences between "more -s" and "less -ins" are very much an affair of personal taste.

Third, the options -i, -n, -s are not a concern; the primary concern is the fact that "less" is used as
a system-wide default.

As mentioned in the bug report, setting $PAGER to "less -ins" in /etc/profile is not standard:
  • On Linux, $PAGER is not set.
  • On Solaris 10, $PAGER is not set.
  • On Solaris 11.4, $PAGER is not set. Precisely, $PAGER is not set in /etc/profile, but it is
    set as follows in the file $HOME/.profile that is generated when a new account is created:
if [ -f /usr/bin/less ]; then
    export PAGER="/usr/bin/less -ins" 
elif [ -f /usr/bin/more ]; then
    export PAGER="/usr/bin/more -s" 
fi

This is a significant difference. Any user can restore the default setting
just by erasing the skeleton ".profile" created in his/her home directory.

To summarize, Illumos took a questionable decision of forcing $PAGER to "less"
for everyone, although this is a matter of individual preferences and although
this create portability problems for tool developers (like us) who rely on a
consistent setting of $PAGER across systems. No other operating system
does this.

Hubert and Wendelin

#4

Updated by Michal Nowak about 1 month ago

  • Status changed from Rejected to Feedback

I grant you that the only Linux system I found with PAGER set is openSUSE Leap 15.1. As man is not the problem, you still need to demonstrate what the problem is.

Anyway, as etc/profile belongs to illumos and at OpenIndiana we have a policy of shipping vanilla illumos, I am reopening this bug, but I am moving it to illumos.

I suggest you present this on illumos developer or discuss mailing lists.

#5

Updated by Michal Nowak about 1 month ago

  • Project changed from OpenIndiana Distribution to illumos gate
#6

Updated by Michal Nowak about 1 month ago

  • Related to Bug #6723: etc/skel needs cleanup added
#7

Updated by Hubert Garavel 30 days ago

There is a significant difference between "more" (or "more -s") and "less" (or "less -ins"):

if F is a small file, then the command "more F" will display the file and terminate automatically,
while "less F" will display the file and halt until the user has pressed the letter "q".

This difference causes problems in tools that use $PAGER to display small files as, on
Opendiana, the call to $PAGER stops until there is an explicit intervention from the user
(so, the execution is blocked), while on most other systems, the call to $PAGER terminates
automatically (so that the execution continues normally).

#8

Updated by Yuri Pankov 30 days ago

There is no "standard" PAGER value -- OI (illumos) chosen to have it set to less -ins, and you can override it to whatever you need.

What is the exact problem you are trying to solve here?

#9

Updated by Hubert Garavel 30 days ago

The fact that OI (illumos) chose to have it set to "less -ins" is precisely the problem.

No comparable operating system does this (but openSUSE Leap 15.1, as pointed out by Michal).
Other systems let $PAGER undefined, which is equivalent to "more -s" (see "man man", section
ENVIRONMENT VARIABLES).

Tools that execute seamlessly on other systems are blocked on OpenIndiana, waiting for user intervention.
So, OpenIndiana behaves differently from most other systems, including Solaris 10 and 11, which I consider
to be "non standard" or, at least, annoying.

The fact that each user individually can modify settings to reset $PAGER is not compelling.

The Solaris 11.4 solution (see above) is much better in this way: not setting $PAGER systemwide,
but configuring $HOME/.profile when an account is created. Also, Linux distinguishes between
$PAGER (general) and $MANPAGER (specific to "man").

#10

Updated by Yuri Pankov 30 days ago

Tools that execute seamlessly on other systems are blocked on OpenIndiana, waiting for user intervention.

but configuring $HOME/.profile when an account is created

So if I configure the PAGER to be less -ins in my ~/.profile, those tools would still be "blocked"? Possibly the tools are broken that way, and if those tools want to use more, it should be done by directly calling more (which is defined in POSIX as mandatory and expected to be present in the system)?

#11

Updated by Hubert Garavel 9 days ago

Sorry, blaming application tools (and their developers) is a poor argument that leads to nowhere.

The fact is that OpenIndiana currently works differently from all other systems, so it cannot
be right it its own, because it does not have the critical mass.

I therefore urge OpenIndiana to align its behaviour on other mainstream operating systems.
The best solution was given by Solaris 11: do not define $PAGER in /etc/profile, but only in
$HOME/.profile when a new account is created (so that end users can override this choice)

To answer your question: (1) the tools are not broken, since they work well on many other
systems; (2) the tools do not call "more" directly because they respect the user preferences
(i.e., if the user has set $PAGER, it will be used, otherwise "more -s" is used - this is exactly
how the "man" command works too).

#12

Updated by Michal Nowak 9 days ago

PAGER="/usr/bin/less -ins" came to illumos with https://github.com/illumos/illumos-gate/commit/ead1f93ee620d7580f7e53350fe5a884fc4f158a#diff-253c0ff3f4f462c95fc18b17fe66df0b and subsequently moved elsewhere with https://github.com/illumos/illumos-gate/commit/719d176126cc1c689a469d4c3553d770d1c4e94e.

The original reason for setting PAGER to less seems to be: "use less(1) as the default pager for the man(1) command". However, with mandoc (last 4 years) we set PAGER to less neverthless: https://github.com/illumos/illumos-gate/blob/master/usr/src/cmd/man/man.h#L27:

#define    PAGER    "less -ins" 

usr/src/cmd/man/man.c:

 371         if (pager == NULL) {
 372                 if ((pager = getenv("PAGER")) == NULL || *pager == '\0')
 373                         pager = PAGER;
 374         }
 375         DPRINTF("-- Using pager: %s\n", pager);

 newman  ~  echo $PAGER

 newman  ~  man -d man
-- Adding /usr/share/man: sections=1,1m,1s,1t,1c
-- Adding /usr/share/man: sections=1m
-- Adding /usr/share/man: sections=1m
-- Adding /usr/gnu/share/man: default search order
-- Adding /usr/share/man: default search order
-- Using pager: less -ins
-- Searching mandir: /usr/share/man
-- Using manpage: /usr/share/man/man1/man.1
-- Command: cd /usr/share/man; cat /usr/share/man/man1/man.1 | mandoc | less -ins

See https://illumos.org/rb/r/2374/diff/ for the change.

#13

Updated by Andrew Stormont 9 days ago

While I'm not opposed to PAGER being removed from /etc/profile I do think that the application that is having issues due to it blocking is busted.

#14

Updated by Hubert Garavel 2 days ago

Thanks, Michal, for this careful study. This suggests how to resolve the issue without breaking things.

Indeed, I confirm that the "man" binary uses "less -ins". This can be seen by typing:

$ strings /bin/man | grep more
$ strings /bin/man | grep less
less -ins

This can be seen also by unsetting $PAGER, typing "man ls" and observing the processes using "ps".
One sees:

cat /usr/man/man1/ls.1 | mandoc | less -ins

Notice that this replacement of "more" by "less" contradicts the "man" page itself, which states that:
if $PAGER is not set, "more -s" is used. See more(1).

Therefore, my proposal would be the following:

  • Remove the definition of $PAGER from /etc/profile (this change will not affect all the users of "man").
  • Update the "man" manual page to mention that "less -ins" is used when $PAGER is not set.
#15

Updated by Hubert Garavel 2 days ago

Concerning the remark of Andrew Stormont:

"I do think that the application that is having issues due to it blocking is busted."

I am a bit reluctant to answer, since criticizing applications does not improve the
OS itself (Linus T. wrote a decisive statement that OS changes changes should
never break userland applications). Yet, I will answer, hoping that this discussion
about applications will not divert the attention from the main issue in /etc/profile.

The (not so busted) applications are compilers that parse high-level languages.
When a program is incorrect, the compiler displays error or warning messages.
These messages can be short or long. If they are long, a common problem is
that the user has to scroll back upwards to look at the first error. To avoid this,
the messages are displayed using $PAGER (or "more" if $PAGER is not set).
In this respect, "more" is a better choice than "less", because if the message
is short, the user can directly type the next command, whereas, when "less"
is used, the user is blocked until a "q" is typed (typing "q" is of no use when
the error message is only 3-line long). When the compiler is run in batch
scripts, $PAGER is set to "cat" not to be interactive. In this context, Illumos
setting $PAGER to "less -ins" by default is annoying, as human users
have to unset $PAGER to use the aforementioned compilers conveniently,
and such a burden only occurs with Illumos.

#16

Updated by Michal Nowak 1 day ago

Hubert Garavel wrote:

Notice that this replacement of "more" by "less" contradicts the "man" page itself, which states that:
if $PAGER is not set, "more -s" is used. See more(1).

[...]

  • Update the "man" manual page to mention that "less -ins" is used when $PAGER is not set.

See https://www.illumos.org/issues/11822.

#17

Updated by Michal Nowak 1 day ago

  • Related to Bug #11822: Wrong description of default pager when PAGER variable is not set added

Also available in: Atom PDF