Bug 421933 - Reopening unnamed autosave produces an error dialog
Summary: Reopening unnamed autosave produces an error dialog
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 4.3.0-beta1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-22 20:39 UTC by Anna Medonosova
Modified: 2021-08-13 09:57 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Medonosova 2020-05-22 20:39:29 UTC
SUMMARY
When opening an autosave of a previously unsaved document, Krita tries to save the autosave file to the Pictures directory. If the directory does not exist, the save operation fails.

STEPS TO REPRODUCE
1. Create a new document, do NOT save
2. Make some marks
3. Wait for autosave
4. Kill Krita
5. Reopen Krita
6. Click OK to recover the autosave

OBSERVED RESULT
The autosave file is opened, but it produces a dialog with following error:

Could not save [...home directory...]/Pictures/.krita-66481-document_0-autosave.kra
Reason: Cannot open file for writing. Reason: The file could not be opened.
Comment 1 Ahab Greybeard 2020-05-24 07:33:26 UTC
I have a non-standard location for the Pictures folder and in that situation, the autosave file is written into the Pictures folder.
(So where is the file path obtained from?)

If I then make a change to the image in krita and Save it to the desktop and Quit, the autosave file remains in the Pictures folder.
When I tried this, there was another autosave file in Pictures from a previous 'incident' in April.

This also happens with version 4.2.9.
Comment 2 Halla Rempt 2020-05-24 09:58:02 UTC
The last issue sounds like https://bugs.kde.org/show_bug.cgi?id=363971 ?
Comment 3 Halla Rempt 2020-05-24 10:02:14 UTC
Curious... I took over this issue from Tiar, because she's on vacation, but I cannot reproduce it.
Comment 4 Anna Medonosova 2020-05-24 20:55:12 UTC
I observed the issue while running the AppImage with isolated config and home directories for testing (https://invent.kde.org/snippets/741). In that case, XDG_PICTURES_DIR is set to system-wide default, which is $HOME/Pictures. However, the Pictures directory does not exist within the home dir.

Another option to trigger the error is to temporarily change XDG_PICTURES_DIR (on my Ubuntu it is in ~/.config/user-dirs.dirs).
Comment 5 Ahab Greybeard 2020-05-24 21:36:38 UTC
On debian 10 MATE, I've noticed that if you change XDG_PICTURES_DIR then you need to Kill Caja (it will restart) to update the folders to the user-dirs.dirs entries.

The autosave file in this situation is initially written to the $HOME folder. The question would be why is it moved to the Pictures folder after you say OK to opening it?
Also, why is it not deleted from there if you Save As after working on it?

This seems to be a more particular and Linux specific variant of https://bugs.kde.org/show_bug.cgi?id=363971
Comment 6 Halla Rempt 2020-05-25 11:36:52 UTC
Git commit d2047f00bdcf0ec2d56ff571a168e61c83b8a78b by Boudewijn Rempt.
Committed on 25/05/2020 at 11:35.
Pushed by rempt into branch 'krita/4.3'.

Don't use the autosave filename from unsaved documents as the proposed saving name

This also checks whether the Pictures folder really exists, and
uses the home folder if it doesn't.

M  +13   -4    libs/ui/KisMainWindow.cpp

https://invent.kde.org/graphics/krita/commit/d2047f00bdcf0ec2d56ff571a168e61c83b8a78b
Comment 7 Halla Rempt 2020-05-25 11:36:57 UTC
Git commit 2cd0fbba741f98447f30ad56419cf41badeb128c by Boudewijn Rempt.
Committed on 25/05/2020 at 11:36.
Pushed by rempt into branch 'master'.

Don't use the autosave filename from unsaved documents as the proposed saving name

This also checks whether the Pictures folder really exists, and
uses the home folder if it doesn't.
(cherry picked from commit d2047f00bdcf0ec2d56ff571a168e61c83b8a78b)

M  +13   -4    libs/ui/KisMainWindow.cpp

https://invent.kde.org/graphics/krita/commit/2cd0fbba741f98447f30ad56419cf41badeb128c
Comment 8 Halla Rempt 2021-08-13 09:57:40 UTC
Actually, that commit should have closed this bug...