[llvm-bugs] [Bug 25007] New: automatic color diagnostics breaks terminfo configuration

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 30 16:29:01 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25007

            Bug ID: 25007
           Summary: automatic color diagnostics breaks terminfo
                    configuration
           Product: libraries
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: rodrigorivascosta at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

When there is no `-f[no-]color-diagnostics` in the command line, the clang
driver will try to auto-detect if the terminal supports color text. This
auto-detection resets any terminfo configuration that may be currently
configured.

In the case of /usr/bin/clang that is not a problem, but when it is used as a
library very bad things will happen, for example with Vim and the
Clang-Complete plugin [1].

I've traced the problem to the function `terminalHasColors(int fd)` in
`lib/Support/Unix/Process.inc`: it calls `setupterm()` and then `set_curterm()`
and `del_curterm()`, thus disabling any terminal configuration.

My suggestion is to call first `set_curterm()`: if it returns null then
terminfo is not initialized and it can be done as now. But if it returns
not-null then terminfo is already initialized and you do not need to call
`set_curterm()` or `del_curterm()`.

[1]:
https://github.com/Rip-Rip/clang_complete/issues/453#issuecomment-144519415

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150930/e927fcd2/attachment.html>


More information about the llvm-bugs mailing list