[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt show escape characters



On Fri, Nov 07, 2025 at 23:26:18 -0600, David Wright wrote:
> I don't understand. When did less get involved in a simple command
> like   apt show bash   ?

"Pipe the output through a pager automatically" has become a thing in
recent years.  systemctl does it too.  man has always done it, but for
a very long time it was unique.

> The only way I know in trixie for displaying the appearance as
> intended is:
> 
>   PAGER= apt show bash
> 
> Who sets PAGER, I don't know. It's not shown in my environment.

I do have PAGER=less in my environment.  Here are the relevant
variables for my setup:

PAGER=less
LESS=-X
EDITOR=vim
VISUAL=vim

If PAGER is not set, programs that want to launch a pager will select
one themselves.  Traditionally, they would select more(1).  On Debian,
man(1) appears to select "pager":

hobbit:~$ tty
/dev/pts/6
hobbit:~$ (unset PAGER; man ls)

[...]

hobbit:~$ ps -ft pts/6
UID          PID    PPID  C STIME TTY          TIME CMD
greg     1832690 2983701  0 09:21 pts/6    00:00:00 man ls
greg     1832698 1832690  0 09:21 pts/6    00:00:00 pager
greg     2983701 2983664  0 Oct16 pts/6    00:00:00 bash

hobbit:~$ ls -l /usr/bin/pager
lrwxrwxrwx 1 root root 23 Mar 23  2023 /usr/bin/pager -> /etc/alternatives/pager*

systemctl also uses "pager", even with PAGER=less in my environment,
which is quite interesting.  Especially since "PAGER= systemctl ..."
does not use a pager at all.  Apparently it respects an empty PAGER
variable, but not a PAGER variable with contents.

Back to your case:

hobbit:~$ (unset PAGER; apt show bash)
[...]

hobbit:~$ ps -ft pts/6
UID          PID    PPID  C STIME TTY          TIME CMD
greg     1833196 2983701  2 09:26 pts/6    00:00:00 apt show bash
greg     1833199 1833196  0 09:26 pts/6    00:00:00 pager
greg     2983701 2983664  0 Oct16 pts/6    00:00:00 bash

That seems pretty clear.

> I've been using   MANOPT='-P less'   for years, which gives me paging,
> but also the bold and underlining that helps distinguish words having
> a particular meaning from the rest of the text. This is now screwed
> in trixie, in the same way as the OP's problem:
> 
>   man less                     unreadable
>   MANOPT= man less             unreadable
>   MANOPT= man less | less -r   readable, but bold/underlining gone
>   MANOPT= man less | less -R   readable, but bold/underlining gone
>   PAGER= MANOPT= man less      ½ readable, with bold/underlining

Man pages look fine for me.  I have no idea how I would reproduce
your results.  If I try to reproduce what I think are your settings:

    (unset PAGER; MANOPT="-P less" man ls)

then it still appears "normal" for me.  Adding "unset LESS" doesn't
change anything except to get rid of my -X option, so the terminal is
"restored" afterward (which is a thing I don't want when I read man
pages; I like the last part of the page I was looking at to remain *on
the terminal* after I exit from the pager, so I can see it as I'm typing
the next command).

I control boldface and underlining by setting terminal resources.
I'm using rxvt-unicode.  Underlining works automatically, and I use a
blue color for boldface text:

rxvt*saveLines:			2000
rxvt*colorBD:			navy blue
; rxvt*colorUL:			red
rxvt*color2:			ForestGreen
rxvt*color7:			white
; rxvt*color4:			PowderBlue
rxvt*cutchars:			\\ `\047\042();<>[]{|},
rxvt*scrollBar_floating:	false

The red underlining is currently disabled, though I've used it in the
past.  I think it might have been needed with traditional rxvt, back
in the old Latin-1 days, before rxvt-unicode.  I don't remember it all.


Reply to: