cockpit icon indicating copy to clipboard operation
cockpit copied to clipboard

Terminal does not allow to paste multi-lined command blocks

Open Danik1601 opened this issue 1 year ago • 14 comments

Explain what happens

Cockpit Terminal can not correctly paste commands that consist of multiple lines from clipboard, executing only the first line (or whatever it is doing).

Steps to reproduce:

  1. Copy a multi-lined command block like this:
mkdir $HOME/main-folder \
  $HOME/main-folder/folder-1 \
  $HOME/main-folder/folder-2 \
  $HOME/main-folder/folder-3 \
  $HOME/main-folder/folder-4 \
  $HOME/main-folder/folder-5
  1. Paste it into Cockpit Terminal

  2. See this happen (only the first line is executed): image

Version of Cockpit

327

Where is the problem in Cockpit?

Terminal

Server operating system

Fedora

Server operating system version

41

What browsers are you using?

Chrome

System log

No response

Danik1601 avatar Nov 06 '24 17:11 Danik1601

I have the same issue. Firefox. Ubuntu 24.04.1.

LarsHilden avatar Dec 01 '24 09:12 LarsHilden

@garrett @jelly I checked it with ubuntu 24.04.1 in wsl , I am not getting this issue. I have used chrome browser. I am using cockpit-331.

Image

Mash707 avatar Feb 10 '25 14:02 Mash707

@garrett @jelly I checked it with ubuntu 24.04.1 in wsl , I am not getting this issue. I have used chrome browser. I am using the latest cockpit release.

Nothing changed for me since my initial message.

Image

Cockpit 332, Chrome 133, Fedora 41.

Danik1601 avatar Feb 12 '25 22:02 Danik1601

Let's change the test to something that doesn't affect the filesystem. This should be simple enough:

echo HELLO \
&& echo LINE2 \
&& echo LINE3

Firefox

Works for me

Image

Chrome

Works for me

Image

WebKit (GNOME Web)

Works for me

Image


This is all on Fedora 41 Silverblue, in fish shell, with all browsers in Flatpaks on GNOME on Wayland. I tried bash as well, and it works fine there too, so it's probably not the shell.

Which things vary between us all, for which is working and which isn't?

Image

garrett avatar Feb 13 '25 10:02 garrett

This is all on Fedora 41 Silverblue

I might have unintentionally misinformed you. When I said that the problem was on Fedora 41 I meant the server-side. On the client-side I used Windows 11.

I will try to make myself clear this time. So this problem really bothers me and I want to help as much as possible to get rid of it. Thus I tested some of the mentioned configuration plus some more and found out that the problem is specific to Windows + Chrome.

Every OS, app and package on server and client sides are updated to the latest available version as of 14.02.2024. This means Fedora Server 41, Cockpit 332. On the client side Fedora Silverblue installations are all using Wayland. The results are below (only client-side software mentioned):

  • Windows 11 (24H2) (bare metal), Chrome 133 The problem exists (!!!!!)
    Click to reveal image Image
  • Windows 11 (24H2) (bare metal), Firefox 135 No problem
    Click to reveal image Image
  • Fedora 41 Silverblue (virtual machine), Chrome 133 (Flatpak) No problem
    Click to reveal image Image
  • Fedora 41 Silverblue (virtual machine), Firefox 135 (Native) No problem
    Click to reveal image Image
  • Fedora 41 Silverblue (virtual machine), Gnome Web 47 (Flatpak) No problem
    Click to reveal image Image

This seems specific to Chrome on Windows and not because of any extensions, cache, etc. as I double and triple checked by using incognito mode and another VM with freshly installed Chrome. These results are below (only client-side software mentioned):

  • Windows 11 (24H2) (bare metal), Chrome 133 (Incognito mode) The problem exists (!!!!!)
    Click to reveal image Image
  • Windows 11 (24H2) (virtual machine), Chrome 133 (no account, no extensions) The problem exists (!!!!!)
    Click to reveal image Image

Danik1601 avatar Feb 13 '25 23:02 Danik1601

When I said that the problem was on Fedora 41 I meant the server-side. On the client-side I used Windows 11.

That's an important distinction! It's really easy to report the wrong thing; it happens. Cockpit is kind of running in 2 places at once (backend and in-browser) so it's possible to have a bug in either place.

Thanks for clarifying!

the problem is specific to Windows + Chrome

This is extremely useful to know. Thanks!

I double and triple checked by using incognito mode and another VM with freshly installed Chrome.

Thank you for taking the initiative at testing this! That would've been my next question and suggestion. 😉

The fact that you're hitting it in a VM that has Windows and Chrome inside is useful too. I don't know how many people on the team have a Windows installation on bare metal. We can spin up VMs for sure, though. (I have a dusty Windows VM I can spin up and try things out. Or use quickemu (which can run from within a toolbox container) for testing locally with minimal hassle.)

I wonder if this affects all Chromium browsers (like Edge) or just Chrome itself.

I'll try to see if I can figure this out locally.

garrett avatar Feb 17 '25 12:02 garrett

Windows 11 24H2, Chrome 133

Image

Windows 11 24H2, Chrome 133 (Incognito Mode)

Image

This seems specific to Chrome on Windows

I am using Ubuntu 22.04.5 LTS in WSL2. Running cockpit in chrome in Windows. I am not able to reproduce the given issue. I also used a fresh instance of Ubuntu but still was not able to reproduce it. @Danik1601 are you using any Power Tools?

Mash707 avatar Feb 17 '25 17:02 Mash707

@Danik1601: Following up on @Mash707's point, many Windows apps and extensions can modify the clipboard, sometimes even affecting line breaks, especially as Windows uses CRLF (carriage return and line feed) instead of just LF (line feed) like most other OSes.

To help figure out what's happening, could you please tell us here if you're using any of these?

  1. PowerToys (especially the "advanced paste" feature, which even has some "AI" rewriting, but it can rewrite even with that on: https://learn.microsoft.com/en-us/windows/powertoys/advanced-paste and also https://www.theverge.com/2024/5/21/24161778/windows-powertoys-advanced-ai-copy-paste)... it's supposed to be opt-in, but some people have had it automatically turned on, so even having PowerToys installed at all might cause this issue.
  2. Password managers (like KeePass, LastPass, 1Password, etc.)
  3. Virus scanners
  4. Clipboard managers
  5. Logitech drivers (for mice, etc.), as they have "AI" "integration" now: https://www.theverge.com/2024/4/17/24132468/logitech-ai-prompt-builder-button
  6. A proxy — although I highly doubt this would cause an issue like you're seeing here, sometimes proxies introduce some unexpected things to happen

Knowing this will help us narrow down the cause. Using anything above isn't necessarily a problem, but they can sometimes interfere.

(There's also a possibility of malware doing things like this. Hopefully your computer doesn't have that.)

Thanks! Hopefully we can solve what's going on.

garrett avatar Feb 18 '25 13:02 garrett

@Danik1601 Could you check your clipboard history once to see if the Copy function is working correctly or not. Clipboard history is disabled by default, you will need to enable it in the settings. Use windows + V to access the clipboard history.

Image

Image

Mash707 avatar Feb 18 '25 17:02 Mash707

@Danik1601 are you using any Power Tools?

Yes. Latest Microsoft PowerToys is installed on all of my machines.

I should also note that for VMs I use VirtualBox with shared clipboard enabled. So if anything messed with clipboard on host OS, the clipboard is definitely messed up in guest OS.

could you please tell us here if you're using any of these?

  1. PowerToys is installed with Advanced Paste enabled (I never enabled it manually, this is on by default).
  2. No password managers on my machines except in-browser solutions.
  3. The only antivirus software on all my machines is Microsoft Defender
  4. No clipboard managers except PowerToys. Clipboard history is enabled if that's important.
  5. Logitech Logi Options+ is installed on my laptop, Logitech G Hub is installed on my desktop.
  6. No proxies but I tried a bunch of different VPN solutions as I live in Russia and that's actually a necessity for the last three years. Those VPN applications automatically installed drivers, certificates, extensions, etc. with no noticeable impact.

@Danik1601 Could you check your clipboard history once

Copied both command blocks from this GitHub thread:

Image

Then I turned off Advanced Paste, PowerToys itself and even Logitech G Hub, cleared my clipboard history, refreshed cockpit web page and copy-pasted the command again. Nothing changed, the issue still persists.

  • Windows 11 (24H2) (bare metal), Chrome 133 (Incognito mode) The problem exists (!!!!!)
    Click to reveal image Image
  • Windows 11 (24H2) (bare metal), Edge 133 (Private window) The problem exists (!!!!!)
    Click to reveal image Image
  • Windows 11 (24H2) (bare metal), Opera 116 (Private window) The problem exists (!!!!!)
    Click to reveal image Image
  • Windows 11 (24H2) (bare metal), Firefox 135 (Private window) No problem
    Click to reveal image Image

I wonder if this affects all Chromium browsers (like Edge) or just Chrome itself.

It surely looks like only Chromium browsers are affected.

Danik1601 avatar Feb 19 '25 11:02 Danik1601

When you turned off PowerToys (including Advanced Paste), did you reboot before testing? It might modify your system in ways that aren't fully undone until a reboot. (I don't know for sure, but a reboot after turning off something like that is a good idea just to be sure.)

I'm still leaning toward PowerToys being the problem we're hitting here, as I've seen evidence elsewhere where copy/pasting is sometimes completely or subtly broken for others, and we know there's a specific feature to alter the clipboard.

VPNs could cause the issue, but I doubt it. Microsoft Defender is good to keep on, of course. Malware probably isn't an issue (especially since you have Microsoft Defender on). Logitech software might be doing weird things, but I think it only does things on request (like a button for AI) instead of intercepting your clipboard — but I really do not know. Something other than PowerToys might still be causing this, but I think they're much less likely.

So, could you please reboot after turning off PowerToys and let us know if the issue persists, just to be sure? Thanks!

garrett avatar Feb 20 '25 12:02 garrett

Sorry for taking so long, I was unable to come to the server's LAN area physically. I have no remote access.

Here is the screenshot from incognito mode in Microsoft Edge on freshly installed Windows 11 24H2 (official Microsoft image, ISO, Rufus). Literally nothing else was installed after initial Windows 11 installation, even Chrome.

Image

At this point I strongly believe that the problem is in Cockpit or Chromium.

Danik1601 avatar Apr 03 '25 12:04 Danik1601

Sorry for taking so long, I was unable to come to the server's LAN area physically. I have no remote access.

Here is the screenshot from incognito mode in Microsoft Edge on freshly installed Windows 11 24H2 (official Microsoft image, ISO, Rufus). Literally nothing else was installed after initial Windows 11 installation, even Chrome.

At this point I strongly believe that the problem is in Cockpit or Chromium.

UPD: Installed Fedora Server 42 (clean installation from USB) (no additional packages except ones that are available from Cockpit GUI (Cockpit applications (Files, Machines, Podman) and DNF automatic). Tried to insert multi-lined command block from Windows 11 client (again, clean installation from USB) (nothing installed, not even Chrome, tried using Edge). The issue still persists.

Danik1601 avatar Apr 27 '25 23:04 Danik1601

Upgrade to PatternFly 6 (Cockpit 337) didn't resolve the problem

Danik1601 avatar May 09 '25 05:05 Danik1601