[systemd-devel] [PATCH 06/11] There is no ANSI support on common 3215 consoles

Lennart Poettering lennart at poettering.net
Fri Jun 20 10:03:47 PDT 2014


On Fri, 13.06.14 16:41, Werner Fink (werner at suse.de) wrote:

> Therefore strip off the ANSI escape sequences for 3215 consoles
> but support 3270 consoles if found.

Hmm, this looks messy.

Please add a global systemd PID 1 setting next to the arg_show_status
variable that controls whether color shall be enable for status
output. Then, make this configurable via the kernel cmdline, and in the
configuration file like show_status itself. That would be one patch.

And then, optionally prepare a second patch that adds support for
looking for TERM= on the kernel cmdline. If we see it there we will
initialize arg_show_status from it, and turn off color if it is set to
"dumb". Also, return this value as default terminal setting for $TERM
for /dev/console, but no other devices.

That way, s390 installations may simply set TERM=dumb on the kernel
cmdline and the right thing happens, their /dev/console will get color
disabled, and any raw tty clients will get TERM=dumb set for what they
need.

> +#if defined (__s390__) || defined (__s390x__)
> +                if (cached_on_tty) {
> +                        const char *e = getenv("TERM");
> +                        if (!e)
> +                                return cached_on_tty;
> +                        if (streq(e, "dumb") || strneq(e, "ibm3", 4)) {
> +                                char *mode = NULL;
> +                                int r = parse_env_file("/proc/cmdline", WHITESPACE, "conmode", &mode, NULL);
> +                                if (r < 0 || !mode || !streq(mode, "3270"))
> +                                        cached_on_tty = 0;
> +                        }
> +                }
> +#endif

> +
> +#if defined (__s390__) || defined (__s390x__)
> +        if (streq(tty, "ttyS0")) {
> +                char *mode = NULL;
> +                int r = parse_env_file("/proc/cmdline", WHITESPACE, "conmode", &mode, NULL);
> +                if (r < 0 || !mode || !streq(mode, "3270"))
> +                        return "TERM=dumb";
> +                if (streq(mode, "3270"))
> +                        return "TERM=ibm327x";
> +        }
> +        if (streq(tty, "ttyS1"))
> +                return "TERM=vt220";
> +#endif
> +        return "TERM=vt102";

Yuck. No! We won't do such messy checks. No arch-specific stuff. No
hardcoding of ttyS0 or ttyS1 or whatever other tty. Support for checking
TERM= in the kernel cmdline should be something generic. 

Sorry, but we will not add any specific per-arch hacks to systemd like
this. We can fix this, but then find nice generic ways to do this, but
not this messy pile of s390 hardcoded assumption. That's not how we do
things. 

Also, we are not going to add code for any specific weird terminal
settings. We will do three levels: TERM=linux for the full Linux
console, TERM=vt102 otherwise, and TERM=dumb for the crap that can't do
TERM=vt102. But we are not going to hardcode support for any other
hardware into this. This is 2014. If IBM still can't build ANSI support in
their terminals, then that's the own fault, and they will not get any
support beyond TERM=dumb and no color. We will not work-around IBM's
choices in systemd's source tree.

Sorry.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list