You are not logged in.

#1 2017-03-01 12:56:23

BlackMastermind
Member
Registered: 2017-01-17
Posts: 45

systemctl colors clobber terminal

I don't know when this bug popped up, as I don't run systemctl commands every day, but whenever I run a systemctl command now that outputs colors, for example: "systemctl list-unit-files", it clobbers the colors on my terminal. The colors that are outputted don't look right either, it's like a wall of red where it should only show a few keywords in red or green. After I have run the command, I have to type reset in my terminal to get the colors back to normal

I have the environment variable SYSTEMD_PAGER set to "", because I dislike pager-by-default behavior. If I unset the variable, systemctl commands don't clobber my terminal, but the output still doesn't look right, with some seemingly random "underlines" in the output. If I pipe the output through another command (e.g. grep), it obviously goes away too as piping strips the output of ansi codes.

I verified the behavior on three different Arch machines, with three different terminal emulators: rxvt-unicode, regular xterm and mate-terminal. The bug is present in all cases.

I also checked if it was behaving like that on CentOS, which uses an older version of systemd, and it is not.

Here is a comparison screenshot: http://i.imgur.com/NPIhgPX.png

The terminal on top is on CentOS, it shows the output as I expect it to look like. The terminal on the bottom is on Arch.

Offline

#2 2017-03-01 15:41:17

BlackMastermind
Member
Registered: 2017-01-17
Posts: 45

Re: systemctl colors clobber terminal

Trying to narrow down this bug, I dug up an Arch VM that hasn't been powered on or updated since December 2016. The version of systemd on the VM is 231-4, and it doesn't exhibit this buggy behavior.

This leads me to conclude that the bug has been introduced somewhere between version 231-4 and 232-8 of systemd.

Offline

#3 2017-03-01 15:54:08

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: systemctl colors clobber terminal

I cannot reproduce this (systemd-232-8, rxvt-unicode-9.22-2).

Are you sure it is a systemd bug? Have you tried with another terminal (e.g. xterm or a VTE-based one, or in a TTY)?


pkgshackscfgblag

Offline

#4 2017-03-01 16:18:40

BlackMastermind
Member
Registered: 2017-01-17
Posts: 45

Re: systemctl colors clobber terminal

ayekat wrote:

I cannot reproduce this (systemd-232-8, rxvt-unicode-9.22-2).

Are you sure it is a systemd bug? Have you tried with another terminal (e.g. xterm or a VTE-based one, or in a TTY)?

Reread my initial post, I tried with 3 terminal emulators on 3 different hosts. On a TTY it's the same problem and you can add PuTTY to the list too. I really don't think it's my terminal emulator.

Here's a very basic arch system I just installed from scratch.

With 232-8 I get this: http://i.imgur.com/WsRKaEt.png

If I downgrade the systemd package to version 231-4 from the archives, I get this: http://i.imgur.com/q23eSvN.png

The only difference between screenshot 1 and screenshot 2 is the systemd version. I can't really make it any clearer than that...

Last edited by BlackMastermind (2017-03-01 16:28:16)

Offline

#5 2017-03-01 16:31:00

seth
Member
Registered: 2012-09-03
Posts: 50,009

Re: systemctl colors clobber terminal

I'd rather blame the shell or some variable in there.

bash, zsh or sth. entirely different?
Tried with a different user than root?

Offline

#6 2017-03-01 16:46:40

BlackMastermind
Member
Registered: 2017-01-17
Posts: 45

Re: systemctl colors clobber terminal

seth wrote:

I'd rather blame the shell or some variable in there.

bash, zsh or sth. entirely different?
Tried with a different user than root?

Regular old bash, straight out of the box without anything fancy configured, tried with a different user too, same result. Just to humor you, I tried with csh, mksh, zsh and fish too. Same result.

As you all don't believe me, what do you get if (using bash) you do:

export SYSTEMD_PAGER=""
/usr/bin/systemctl list-unit-files

Post a screenshot.

Offline

#7 2017-03-01 16:47:12

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: systemctl colors clobber terminal

BlackMastermind wrote:

Reread my initial post, I tried with 3 terminal emulators on 3 different hosts.

Ah, I should've read that, I'm sorry. Also, unsetting the pager indeed makes it behave the same way here, too, so yeah, this looks like a bug to me.

I would probably contact the systemd devs - either on GitHub (I can't find any related issue) or on IRC (freenode#systemd).

--edit--
To extend on seth's comment below, yes, it doesn't really "clobber the terminal" - it just forgets to print the "reset-colour" escape sequence after a disabled.
If your shell prompt doesn't do anything colour-related, the colour will continue to be active beyond your shell prompt.
But it is still a bug and should be reported.

Last edited by ayekat (2017-03-01 17:16:09)


pkgshackscfgblag

Offline

#8 2017-03-01 17:08:56

seth
Member
Registered: 2012-09-03
Posts: 50,009

Re: systemctl colors clobber terminal

Who said disbelieve?

systemctl messes colors, yes - but gracefully caught by my PS1 ;-)

Offline

#9 2017-03-01 17:19:35

BlackMastermind
Member
Registered: 2017-01-17
Posts: 45

Re: systemctl colors clobber terminal

seth wrote:

Who said disbelieve?

systemctl messes colors, yes - but gracefully caught by my PS1 ;-)

So I take it your PS1 has an ansi code to workaround buggy software like that?

Offline

#10 2017-03-01 17:24:50

seth
Member
Registered: 2012-09-03
Posts: 50,009

Re: systemctl colors clobber terminal

It's rather to please my eyes - and came for free with grml-zsh-config ;-)

Offline

#11 2017-03-01 17:24:55

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: systemctl colors clobber terminal

BlackMastermind wrote:

So I take it your PS1 has an ansi code to workaround buggy software like that?

I think most people don't have primarily that in mind when they use colour codes in their prompts smile
But it's a nice side-effect.


pkgshackscfgblag

Offline

Board footer

Powered by FluxBB