<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - automatic color diagnostics breaks terminfo configuration"
href="https://llvm.org/bugs/show_bug.cgi?id=25007">25007</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>automatic color diagnostics breaks terminfo configuration
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Support Libraries
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rodrigorivascosta@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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]:
<a href="https://github.com/Rip-Rip/clang_complete/issues/453#issuecomment-144519415">https://github.com/Rip-Rip/clang_complete/issues/453#issuecomment-144519415</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>