Page MenuHomeFreeBSD

Should man(1)'s default pager change to "less -s"?
ClosedPublic

Asked by asomers on Dec 12 2017, 6:02 PM.

Since forever, man(1) has used "more -s" as its default pager. But less is much better than more. It has search highlighting, extended regexes, and much more. However, much like the vim/vi debate, there are a few things less does differently than more, and some people may prefer the old behavior.

Should we change the default pager to "less -s"?

Event Timeline

asomers created this object with visibility "Public (No Login Required)".
asomers created this object in space S1 Global.

What are the changes? I've only ever used less on GNU systems where the more install is ancient and doesn't support scrolling up. I have no opinion if I'm not going to notice the difference, but without knowing what the 'few things less does differently' are I'd vote no to avoid surprises.

Good question, @theraven . I'm not aware of any comprehensive list of differences. The only way to know for sure is grep less_is_more contrib/less/*

"...less is much better than more. It has search highlighting, ...

Not an improvement

"...extended regexes...

Not an improvement

"...and much more."

I don't expect that is either. If I'm in the minority I'll shut up and set PAGER.

Here are a few differences I observe. Testing methodology: PAGER="[more|less] -s" man cam.

  • Less highlights searched text result by default (more does not)
  • Less supports ? for reverse search (more does not)
  • Less does not exit at the bottom of the page by default (more does)

(To be clear, I think all of these differences are improvements.)

Similarities:

  • Roff formatting is either similar or the same (ANSI color codes are passed through to the viewing term)
  • Rough testing shows they have about the same scrolling performance (no surprise, it's the same codebase)

Less can be configured to quit at EOF with -E or --QUIT-AT-EOF.

Less can be configured not to highlight search with -G or --HILITE-SEARCH.

I've had 'PAGER=less' since before 2009/09/24 22:42:36 (earliest revision of ~/.cshrc I have) -- quite possibly since before my first experience with FreeBSD per se (which would have been 1998), as I used BSDi and SunOS before that.

So I don't see that there's a huge barrier for folks using less if they want to; the biggest concern that comes to mind is adherence to POLA.

If there's to be a change in the default, please let folks know -- and please make sure folks know how to change things if they don't want the default.

I'm in the leave it as it camp - although one question I have is how will this effect interactions via serial console? I've had multiple devices I interact with via serial console where using "less" as my pager is not really an enjoyable experience. These are mostly devices running some form of linux tho...

Not a deal breaker IMHO - but as dhw mentions above I do really like our POLA. and not having to remember to set my PAGER at 3am when fighting a fire would be great (assuming less acts funny via serial console on FreeBSD).

From a quick test with BHyve's virtual serial port, less and more seem pretty much the same. The usual differences apply of course, but scrolling up and down and searching work the same with both pagers.

FWIW I too am big on sticking to POLA. But (personally) in this case I'd be up for the change
(enhancement) providing there was an item added in UPDATING, with the directions to reverse
it, and make that reversal stick.

Just my 2¢
Oh, and thanks, Alan, for the suggestion. I'm leaning towards "it's an improvement"!

--Chris

Yes, I'll put an entry in UPDATING and in the release notes, too.

I have voted for a move to less being the default, because I like the extra features it provides and it also likely what new users coming to FreeBSD would expect.

However, I agree with Pete’s comment: whatever we have as a default should play nicely over a serial console.

FWIW, I've had occasion to use man a few times on serial consoles (among other environments). IIRC, the main reason I switched the PAGER for myself was because (at the time), when more reached the end of the data, it would exit; that made searching backwards from the end rather challenging.

Any more, I rarely invoke "more".

I can't help feeling that this poll is really asking the wrong question. There are a bunch of things like this, for example:

  • Colour ls by default
  • default $EDITOR something a bit more newbie-friendly (or vim for people coming from Linux or born after 1980)
  • Default $PAGER something more familiar to people coming from Linux

The general solution is to make it easy in the installer to select from a few presets for all of these that will give the desired behaviour. At a previous DevSummit, there was talk of having a Linux-user-friendly port that would provide a bunch of these as a simple installable option. That seems a far better place to focus effort than a bikeshed discussion about whether we like less or more for one specific use.

I am against this proposal as stands, because having the pager used by man not be whatever the default for $PAGER is seems confusing. We should either change the default pager system-wide to less, or we should leave it as more. We shouldn't change it for individual things in an ad-hoc basis.

Good point, @theraven . Which other programs' default pagers should match man's? I count apropos, ftp, mail, makewhatis, mandoc, msgs, ntpq, ntp-keygen, ntpd, ntpdc, sntp, freebsd-update, and mergemaster . Am I leaving any out?

I don't have an exhaustive list, and even if we fix all of them in the base system, there will be others in ports. This is why we have things like $PAGER - to avoid needing to hard-code defaults. If the project believes that less is a better default pager than more then we should modify /etc/profile or something to set PAGER=less, not go and modify all of the tools by hand to use less (and if there are any tools that don't respect $PAGER, $EDITOR and so on then they are buggy and should be fixed).

The general solution is to make it easy in the installer to select from a few presets for all of these that will give the desired behaviour. At a previous DevSummit, there was talk of having a Linux-user-friendly port that would provide a bunch of these as a simple installable option. That seems a far better place to focus effort than a bikeshed discussion about whether we like less or more for one specific use.

If I may be so bold; what does any of the "more like..." have anything to do with running/using FreeBSD? FreeBSD should stand on it's own merit. People use FreeBSD, because it is more like FreeBSD. Why does/would anyone want to change FreeBSD to be like anything else?
If a person wants Linuxy/Windosy/... like things, the ports(7) tree is filled with that type of thing.
As it is said; you can fool/please some of the people some of the time. But you can't fool/please all of the people all of the time. :-)

As to your comment regarding $PAGER. I think that's a really good point. It does seem to be a better choice to honor whatever choice is made within ones shellrc. It's not like the choice can't be changed within whatever context/environment, as needed.

No, leave it as it is. I don't want colorization and I certainly don't want the screen to clear when I'm done. That's so annoying. I want more's remnants left on the screen after exiting so I can refer back to it.

@deischen less doesn't colorize by default, and it doesn't clear the screen when you're done. I believe that Linux's screen-clearing behavior is due to the terminal, not the pager.

No, leave it as it is. I don't want colorization and I certainly don't want the screen to clear when I'm done. That's so annoying. I want more's remnants left on the screen after exiting so I can refer back to it.

The poll passed by 82%, so I'm going to commit it. I've updated the diff at https://reviews.freebsd.org/D13465 and I'll commit in a few days if nobody finds any problems. As well as man, this version of the diff updates other utilities, too.

And FYI, this change does not:

  1. Clear the screen when you exit man
  2. Enable colors
  3. Screw up serial connections
asomers changed the status of this poll from Open to Closed.Jul 30 2018, 9:24 PM