Bug 443292

Summary: Pasting text with a new line does not submit the command
Product: [Applications] konsole Reporter: Oded Arbel <oded>
Component: copy-pasteAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED DUPLICATE    
Severity: normal CC: a.samirh78, ilisepe1, nate
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Oded Arbel 2021-10-04 11:25:07 UTC
SUMMARY
When copying multi-line text and pasting it into the terminal, the new lines do not cause the commands in the text to be executed.

STEPS TO REPRODUCE
1. Have a text editor with some commands that can be executed in the terminal, each on a line.
2. With the cursor at the beginning of the file, hold shift and move one line down, selecting the entire line, then copy it to the clipboard.
3. In Konsole paste the text.

OBSERVED RESULT
After the text is pasted, the cursor is moved to the beginning of the next line in the terminal, but the command is not executed and the command prompt is not shown until the user presses the physical ENTER key.

EXPECTED RESULT
The new line at the end of the text should execute the command, which should start immediately after pasting and at the end of the execution, a command prompt should be seen - no further user input should be needed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.23.80
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
It used to work in the past. I'm not sure at which release it stopped working.
Comment 1 Nate Graham 2021-10-04 22:19:50 UTC
This is actually intentional. It prevents you from being tricked into accidentally executing malicious code copied from elsewhere that includes hidden characters and text due to font shenanigans.
Comment 2 Oded Arbel 2021-10-05 05:11:42 UTC
Couldn't the issue of trickery be solved by a warning dialog to be shown when a user pastes text that contains a new line (with a "don't worry about it anymore" checkbox), like we get when pasting a large text box?
Comment 3 Nate Graham 2021-10-05 13:11:07 UTC
The user would most likely ignore it, as most users don't read dialogs. Having a "don't ask again" checkbox would also defeat the purpose of it, since you need to read the full text of every single paste to make sure it's safe.
Comment 4 Oded Arbel 2021-10-05 13:34:06 UTC
(In reply to Nate Graham from comment #3)
> The user would most likely ignore it, as most users don't read dialogs.

Yea... make sense :-(
Comment 5 ilisepe1 2022-04-29 18:25:13 UTC
(In reply to Nate Graham from comment #1)
> This is actually intentional. It prevents you from being tricked into
> accidentally executing malicious code copied from elsewhere that includes
> hidden characters and text due to font shenanigans.

Would it be possible to add this feature as an option in Konsole settings, so the user can enable or disable it?
Comment 6 Ahmad Samir 2022-04-29 18:30:35 UTC

*** This bug has been marked as a duplicate of bug 431695 ***
Comment 7 Nate Graham 2022-04-29 18:31:23 UTC
If it is, please open a new bug report for that request, rather than re-opening an existing one.