Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in XDG path) #2211

Closed
vanheck opened this issue Dec 31, 2021 · 37 comments · Fixed by #2222
Closed
Labels
Linux Linux specific issue Unconfirmed Bug The bug is not confirmed by anyone else.

Comments

@vanheck
Copy link

vanheck commented Dec 31, 2021

Flameshot Version

flameshot.x86_64 0.10.2-3.fc35

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

Fedora 35

Description

Hi, I have the same problem as @yajo here: #1910 (comment) - the issue is closed, but the problem remains.

What happens under Wayland:

Captura.del.escritorio.de.27-12-21.09.25.59.mp4

Originally posted by @yajo in #1910 (comment)

I use:
Fedora 35 with Gnome 41.2 (wayland), xdg-desktop-portal and xdg-desktop-portal-gnome are also installed.

$ dnf list installed | grep xdg-desktop-portal
xdg-desktop-portal.x86_64                          1.10.1-2.fc35                          @updates                  
xdg-desktop-portal-gnome.x86_64                    41.1-1.fc35                            @fedora                   
xdg-desktop-portal-gtk.x86_64                      1.10.0-2.fc35                          @updates                  

$ dnf list installed | grep flameshot
flameshot.x86_64                                   0.10.2-3.fc35                          @updates

Steps to reproduce

  1. run flameshot gui
  2. accept share screen
    and get error pop-up "Unable to capture screenshot"

Screenshots or screen recordings

No response

System Information

Wayland, xdg-desktop-portal and xdg-desktop-portal-gnome are also installed.

@vanheck vanheck added the Unconfirmed Bug The bug is not confirmed by anyone else. label Dec 31, 2021
@borgmanJeremy
Copy link
Contributor

This is really confusing to me because it works fine for me in a clean VM. Have you tried rebooting after installing all the portals?

@vanheck
Copy link
Author

vanheck commented Dec 31, 2021

Yes, ofcourse. I restarted the system multiple times. I upgraded the system from fedora 34. The flameshot doesn't work after the distro upgrade. :/

Is it possible to debug the problem (somehow)?

@borgmanJeremy
Copy link
Contributor

Is it possible to debug the problem (somehow)?
Yes, usually what I do in this type of bug is first use "bustle" to log the DBus calls.

  1. Launch flameshot
  2. Start Bustle
  3. Record Session Bus
  4. Right click on tray icon and hit take screenshot
  5. Stop Bustle recording

Then look for an error in the diagram and report what the error is.

I also just noticed you are using the flatpak and not the native build. I thought you were using the native build so thats what I tried in the VM. I will try the flatpak later. Perhaps use Flatseal and make sure Flameshot has DBus permissions?

@vanheck vanheck closed this as completed Dec 31, 2021
@vanheck vanheck reopened this Dec 31, 2021
@vanheck
Copy link
Author

vanheck commented Dec 31, 2021

I thought I use native build (not flatpack) - the software center confirms it:
obrazek

And errors in Bustle are in org.freedesktop.portal.Request.Close and org.freedesktop.DBus.Properties.GetAll, both errors are org.freedesktop.DBus.Error.UnknownMethod.
obrazek

@borgmanJeremy
Copy link
Contributor

In the gif you ran it with flatpak which is why I am confused. You may need to file this as a bug with fedora35 since it works fine on a clean install

@vanheck
Copy link
Author

vanheck commented Dec 31, 2021

