Bug 369525 - Rewrite the command echo in the Build toolview
Summary: Rewrite the command echo in the Build toolview
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: git master
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-29 11:24 UTC by RJVB
Modified: 2022-11-23 05:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RJVB 2016-09-29 11:24:19 UTC
Here's an example command echo from the build toolview/progress window:

/Users/bertin/work/src/MSWin/SynchroTr/CMake/Release> /opt/local/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MacPorts -G 'Unix Makefiles' -Wno-dev '-DCMAKE_C_FLAGS=-O3 -march=native -g' '-DCMAKE_CXX_FLAGS=-O3 -march=native -g'

Guess what happens when you are trying to figure out why things don't configure as you expect, you copy the line using the "Copy selection to clipboard" toolbutton, and paste the result in a terminal, for instance with the idea of appending "--debug-output"

Reproducible: Always

Steps to Reproduce:
1. Copy a progress command echo like the one shown above
2. Paste into a terminal


Actual Results:  
The line will be executed because a newline was included during the copy procedure. There's little one can do about that, except for remembering to type a comment or illegal character (I often use a brace) before doing the paste.

If the file after the '>' is owned by the user, its contents will be lost.

Expected Results:  
This is of course the expected result...

The problem could be avoided by printing what is actually being done:

(cd /Users/bertin/work/src/MSWin/SynchroTr/CMake/Release ; /opt/local/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=MacPorts -G 'Unix Makefiles' -Wno-dev '-DCMAKE_C_FLAGS=-O3 -march=native -g' '-DCMAKE_CXX_FLAGS=-O3 -march=native -g')

or by using a different "prompt" character that doesn't have a special meaning in the shell.

Alternatively, the build progress view (and similar toolviews) could support partial selection instead of allowing to select only complete lines.

You could call this a stupid operator error and that wouldn't be entirely wrong. I would evidently never have executed the command "as is", and if I hadn't been trying to figure out why something didn't work I might even have double-checked what I was about to do before pasting.
Still, it's something that clearly can happen, with potentially very annoying results.

I experienced dataloss because of this, so I'm putting a Critical severity. Feel free to bump it down after having taken note ;)

I'm volunteering to look into this and put up a draft modification for review; just please point me to the code that has to be changed. Searching for a '>' in a large C++ project might provoke a hay fever attack otherwise ;)
Comment 1 Kevin Funk 2016-09-29 12:04:11 UTC
What about grepping our code base for "Copy selection to clipboard"...?

Reducing severity, this is definitely not critical.
Comment 2 RJVB 2016-09-29 12:35:43 UTC
"Copy to clipboard" doesn't give a lot of leeway to address the issue; the only intervention I can see that can be applied without too much 2nd-guessing is to strip the final newline from the selection. But I'd rather see this fixed in a less catch-all fashion that cannot have unforeseen side-effects.
Comment 3 Justin Zobel 2022-10-24 00:46:53 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 4 Bug Janitor Service 2022-11-08 05:10:58 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2022-11-23 05:17:27 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!