This is an archive of the discontinued LLVM Phabricator instance.

[Support] Remove the terminfo dependency and rely on TERM
AbandonedPublic

Authored by phosek on Jan 18 2018, 5:27 PM.

Details

Reviewers
jyknight
Summary

The current implementation of terminal color support that relies on
terminfo is broken and also introduces additional dependency. This
change removes this implementation and replaces it with a simpler
mechanism that detects the terminal color support by checking the value
of the TERM environment variable. This is what other GNU tools do as
well. If it's good enough for them, it's good enough for us too, and we
don't need to extra complexity and dependencies

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Jan 18 2018, 5:27 PM

I'm totally in favor of this, it looks like a great improvement.

But of course nbjoerg will complain because it will break all the people who run clang outputting to Tektronix 4012 graphics terminals which can't parse vt100/ansi escape sequence syntax. And I don't have the will to argue the point.

cmake/config-ix.cmake
154

This stanza, and the option declaration above is still used by lldb's cmake file I believe.

https://github.com/android-ndk/ndk/issues/574 shows that this is becoming more of a problem for Android's users as well. I'm willing to +1 the ideas here too. It would be better to just not depend on these other libraries at all for general LLVM.

phosek abandoned this revision.Feb 16 2018, 5:04 PM

@thakis is disabling this logic in the Chromium build of Clang as well: https://chromium-review.googlesource.com/c/chromium/src/+/1025648

Maybe we should reconsider reverting this terminfo stuff and going back to TERM. @chandlerc?

Background: This was added in https://reviews.llvm.org/rL187874 ; from what I understand because someone google-internally who really doesn't like colored output complained that their existing setup for disabling colors in all programs wasn't honored by clang. It regressed color output without curses until r322962 finally restored that functionality. I agree that undoing this would be a good change in general, but said person might be unhappy about it. Maybe we can at least flip the default to false, but just removing it altogether if that's what gcc does these days seems very reasonable to me.

But of course nbjoerg will complain because it will break all the people who run clang outputting to Tektronix 4012 graphics terminals which can't parse vt100/ansi escape sequence syntax. And I don't have the will to argue the point.

For the record, incompatible escape sequences are not limited to 'fringe hardware'. A commonly used software that doesn't exactly match others is GNU screen.