Apologize, the gif / or video file is from the previous comment (I refer to) (Originally posted by @yajo in #1910 ) - just for the describtion of the same behaviour.

But in my machine is installed by dnf install flameshot.

Have the flameshot app some cache or config (thats its not removed by dnf remove flameshot)?

@mmahmoudian mmahmoudian added the Linux Linux specific issue label Jan 1, 2022
@yajo
Copy link

yajo commented Jan 1, 2022

FWIW I use Fedora Silverblue 35, not just Fedora 35. I guess it shouldn't matter, but just in case...

@xvitaly
Copy link
Contributor

xvitaly commented Jan 1, 2022

You may need to file this as a bug with fedora35 since it works fine on a clean install

As a Fedora maintainer, I can't do anything with this in downstream. It works fine on my VM with Gnome after installing the xdg-desktop-portal-gnome package.

You should ask GNOME upstream, I think.

@vanheck
Copy link
Author

vanheck commented Jan 1, 2022

I filed the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2036411 and answer is to resolve the problem with Flameshot and Gnome upstream :/

Where can I ask Gnome upstream?

@xvitaly
Copy link
Contributor

xvitaly commented Jan 1, 2022

I filed the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2036411

Sorry, but I will close it as this is not a packaging issue and can't be fixed in downstream. It should be reported directly to GNOME/mutter.

Where can I ask Gnome upstream?

https://gitlab.gnome.org/GNOME/mutter/-/issues

@xvitaly
Copy link
Contributor

xvitaly commented Jan 1, 2022

Ubuntu has the same problem: #2199.

@borgmanJeremy
Copy link
Contributor

No that user simply didn't have the portals installed. I have no idea what's going on here. It works fine in a vm so until someone can explain to to make it occur there really is nothing I can do.

@vanheck
Copy link
Author

vanheck commented Jan 1, 2022

I've also try to dbus-monitor --session sender=org.flameshot.Flameshot, output is here (not sure if its heplful):

signal time=1641065874.865619 sender=org.freedesktop.DBus -> destination=:1.199 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.199"
signal time=1641065874.865742 sender=org.freedesktop.DBus -> destination=:1.199 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.199"
method call time=1641065877.761169 sender=:1.203 -> destination=org.freedesktop.DBus serial=15 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.a11y.Bus',arg1=''"
method call time=1641065877.761190 sender=:1.203 -> destination=org.freedesktop.DBus serial=16 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameHasOwner
   string "org.a11y.Bus"
method call time=1641065877.761237 sender=:1.203 -> destination=org.freedesktop.DBus serial=17 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.a11y.Bus'"
method call time=1641065877.761258 sender=:1.203 -> destination=org.freedesktop.DBus serial=18 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.a11y.Bus"
method call time=1641065877.761310 sender=:1.203 -> destination=org.a11y.Bus serial=19 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "ScreenReaderEnabled"
method call time=1641065877.761540 sender=:1.203 -> destination=org.a11y.Bus serial=20 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "IsEnabled"
method return time=1641065877.762345 sender=:1.203 -> destination=:1.200 serial=21 reply_serial=2
method call time=1641065877.764456 sender=:1.203 -> destination=org.freedesktop.portal.Desktop serial=22 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1641065877.765670 sender=:1.203 -> destination=org.freedesktop.DBus serial=23 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065877.765681 sender=:1.203 -> destination=org.freedesktop.DBus serial=24 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1641065877.765752 sender=:1.203 -> destination=org.freedesktop.DBus serial=25 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1641065877.765806 sender=:1.203 -> destination=org.freedesktop.DBus serial=26 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.portal.Desktop',path='/org/freedesktop/portal/desktop/request/1_203/203bdc933f6747efadcb0f475b0fd0d3',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1641065877.765812 sender=:1.203 -> destination=org.freedesktop.DBus serial=27 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065877.765824 sender=:1.203 -> destination=org.freedesktop.DBus serial=28 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1641065877.765885 sender=:1.203 -> destination=org.freedesktop.portal.Desktop serial=29 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "203bdc933f6747efadcb0f475b0fd0d3"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
method call time=1641065880.177295 sender=:1.203 -> destination=org.freedesktop.portal.Desktop serial=30 path=/org/freedesktop/portal/desktop/request/1_203/203bdc933f6747efadcb0f475b0fd0d3; interface=org.freedesktop.portal.Request; member=Close
method call time=1641065880.178117 sender=:1.203 -> destination=org.freedesktop.Notifications serial=31 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1641065880.179404 sender=:1.203 -> destination=org.freedesktop.DBus serial=32 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641065880.179559 sender=:1.203 -> destination=org.freedesktop.DBus serial=33 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1641065880.180202 sender=:1.203 -> destination=org.freedesktop.Notifications serial=34 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Informace Flameshot"
   string "Nelze zachytit obrazovku"
   array [
   ]
   array [
   ]
   int32 5000
method call time=1641065880.192888 sender=:1.203 -> destination=org.freedesktop.DBus serial=35 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641065880.192967 sender=:1.203 -> destination=org.freedesktop.DBus serial=36 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.portal.Desktop',path='/org/freedesktop/portal/desktop/request/1_203/203bdc933f6747efadcb0f475b0fd0d3',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1641065880.192987 sender=:1.203 -> destination=org.freedesktop.DBus serial=37 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065880.193007 sender=:1.203 -> destination=org.freedesktop.DBus serial=38 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065880.193092 sender=:1.203 -> destination=org.freedesktop.DBus serial=39 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641065880.193185 sender=:1.203 -> destination=org.freedesktop.DBus serial=40 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1641065880.193514 sender=:1.203 -> destination=org.freedesktop.Notifications serial=41 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Informace Flameshot"
   string "Nelze zachytit obrazovku"
   array [
   ]
   array [
   ]
   int32 5000
method call time=1641065880.200721 sender=:1.203 -> destination=org.freedesktop.DBus serial=42 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
signal time=1641065880.251421 sender=:1.203 -> destination=(null destination) serial=43 path=/; interface=org.flameshot.Flameshot; member=captureFailed
   uint32 4269929705

@vanheck
Copy link
Author

vanheck commented Jan 1, 2022

I opened the issue also here: https://gitlab.gnome.org/GNOME/mutter/-/issues/2072

@mmahmoudian
Copy link
Member

@vanheck

I opened the issue also here: > https://gitlab.gnome.org/GNOME/mutter/-/issues/2072

Aaaaand they closed it for you without even reading the basis of your report.

Thanks for taking the time to do this and report it upstream. Let's stay hopeful that they read your comment which you posted after they closed the ticket.

@vanheck
Copy link
Author

vanheck commented Jan 2, 2022

@vanheck

I opened the issue also here: > https://gitlab.gnome.org/GNOME/mutter/-/issues/2072

Aaaaand they closed it for you without even reading the basis of your report.

Thanks for taking the time to do this and report it upstream. Let's stay hopeful that they read your comment which you posted after they closed the ticket.

Ok, (probably due to my laziness) to use the other's video to preview similar behaviour. I didn't notice that output on the preview video is little bit different than in my case. Next time, I'll be better with filling the bug.

My video with the problem is here:
https://www.youtube.com/watch?v=s6Tbugr-QDw&ab_channel=JohnvanHeck

@vanheck
Copy link
Author

vanheck commented Jan 2, 2022

Could be a trouble here? https://gitlab.gnome.org/GNOME/mutter/-/issues/2072#note_1344961

Good point is that I have the screenshot files in path /home/vanheck/Obrázky/Screenshot-69.png (OS localized as cs_CZ) and not /home/vanheck/Obr%C3%A1zky/Screenshot-69.png.

@xvitaly
Copy link
Contributor

xvitaly commented Jan 2, 2022

@vanheck Can you try another directory with only Latin characters?

@vanheck
Copy link
Author

vanheck commented Jan 2, 2022

I'm not sure if I'm able to change this behaviour - the screenshot is saved into folder /home/vanheck/Obrázky imediately I click on the Share screen in the gnome dialog (this is probably default folder for gnome screenshots?) after flameshot gui command. In Flameshot I have set the default path /home/vanheck/Dokumenty:

obrazek

@vanheck
Copy link
Author

vanheck commented Jan 2, 2022

Yes, confirm, Flameshot works well if I change the default path for Pictures with Latin characters only (XDG_PICTURES_DIR in ~/.config/user-dirs.dirs).

@borgmanJeremy
Copy link
Contributor

Thanks for persisting and finding the root cause, that's something we can can fix.

@vanheck
Copy link
Author

vanheck commented Jan 2, 2022

@borgmanJeremy you’re welcome. Please, let me know when will be the fix released.

@vanheck
Copy link
Author

vanheck commented Jan 2, 2022

Another behaviour of Flameshot is: After flameshot gui, the screenshot picture is saved into XDG_PICTURES_DIR and when clicking on the Cancel button, the picture file persist in the XDG_PICTURES_DIR.

@karshPrime
Copy link

I filed the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2036411 and answer is to resolve the problem with Flameshot and Gnome upstream :/

Where can I ask Gnome upstream?

Can confirm its not a Gnome issue. Only today i switched from Arch Gnome to Fedora Gnome, and just like you I'm getting same issues on my fedora machine. flameshot gui worked as it should on my arch built but is giving me same error as you.

@yajo
Copy link

yajo commented Jan 3, 2022

Weird, I did the change from #2211 (comment) and log out, log in under Wayland. It works also!

I can also see #2211 (comment), before doing that.

What makes all this even more weird is that I configured a different save path that happens to not have non-ascii characters:

2022-01-03_07-44

But flameshot still writes those temporary files into XDG_PICTURES_DIR.

My guess is that temporary files should go into XDG_CACHE_DIR (besides supporting non-English use cases 😋 for XDG_PICTURES_DIR).

@vanheck
Copy link
Author

vanheck commented Jan 3, 2022

@gormih
the better would be whole dbus log, not only for Flameshot, dbus-monitor --session > dbus.log

@gormih
Copy link

gormih commented Jan 3, 2022

@vanheck
i try build the flameshot from current source code in this repository.
is worked normally.
I include video in in the near future

@vanheck
Copy link
Author

vanheck commented Jan 3, 2022

@yajo
I guess it is expected behaviour. Flameshot call the xdg API (xdg-desktop-portal-gnome) to take a screenshot and API capture screen then API save image in default path XDG_PICTURES_DIR and send the path to flameshot. Flameshot take the image on the path received from xdgAPI - create a new edited image and save on the path, you have set in the settings (and remove old picture from xdgAPI).

But there is a question: xdg capture the screen before I allow that (by clickcing on the Share button in gnome dialog) - is it the right behaviour? guess not... but it is another issue.

@vanheck
Copy link
Author

vanheck commented Jan 3, 2022

@gormih please check #2211 (comment) and #2211 (comment)

If you have in XDG_PICTURES_DIR Latin characters only (e.g. /home/user/Pictures), you have no problem with flameshot.

@gormih
Copy link

gormih commented Jan 3, 2022

@vanheck may be rename a title of issue with this fact?

@vanheck vanheck changed the title Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in xgd API path) Jan 3, 2022
@vanheck vanheck changed the title Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in xgd API path) Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in xdg API path) Jan 3, 2022
@vanheck vanheck changed the title Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in xdg API path) Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in XDG path) Jan 3, 2022
@sbstnk
Copy link

