After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 672833 - screenshot: fails to save the file if XDG picture dir does not exist
screenshot: fails to save the file if XDG picture dir does not exist
Status: RESOLVED FIXED
Product: gnome-screenshot
Classification: Core
Component: general
3.3.x
Other Linux
: Normal major
: ---
Assigned To: gnome-screenshot-maint
gnome-screenshot-maint
: 674616 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-03-26 09:08 UTC by Diego Escalante Urrelo (not reading bugmail)
Modified: 2020-11-26 16:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Diego Escalante Urrelo (not reading bugmail) 2012-03-26 09:08:34 UTC
I changed XDG_PICTURES_DIR today. To a new directory that did not exist.

Then I used GNOME Shell built in screenshot magic. The file was not saved, and no warning was provided. Creating the directory allowed screenshots to be saved.
Comment 1 Florian Müllner 2012-03-26 10:00:56 UTC
(In reply to comment #0)
> Then I used GNOME Shell built in screenshot magic.

Do you mean the DBus method? Or did you rather use gnome-screenshot (either directly or via the printScreen shortcut)?


> The file was not saved, and no warning was provided.

If you went through gnome-screenshot, this clearly is a bug - IMO the directory should be created if it doesn't exist yet. I'm not that sure though whether we should expect callers to take care of that or whether we should do it ourselves in the shell.

Cosimo, what do you think? Should we move the issue to gnome-screenshot?
Comment 2 Cosimo Cecchi 2012-03-26 13:11:40 UTC
(In reply to comment #1)

> If you went through gnome-screenshot, this clearly is a bug - IMO the directory
> should be created if it doesn't exist yet. I'm not that sure though whether we
> should expect callers to take care of that or whether we should do it ourselves
> in the shell.
> 
> Cosimo, what do you think? Should we move the issue to gnome-screenshot?

Yes, gnome-screenshot doesn't handle the case where XDG_PICTURES_DIR is missing.
Comment 3 Diego Escalante Urrelo (not reading bugmail) 2012-03-26 18:18:15 UTC
Oh I thought the shell had its own backend for this.

Well, I hit this by using the keyboard shortcut set in the Keyboard panel of control-center.
Comment 4 Florian Müllner 2012-03-26 18:34:43 UTC
(In reply to comment #3)
> Oh I thought the shell had its own backend for this.
> 
> Well, I hit this by using the keyboard shortcut set in the Keyboard panel of
> control-center.


Yeah, it's complicated :)

The keyboard shortcut is handled by gnome-settings-daemon, which calls gnome-screenshot, which uses a DBus method exported by the shell ...


(In reply to comment #2)
> (In reply to comment #1)
> > Cosimo, what do you think? Should we move the issue to gnome-screenshot?
> 
> Yes, gnome-screenshot doesn't handle the case where XDG_PICTURES_DIR is
> missing.

Right, and neither do gnome-shell or cairo (the actual file ends up being written by cairo_surface_write_to_png), so it's really a question of which layer is supposed to handle directory creation :)
Comment 5 Cosimo Cecchi 2012-03-26 20:46:08 UTC
(In reply to comment #4)

> Right, and neither do gnome-shell or cairo (the actual file ends up being
> written by cairo_surface_write_to_png), so it's really a question of which
> layer is supposed to handle directory creation :)

I think it's right to ensure the path exists at gnome-screenshot's level. I have a patch for this, just need to test it properly.
Comment 6 Tobias Wolf 2012-03-31 00:03:32 UTC
If it were still showing the useful dialog — like before — this wouldn’t be a problem.
Comment 7 Cosimo Cecchi 2012-04-16 18:25:34 UTC
I now pushed a fix for this to git master and gnome-3-4.
Comment 8 Emmanuele Bassi (:ebassi) 2020-11-26 16:20:42 UTC
*** Bug 674616 has been marked as a duplicate of this bug. ***