Bug 447620 - Loss of Copywrite Templates
Summary: Loss of Copywrite Templates
Status: RESOLVED WORKSFORME
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Template (show other bugs)
Version: 7.3.0
Platform: Mint (Debian based) Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-28 23:01 UTC by cinfo
Modified: 2021-12-31 21:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.5.0
Sentry Crash Report:


Attachments
Screenshot of issue (175.82 KB, image/png)
2021-12-28 23:01 UTC, cinfo
Details
Template XML file for DigiKam (5.96 KB, text/xml)
2021-12-29 20:29 UTC, cinfo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cinfo 2021-12-28 23:01:03 UTC
Created attachment 144917 [details]
Screenshot of issue

STEPS TO REPRODUCE
1. Open digikam
2. Select image
3. View 'Information' tab

OBSERVED RESULT
Original templates are no longer available, but corresponding data is present.

EXPECTED RESULT
Original template should be available and selected.

SOFTWARE/OS VERSIONS
Linux: 
Linux Mint 20.2 
Qt Version:
5.x

ADDITIONAL INFORMATION
It has been observed that, in the core database, the image ids have overflown resulting in negative IDs.
Comment 1 caulier.gilles 2021-12-28 23:46:29 UTC
Hi,

Sounds like a database failure. Can you run digiKam from a console with the debug env. variable enabled as explained here :

https://www.digikam.org/contribute/

... and report the debug traces.

Gilles Caulier
Comment 2 Maik Qualmann 2021-12-29 06:55:31 UTC
The templates are saved under ~/.local/share/digikam/template.xml. Did you change something in the home directory?

Maik
Comment 3 Maik Qualmann 2021-12-29 07:06:10 UTC
Overflow of the image IDs? Which database type do you use (MySQL or SQLite)? If you are using MySQL and your database is very old, you should migrate to a new database. We changed the IDs in MySQL to BIGINT quite a long time ago. Otherwise it is difficult to imagine that you now had 9223372036854775807 images in the database.

Maik
Comment 4 cinfo 2021-12-29 09:33:04 UTC
(In reply to Maik Qualmann from comment #2)
> The templates are saved under ~/.local/share/digikam/template.xml. Did you
> change something in the home directory?
> 
> Maik

Not as far as I'm aware, the templates are still there in the .xml file. Is there some way I can re-link it?
Comment 5 cinfo 2021-12-29 10:17:25 UTC
(In reply to Maik Qualmann from comment #3)
> Overflow of the image IDs? Which database type do you use (MySQL or SQLite)?
> If you are using MySQL and your database is very old, you should migrate to
> a new database. We changed the IDs in MySQL to BIGINT quite a long time ago.
> Otherwise it is difficult to imagine that you now had 9223372036854775807
> images in the database.
> 
> Maik

Using SQLite, I just realised that I must've been misinterpreting the foreign keys of ImageID from the ImageInformation table as the primary keys of the Images table, so I suppose '-1' just means 'NULL' and not that there's an image with ID '-1'.
Sorry for the confusion!
Comment 6 Maik Qualmann 2021-12-29 12:48:28 UTC
If the template.xml file still exists, it must also be loaded by digiKam. Possible causes: An empty template.xml file exists in another possible search path for applications. The file is defective. You can also send me the template.xml, I then check it and repair them otherwise.

Maik
Comment 7 Maik Qualmann 2021-12-29 12:55:44 UTC
Another question, but we do not talk about a digiKam-7.3.0 Snap package under Debian? The Snap package from Ubuntu or Debian is unusable due to the sandbox used.

Maik
Comment 8 cinfo 2021-12-29 20:29:55 UTC
Created attachment 144943 [details]
Template XML file for DigiKam
Comment 9 cinfo 2021-12-29 20:32:24 UTC
(In reply to Maik Qualmann from comment #6)
> If the template.xml file still exists, it must also be loaded by digiKam.
> Possible causes: An empty template.xml file exists in another possible
> search path for applications. The file is defective. You can also send me
> the template.xml, I then check it and repair them otherwise.
> 
> Maik

Thank you very much for the offer! I couldn't find another template.xml file anywhere on the filesystem and have attached the file to this ticket. I also noticed that the date it was last modified was in October, which corresponds to when the problem started occurring.
I'm using the Flatpak installation provided by the Linux Mint Software Manager.
Comment 10 Maik Qualmann 2021-12-29 21:15:40 UTC
The template file is OK and is displayed here. We do not provide the Flatpak and I have never tested it, but it requires settings to the program rights. I suspect this is the problem. Please test our current pre-release AppImage digiKam-7.5.0 from here, which contains adjustments for Mint:

https://files.kde.org/digikam/

An AppImage only needs to be made executable and can be started directly. You should make a backup of the database in case you want to revert to an older digiKam version.

Maik
Comment 11 Maik Qualmann 2021-12-31 15:45:58 UTC
I suspect digiKam in Flatpak has no rights to your home directory, use Flatseal to set the rights or by command line: 

flatpak override digikam --filesystem=</home/$USER

Maik
Comment 12 cinfo 2021-12-31 20:18:40 UTC
(In reply to Maik Qualmann from comment #10)
> The template file is OK and is displayed here. We do not provide the Flatpak
> and I have never tested it, but it requires settings to the program rights.
> I suspect this is the problem. Please test our current pre-release AppImage
> digiKam-7.5.0 from here, which contains adjustments for Mint:
> 
> https://files.kde.org/digikam/
> 
> An AppImage only needs to be made executable and can be started directly.
> You should make a backup of the database in case you want to revert to an
> older digiKam version.
> 
> Maik

I couldn't get the Flatpak permissions to work, but the AppImage worked a treat.
Thank you very much for your assistance!