Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 868383

Summary: RFE: make sure correct options are in $LESS when auto-paging
Product: [Fedora] Fedora Reporter: Matthew Miller <mattdm>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: jbastian, johannbg, lnykryn, metherid, mschmidt, msekleta, notting, plautrba, systemd-maint, vpavlin
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-201-2.fc18.6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-16 02:56:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Miller 2012-10-19 16:46:07 UTC
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 23:17:17 UTC
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 16:21:16 UTC
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 13:29:51 UTC
*** Bug 869403 has been marked as a duplicate of this bug. ***

Comment 4 Matthew Miller 2012-10-24 18:23:44 UTC
Also: "LESS= journalctl" does not work. I have to actually unset LESS.

Comment 5 Michal Schmidt 2012-10-24 18:55:01 UTC
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 12:29:03 UTC
(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 13:37:38 UTC
(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 12:42:53 UTC
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 13:13:05 UTC
(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 16:26:41 UTC
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 21:07:24 UTC
(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 21:23:49 UTC
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 22:43:27 UTC
Cool. Thanks!

Comment 14 Fedora Update System 2013-04-10 20:09:56 UTC
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 23:23:02 UTC
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 23:57:44 UTC
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-18 02:34:55 UTC
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 13:37:18 UTC
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 09:59:46 UTC
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-16 02:56:19 UTC
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.