sbstnk commented Jan 3, 2022

Just to clarify my comments from the gnome issue: the problem simply is that https://github.com/flameshot-org/flameshot/blob/master/src/utils/screengrabber.cpp#L53 does remove(0, 7) instead of using something like QUrl::toLocalFile(). To track things like this down, you can request the full dbus-monitor --session logs from the user, this makes it quite obvious what is going wrong without being able to reproduce the issue locally.

The screenshot being stored to the XDG pictures folder is something that xdg-desktop-portal-gnome does and not something flameshot could change. It is also the only component that can be responsible for deleting it if the dialog got rejected, because the URI is not getting forwarded in that case. If you think it should store the file in a different location or delete it if the user denied the requesting application (such as flameshot) access to the screenshot, please file issues against it here: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues.

@borgmanJeremy
Copy link
Contributor

Thanks for summing it up nicely. We are going to ensure this is fixed before version 11 is released (currently in beta).

@borgmanJeremy
Copy link
Contributor

@vanheck you can test the artifacts from #2222

@vanheck
Copy link
Author

vanheck commented Jan 3, 2022

@vanheck you can test the artifacts from #2222

@borgmanJeremy
I've just built and test this branch... aaand... well done, it works. Thank you! .)

@borgmanJeremy
Copy link
Contributor

Great! I'll merge it. Thanks again for the deep dive. I often have a hard time finding these unicode bugs on my own.

@xvitaly
Copy link
Contributor

xvitaly commented Jan 3, 2022

@borgmanJeremy Do you think I should backport this PR to 0.10.2 for Fedora or just wait for the 0.11 release?

@borgmanJeremy
Copy link
Contributor

I'm going to wait for v11. There's a couple of minor issues left but should be done by the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux Linux specific issue Unconfirmed Bug The bug is not confirmed by anyone else.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants