Bug 62130 - [REGRESSION] LESS cannot be overriden anymore - breaks scrolling
Summary: [REGRESSION] LESS cannot be overriden anymore - breaks scrolling
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-10 22:04 UTC by Peter Wu
Modified: 2013-07-16 08:34 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Peter Wu 2013-03-10 22:04:33 UTC
The following commit causes a regression here:

commit a4c41bf3fa905c38e6e4d159c13eed890d53838b
Author: Lennart Poettering <lennart@poettering.net>
Date:   Thu Mar 7 21:28:09 2013 +0100

    pager: always override LESS
    
    https://bugzilla.redhat.com/show_bug.cgi?id=868383
    
    Primary reason to do this is to ensure "-e" works as intended, and is
    not ignored because the user set his own LESS variable.

I used to run LESS=R journalctl -ab (or LESS=RS, or ...) to change the behavior of the piper to my needs. Mainly allowing me to use my mouse wheel to scroll faster through the logs. With systemd 198, I am unable to override LESS to achieve that goal.

As a workaround, I can use journalctl -ab | less -R, but then I lose colors. Please allow overriding LESS again, fixing bug https://bugzilla.redhat.com/show_bug.cgi?id=868383 can be done by educating the user not to do stupid things with $LESS and/or by checking whether $LESS is empty or not.
Comment 1 Zbigniew Jedrzejewski-Szmek 2013-07-16 02:42:37 UTC
The pager can be overridden with $SYSTEMD_PAGER [1].

[1] http://www.freedesktop.org/software/systemd/man/journalctl.html#%24SYSTEMD_PAGER
Comment 2 Peter Wu 2013-07-16 08:34:45 UTC
Yeah, I eventually figured that out, but `LESS= SYSTEMD_PAGER=less\ -FRSM journalctl` still does not work because `$LESS` is set unconditionally.

Therefore, I am using this wrapper:

# ~/.bashrc
export SYSTEMD_PAGER=${SYSTEMD_PAGER:-$HOME/bin/less-systemd}

#!/bin/sh
# ~/bin/less-systemd
# systemd uses: FRSXMK
# F --quit-if-one-screen
# R --RAW-CONTROL-CHARS
# S --chop-long-lines
# X --no-init
# M --LONG-PROMPT
# K --quit-on-intr
export LESS=FRSM
exec -- less "$@"


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.