Bug 868383 - RFE: make sure correct options are in $LESS when auto-paging
RFE: make sure correct options are in $LESS when auto-paging
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
18
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
: 869403 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-19 12:46 EDT by Matthew Miller
Modified: 2013-05-15 22:56 EDT (History)
10 users (show)

See Also:
Fixed In Version: systemd-201-2.fc18.6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-05-15 22:56:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Matthew Miller 2012-10-19 12:46:07 EDT
Description of problem:

When I run journalctl, it pipes output to less, and escape sequences are there but not interpretted. For example: "kernel: ESC[1;39mtype=1404 audit(1350686330.035:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295ESC[0m".

Typing -R<enter> to enable processing of ANSI sequences makes the sequences show properly.

Version-Release number of selected component (if applicable):

systemd-194-1.fc18.x86_64
less-444-8.fc18.x86_64

This is on an up-to-date F18 test system.

How reproducible:

always

Steps to Reproduce:
1. Install system
2. Wait until something colored hits the log
3. run journalctl
  
Actual results:

Garbled ESC codes in output.

Expected results:

Pretty colors in output.
Comment 1 Lennart Poettering 2012-10-20 19:17:17 EDT
hmm, do you have any non-default options set in $LESS? The default of less does actually interpret ANSI escape codes.

What does this print for you?

echo $LESS

Is this fixed if you invoke:

LESS= journalctl

?
Comment 2 Matthew Miller 2012-10-22 12:21:16 EDT
Hmmm. Yes; I had -MX set.

Doesn't journalctl override this? I don't necessarily want to add -R to my default options. (I don't think that _is_ the default.)

I think journalctl should probably override the default options, as 'man' does.  If one wants to change them, they can set SYSTEMD_PAGER.
Comment 3 Michal Schmidt 2012-10-24 09:29:51 EDT
*** Bug 869403 has been marked as a duplicate of this bug. ***
Comment 4 Matthew Miller 2012-10-24 14:23:44 EDT
Also: "LESS= journalctl" does not work. I have to actually unset LESS.
Comment 5 Michal Schmidt 2012-10-24 14:55:01 EDT
In pager_open() we do: setenv("LESS", "FRSX", 0);
We can change the last argument to 1 to override the user's value.
Comment 6 Matthew Miller 2012-10-25 08:29:03 EDT
(In reply to comment #5)
> In pager_open() we do: setenv("LESS", "FRSX", 0);
> We can change the last argument to 1 to override the user's value.

(Can we add M while we are at it?)
Comment 7 Matthew Miller 2012-10-31 09:37:38 EDT
(Re: title change)

While "override $LESS" is the suggested fix, I think it's still a _bug_, not really an RFE. As long as it's fixed, not a big deal, of course.
Comment 8 Lennart Poettering 2013-03-07 07:42:53 EST
I have now added "M" to LESS.

I am not sure we really should override $LESS. git doesn't do that. I have the suspicion that people would hate us if we override their personal settings. Dunno. Opinions? Convince me that we really should override $LESS. If not, I'll close the bug.
Comment 9 Matthew Miller 2013-03-07 08:13:05 EST
(In reply to comment #8)
> I have now added "M" to LESS.
> 
> I am not sure we really should override $LESS. git doesn't do that. I have
> the suspicion that people would hate us if we override their personal
> settings. Dunno. Opinions? Convince me that we really should override $LESS.
> If not, I'll close the bug.

It looks like git (and man) _add_ to the existing options. They don't exhibit the same problem with color and -R.

I agree that that's better than just overriding them, and that people might not be happy about that. However, if that's hard, I think overriding is better than the current approach, especially since there is $SYSTEMD_PAGER.
Comment 10 Lennart Poettering 2013-03-07 11:26:41 EST
From what I am seeing in the git sources (pager.c) they do not add, they only set $LESS if it is not set anyway, and they set it to FRSX. I don't see any code for "adding" settings there, do you?
Comment 11 Matthew Miller 2013-03-07 16:07:24 EST
(In reply to comment #10)
> From what I am seeing in the git sources (pager.c) they do not add, they
> only set $LESS if it is not set anyway, and they set it to FRSX. I don't see
> any code for "adding" settings there, do you?

My fault; I had pager options set in git directly as well. It does have the same behavior.
Comment 12 Lennart Poettering 2013-03-07 16:23:49 EST
I have now turned on overriding of LESS after all, simply to ensure that the new "-e" feature (i.e. immediately jump to end of log stream) of journalctl always works. 

I guess this closes the issue.
Comment 13 Matthew Miller 2013-03-07 17:43:27 EST
Cool. Thanks!
Comment 14 Fedora Update System 2013-04-10 16:09:56 EDT
systemd-201-2.fc18.1 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/systemd-201-2.fc18.1
Comment 15 Fedora Update System 2013-04-11 19:23:02 EDT
Package systemd-201-2.fc18.2:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.2'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.2
then log in and leave karma (feedback).
Comment 16 Fedora Update System 2013-04-15 19:57:44 EDT
Package systemd-201-2.fc18.4:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.4'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.3
then log in and leave karma (feedback).
Comment 17 Fedora Update System 2013-04-17 22:34:55 EDT
Package systemd-201-2.fc18.5:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.5'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.5
then log in and leave karma (feedback).
Comment 18 Fedora Update System 2013-05-07 09:37:18 EDT
systemd-201-2.fc18.6 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.6
Comment 19 Fedora Update System 2013-05-09 05:59:46 EDT
Package systemd-201-2.fc18.6:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.6
then log in and leave karma (feedback).
Comment 20 Fedora Update System 2013-05-15 22:56:19 EDT
systemd-201-2.fc18.6 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.