Closed Bug 1611407 Opened 4 years ago Closed 3 years ago

garbled output when pasting images from clipboard (also very slow)

Categories

(Core :: Widget: Gtk, defect, P3)

74 Branch
defect

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: treeshateorcs, Assigned: stransky, NeedInfo)

References

Details

Attachments

(2 files)

Attached file log

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

1a. on wayland
cat image.png | wl-copy -t image/png

1b. on xorg
cat image.png | xclip -selection clipboard -t image/png

  1. ctrl+v on an imageboard such as kohlchan.net/int. it seems to work fine on imgur

Actual results:

https://i.imgur.com/vRovYCv.png

Expected results:

image is pasted and no output in the window it was pasted in

an excerpt of a mozregression log is attached

Hi,

Thanks for providing the mozregression log.

I don't have wayland or xorg on my end to test this, so as a starting point I'll add this ticket to the Core: Widget gtk product and hopefully someone with more knowledge in this area will look over it.

Regards,
Virginia

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Do you see the same behavior on X11 and Wayland?

Flags: needinfo?(treeshateorcs)
Priority: -- → P3

yes, same behavior on x11 and wayland

Flags: needinfo?(treeshateorcs)

I wonder if that's https://gitlab.gnome.org/GNOME/mutter/-/issues/1160 but I see this one with Wayland only.

I have the same problem, but I use i3 instead, so I'm questioning about the relation with Mutter (but I use GDM3). I configured a series of keystrokes to do screenshots (gnome-screenshot is of the table, just pure execs of i3) using the tool maim to do the captures and piping for xclip to put in clipboard (not primary or secundary, clipboard itself). I tried to paste inside Google Images (which would result in a search for that image) and in the compose screen of Thunderbird (same backend, I guess, could be a hint too). I just got pure text, not the image as I supposed to expect. I also would like to mention I was able to paste the image inside Mattermost via Firefox (webapp). Here the issue related to Mattermost, so I think someone more experienced could find a hint. https://github.com/mattermost/mattermost-server/issues/14027

Can you run latest nightly on terminal with MOZ_LOG="WidgetClipboard:5" env variable set, reproduce the issue and attach the log here?
Thanks.

Flags: needinfo?(treeshateorcs)

Here are the logs as requested: https://gist.github.com/mhalano/250eb15d0648a65cbe7ff3e2381a1464
It wasn't pasting anything now, not the image nor gibberish.

I see. from the log:

[Parent 250229: Main Thread]: D/WidgetClipboard nsRetrievalContextX11::GetClipboardText(clipboard)
[Parent 250229: Main Thread]: D/WidgetClipboard nsRetrievalContextX11::WaitForClipboardData

(firefox:250229): Gdk-WARNING **: 19:40:14.117: Error converting selection from UTF8_STRING

It looks like Gtk tries to convert image data to UTF8 - it looks like wrong MIME type is used.

btw. Which locale do you use?

Bug 1726516 may be related - I see the same log there.

BTW. can you reproduce it on Wayland too? If so can you please also attach log from MOZ_LOG="WidgetClipboard:5" ?

My locale

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=pt_BR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_ALL=

Unfortunately, I don't think I can test with Wayland because I use i3, which is x11-exclusive. Sorry.

Okay, and are there any reproduction steps? the ones from https://bugzilla.mozilla.org/show_bug.cgi?id=1611407#c0 does not work for me.

Bug 1726516 may be related - maybe wrong image mime type is in clipboard and Firefox tries to convert image data to text?

See Also: → 1726516

I did the same using xclip. Both from a pre-existant png file and from a screen selection using maim tool.

I'm sorry but I'm quite confused how this bug affects any real-life scenario. Does any application paste image data with wrong/unknown mime type and Firefox fails to paste it then? If so can you provide me step-by-step reproduction steps?
Thanks.

I use i3 as my window manager. I have some shortcuts where I use the maim tool do to a capture of the screen or, mostly common, a selection of the screen. Sometimes (very frequently, actually) I have to paste this or in a Firefox screen (less common) or Thunderbird compose screen (most common). When I paste it, there are just gibberish, the text content of the image capture. Here is my shortcuts. You could execute on of them and try to paste to Firefox or, which I'm more costumed to, Thunderbird compose screen.

bindsym Ctrl+Print exec --no-startup-id maim | xclip -selection clipboard -t image/png
bindsym Ctrl+Shift+Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png
bindsym Ctrl+$mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/png

Okay, I can reproduce with X11 backend. Wayland seems to be OK.

11 tries to convert clipboard data to requested MIME type which may lead to various errors so get clipboard content first and query only present clipboard data types.

Assignee: nobody → stransky
Attachment #9238073 - Attachment description: Bug 1611407 [Linux] Don't try to get clipboard data of MIME type which is actually missing in clipboard, r?jhorak → Bug 1611407 [Linux/X11] Don't try to get text clipboard data of binary MIME types, r?jhorak
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/acf8d9448247
[Linux/X11] Don't try to get text clipboard data of binary MIME types, r=jhorak
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
Regressions: 1740159
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: