Bug 439128 - Cannot save a resource with the same name/filename as a deactivatede resource
Summary: Cannot save a resource with the same name/filename as a deactivatede resource
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords: release_blocker
Depends on:
Blocks:
 
Reported: 2021-06-24 19:17 UTC by Alan North
Modified: 2021-08-13 11:53 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 Alan North 2021-06-24 19:17:34 UTC
STEPS TO REPRODUCE
1. Create new brush, name it something, for example "1". Save it.
2. Delete it.
3. Try to save a new brush with the same name "1".

OBSERVED RESULT
Nothing happens, brush does not appear in any lists.

In the log docker I see:

Resource "paintoppresets" "1.kpp" already exists in ...
Could not add resource "1.kpp" to the storage ""
Failed to add resource "1"

It seems the preset is not really deleted from my resources, only marked as deleted. Deleting it manually does not help because the database still thinks it's deleted.

EXPECTED RESULT

I can name a brush after a deleted brush. I wouldn't really expect the preset to be kept around in my resources folder either...

SOFTWARE/OS VERSIONS
Windows 10
Krita Nightly 4407898
Comment 1 Tiar 2021-06-24 19:25:39 UTC
Deleted resources are only marked as deleted so they disappear from the user's view. You can still check them out on Resource Manager. There should be a method to delete all "backup files" aka deleted resources and old versions of resources, but there isn't one yet.

Assuming we don't want to change the overall design, what do you think should happen in that case? Would it be fine if the resource name was "ResourceName" and the actual file name was "ResourceName (1).kpp" to keep it different from "ResourceName.kpp" which is still there? Or removing/replacing the old resource would be fine?
Comment 2 Bug Janitor Service 2021-07-09 04:33:44 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2021-07-24 04:33:27 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 4 Alan North 2021-07-25 02:47:34 UTC
I remarked it as REPORTED. Not sure if it should still be NEEDSINFO? It was sort of discussed outside of here, the main solution being renaming deleted resources to del_* or something like that. Ideally though, krita would also scan for manually deleted resources and remove them from the database.
Comment 5 Tiar 2021-07-25 18:36:11 UTC
> Ideally though, krita would also scan for manually deleted resources and remove them from the database.

Not sure if that's ideal, or rather, it would be fine but it would require user's input, which means new UI strings.

In any case, some changes has been made in https://invent.kde.org/graphics/krita/-/merge_requests/949 which might help in this case. I haven't tested this particular case, I think...
Comment 6 Alan North 2021-07-26 02:31:39 UTC
Ah, didn't know about the MR, I'll check if it's still a problem (along with some related bugs I filed) as soon as I can. There were some severe crashes on the last commit I tried to rebase my branch to so I reverted back to a weeks old build, will try again.

I totally get if the prompting to remove deleted resources has to wait, or if that's not the solution taken. For example, I think more easily allowing real deletion/modification will make it less likely for people to try to go the resources folder to do stuff. Just mentioning it so the potential issue isn't forgotten.
Comment 7 Halla Rempt 2021-08-12 09:52:38 UTC
I think we should simply re-activate the resource and save the "new" brush as the latest version of that resource.
Comment 8 Halla Rempt 2021-08-12 14:18:13 UTC
Git commit 5f4f6a27b91b52967df12fc3c94a36b57a4c6e8c by Halla Rempt.
Committed on 12/08/2021 at 14:13.
Pushed by rempt into branch 'rempt/version_deleted_resources'.

Make it possible to save a resource over a deleted resource

This creates a new version of a previously deactived resource when adding
a resource with the same md5, filename or name.

M  +1    -0    libs/resources/KisResourceCacheDb.cpp
M  +4    -0    libs/resources/KisResourceLocator.cpp
M  +17   -3    libs/resources/KisResourceModel.cpp
M  +11   -3    libs/resources/KisResourceModel.h
M  +11   -0    libs/resources/KoResource.cpp
M  +4    -0    libs/resources/KoResource.h
M  +16   -27   libs/ui/widgets/kis_workspace_chooser.cpp
M  +0    -3    libs/ui/widgets/kis_workspace_chooser.h

https://invent.kde.org/graphics/krita/commit/5f4f6a27b91b52967df12fc3c94a36b57a4c6e8c
Comment 9 Halla Rempt 2021-08-13 11:53:41 UTC
Git commit ffe085b25d18ae9069763d3e6fbd461c120b26b9 by Halla Rempt.
Committed on 13/08/2021 at 11:32.
Pushed by rempt into branch 'master'.

Make it possible to save a resource over a deleted resource

This creates a new version of a previously deactived resource when adding
a resource with the same md5, filename or name.

M  +1    -0    libs/resources/KisResourceCacheDb.cpp
M  +4    -0    libs/resources/KisResourceLocator.cpp
M  +17   -3    libs/resources/KisResourceModel.cpp
M  +11   -3    libs/resources/KisResourceModel.h
M  +11   -0    libs/resources/KoResource.cpp
M  +4    -0    libs/resources/KoResource.h
M  +16   -27   libs/ui/widgets/kis_workspace_chooser.cpp
M  +0    -3    libs/ui/widgets/kis_workspace_chooser.h

https://invent.kde.org/graphics/krita/commit/ffe085b25d18ae9069763d3e6fbd461c120b26b9