Bug 869403 - systemd prints raw escape codes if $LESS options set
systemd prints raw escape codes if $LESS options set
Status: CLOSED DUPLICATE of bug 868383
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
17
All Linux
low Severity low
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-23 15:30 EDT by Jeff Bastian
Modified: 2012-10-24 09:29 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-24 09:29:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeff Bastian 2012-10-23 15:30:45 EDT
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 15:36:00 EDT
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 09:29:51 EDT
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.