Bug 321939 - Outputview does not support ANSI escape sequences (Clang warnings partially trunkated)
Summary: Outputview does not support ANSI escape sequences (Clang warnings partially t...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Output Views (show other bugs)
Version: 4.5.60
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
: 359229 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-04 09:05 UTC by Torbjörn K.
Modified: 2016-12-13 08:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.0


Attachments
Screenshot of KDevelop's build output view showing the bug (84.82 KB, image/png)
2013-07-04 09:06 UTC, Torbjörn K.
Details
Actual output of build process in separate terminal (161.78 KB, image/png)
2013-07-04 09:07 UTC, Torbjörn K.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjörn K. 2013-07-04 09:05:54 UTC
When building a CMake based project with clang from KDevelop the warnings produced by Clang are getting partially trunkated in the build output view. See the attached screenshots for the output in the build output view and in a separate terminal.

---
clang version 3.3 (branches/release_33 183898)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Qt: 4.8.4
KDE Development Platform: 4.10.5 "release 4"
KDevelop: 4.5.60

Reproducible: Always

Steps to Reproduce:
1. have a CMake/Make-based project with some buggy code
2. build it with Clang 
3. see the actual warning messages of Clang being partially trunkated
4. build the project in a separate terminal to see the warnings about your buggy code



Works fine for GCC.
Comment 1 Torbjörn K. 2013-07-04 09:06:30 UTC
Created attachment 80937 [details]
Screenshot of KDevelop's build output view showing the bug
Comment 2 Torbjörn K. 2013-07-04 09:07:13 UTC
Created attachment 80938 [details]
Actual output of build process in separate terminal
Comment 3 Milian Wolff 2013-07-14 07:50:13 UTC
Odd, I cannot reproduce this. But for me, I get clang outputting color escape sequences which we do not support. Maybe thats related? I.e. this is what it outputs for me in our output view:

[1m/home/milian/projects/kde4/kdevplatform/shell/tests/sessioncontrollertest.cpp:90:43: [0m[0;1;31merror: [0m[1mno viable conversion from 'const QString' to 'const ISessionLock::Ptr' (aka 'const QSharedPointer<KDevelop::ISessionLock>')[0m
            m_sessionCtrl->deleteSession( name );
[0;1;32m                                          ^~~~
[0m[1m/usr/include/qt4/QtCore/qsharedpointer_impl.h:480:12: [0m[0;1;30mnote: [0mcandidate constructor not viable: no known conversion from 'const QString' to 'const QSharedPointer<KDevelop::ISessionLock> &' for 1st argument[0m
    inline QSharedPointer(const QSharedPointer<T> &other) : BaseClass(other) { }
[0;1;32m           ^
Comment 4 Milian Wolff 2013-07-14 08:04:32 UTC
Actually, my issue was due to me defining CC/CXX with -fcolor-diagnostics since I'm using it through ccache. Do you happen to do something similar?
Comment 5 Torbjörn K. 2013-07-14 08:30:43 UTC
That in deed is the problem. It works fine without the -fcolor-diagnostics argument passed to clang via ccache. Also without using ccache at all.

I'm using these two scripts for calling clang through ccache:

$ cat /usr/local/bin/clang
#!/bin/bash
CCACHE_CPP2=yes /usr/bin/ccache /usr/bin/clang -Qunused-arguments -fcolor-diagnostics "$@"

$ cat /usr/local/bin/clang++
#!/bin/bash
CCACHE_CPP2=yes /usr/bin/ccache /usr/bin/clang++ -Qunused-arguments -fcolor-diagnostics "$@"
Comment 6 Milian Wolff 2013-07-14 12:45:43 UTC
OK, then I'll rephrase the bug title here. Not sure though whether we really want to implement escape sequences. maybe the color ones would be enough though, who knows...
Comment 7 Kevin Funk 2013-10-02 23:37:34 UTC
Would still be a nice junior job, in case we want to implement this. Marking as such.
Comment 8 Claus Christmann 2014-08-15 13:49:21 UTC
I was looking into changing my debug outputs to use color, couldn't get it to work, and found this one -- concluding that the Kdevelop "Debug" toolview simply doesn't support color escape sequences...

However, I noticed that the "Build" toolview apparently does support them: when configuring a project I always seem to get a "-- Configuring done" in green...

Are these two toolviews releated and would it really be a "junior project" to port the feature from the "Build" to the "Debug" one?
Comment 9 Kevin Funk 2015-08-31 18:13:24 UTC
@Claus: We're coloring this output using of pattern matching (see ./outputview/outputfilteringstrategies.cpp).

I'd still love to see us interpreting (or stripping color codes). So, if you want to work on that...
Comment 10 Kevin Funk 2015-12-17 12:01:56 UTC
Git commit 9991a24e3d543f015380ce4f8c3d2dfca377aba4 by Kevin Funk.
Committed on 17/12/2015 at 11:58.
Pushed by kfunk into branch '5.0'.

OutputView: Filter ANSI sequences

Summary:
Hardcoding the filter function in the outputmodel for now.

Not making this a filter strategy on purpose, it doesn't fit into the
current architecture. Stripping ANSI sequences is merely a
QString->QString transformation, while the filtering strategies do a
QString->FilteredItem transformation.
Related: bug 113128
FIXED-IN: 5.0

Subscribers: apol, kdevelop-devel

Projects: #kdevelop

Differential Revision: https://phabricator.kde.org/D660

M  +15   -1    outputview/outputmodel.cpp
M  +63   -0    util/kdevstringhandler.cpp
M  +6    -0    util/kdevstringhandler.h
M  +19   -0    util/tests/test_stringhandler.cpp
M  +2    -0    util/tests/test_stringhandler.h

http://commits.kde.org/kdevplatform/9991a24e3d543f015380ce4f8c3d2dfca377aba4
Comment 11 Kevin Funk 2016-02-10 11:07:58 UTC
*** Bug 359229 has been marked as a duplicate of this bug. ***