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 869403 - systemd prints raw escape codes if $LESS options set
Summary: systemd prints raw escape codes if $LESS options set
Keywords:
Status: CLOSED DUPLICATE of bug 868383
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 17
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-23 19:30 UTC by Jeff Bastian
Modified: 2012-10-24 13:29 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-24 13:29:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jeff Bastian 2012-10-23 19:30:45 UTC
Description of problem:
systemd prints raw escape codes if custom options are set in the $LESS environment variable.

For example, use the -F option to auto-quit if the output fits in the terminal:

$ export LESS="-F"
$ systemd-delta
ESC[1;32m[EQUIVALENT]ESC[0m /etc/systemd/system/default.target → /usr/lib/systemd/system/default.target

1 overridden configuration files found.

Personally, I have in my ~/.bashrc 
  export LESS="-FiX"

If I unset the $LESS environment variable, then I get green text for "[EQUIVALENT]"

$ unset LESS
$ systemd-delta
[EQUIVALENT] /etc/systemd/system/default.target → /usr/lib/systemd/system/defaul
^^^^^^^^^^^^
   green

I see this with other systemd commands also, e.g., systemctl list-units tries to print "failed" in red letters, but I get this:

systemd-...-clean.service loaded ESC[1;31mfailed failed   ESC[0m     Cleanup of Temporary Directories
systemd-...-setup.service loaded ESC[1;31mfailed failed   ESC[0m     Recreate Volatile Files and Directories

Side-note: those units failed because of bug 857708


Version-Release number of selected component (if applicable):
systemd-44-20.fc17.x86_64
less-444-5.fc17.x86_64

How reproducible:
every time

Steps to Reproduce:
1. set your favorite options in the $LESS environment variable
   export LESS="-F"
2. systemd-delta
3. systemctl list-units
  
Actual results:
Ugly raw escape codes like ESC[1;31m are printed

Expected results:
Red or green text, or plain uncolored text if colors not possible

Additional info:

Comment 1 Jeff Bastian 2012-10-23 19:36:00 UTC
A workaround is to use the --no-pager option (where applicable):

$ systemd-delta --no-pager
[EQUIVALENT] /etc/systemd/system/default.target → /usr/lib/systemd/system/default.target

1 overridden configuration files found.


$ systemctl list-units --no-pager | less
...
systemd-...-clean.service loaded failed failed        Cleanup of Temporary Direc
systemd-...-setup.service loaded failed failed        Recreate Volatile Files an
...

Comment 2 Michal Schmidt 2012-10-24 13:29:51 UTC
It's the same underlying issue as in bug 868383.

*** This bug has been marked as a duplicate of bug 868383 ***


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