Bug 433984 - DigiKam does not save tags as hierarchical tags in Extended Attributes
Summary: DigiKam does not save tags as hierarchical tags in Extended Attributes
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Baloo (show other bugs)
Version: 7.2.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 08:08 UTC by tagwerk19
Modified: 2021-04-10 13:41 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2021-03-05 08:08:55 UTC
SUMMARY:

    If digiKam saves a heirarchical tag to the Extended Attributes, the
    tag is saved as a list of tag components 

STEPS TO REPRODUCE:

    On a system that supports Extended Attributes (such as Ext4, BTRFS)

    Tell digiKam that it should handle extended attributes, go to
    "Settings / Configure digiKam / Metadata / Baloo" and set: 

        Store metadata from digiKam in Baloo
        Read metadata from Baloo 

    and under "... / Metadata / Behaviour / Write this information
    to the Metadata", select: 

        Image tags
        Rating 

    and also under "... / Metadata / Behaviour / Reading and Writing
    Metadata", select: 

        Update file modification timestamp when files are modified
        Rescan file when files are modified

    Clear the selections under "... / Metadata / Advanced" for Tags
    and Ratings, on the basis that this is needed in order to write
    the tag/rating metadata back to the Extended Attributes 

    Create new test image, run digiKam and assign a tag "Parenttag/Mytag"
    to it (did this via "Captions", typing in the Tag in the "Tags" tab
    and saying the tag should be created under "/BalooTags")

    Check the tag as written to the filesystem:

        getfattr -d testfile.jpg 

OBSERVED RESULTS

    The tags are shown as two separate, rather than hierarchical tags

        # file: testfile.jpg
        user.xdg.tags="Mytag,ParentTag"

EXPECTED RESULTS

    A hierarchical tag is saved:

        # file: testfile.jpg
        user.xdg.tags="Parenttag/Mytag" 

SOFTWARE/OS VERSIONS

    Neon Unstable

    DigiKam : 7.2.0 (build date 2021-03-05)
    Plasma : 5.21.80
    Frameworks : 5.80.0
    Qt : 5.15.2

    Filesystem : Ext4 

ADDITIONAL INFORMATION

    A connected issue is that hierarchical tags read from the Extended
    Attributes are only partially written back when saved; "Parenttag/Mytag"
    is written back as "Mytag" and this overwrites the original xattr info
Comment 1 Maik Qualmann 2021-03-05 11:46:05 UTC
Git commit 7e9deba251739bcd3b2786e7c63eb8ad1556a24f by Maik Qualmann.
Committed on 05/03/2021 at 11:45.
Pushed by mqualmann into branch 'master'.

write hierarchical tags to Baloo
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +5    -5    core/libs/fileactionmanager/metadatahub.cpp
M  +3    -10   core/utilities/extrasupport/filesindexer/baloowrap.cpp

https://invent.kde.org/graphics/digikam/commit/7e9deba251739bcd3b2786e7c63eb8ad1556a24f
Comment 2 tagwerk19 2021-03-06 07:58:35 UTC
Checked with build 2021-03-06

That works so much better.

I can see two changes, hierarchical tags I create within digiKam are written as hierarchical tags to the extended attributes - so I see:

    # file: testfile.jpg
    user.xdg.tags="Parenttag/Mytag" 

I can set these tags in Dolphin/Gwenview, read them into digiKam and write them out and it works. A "full circle" test works.

I also notice that when digiKam reads the Extended Attribute Tags, they appear 'as given' in the Tag view, not prefixed by /BalooTags. I also do not need to create a new Tag under /BalooTags in order for it to be exported to the xattrs.

For me, that is a real improvement. Many thanks!

There might be an edge case when someone deletes tags within digiKam and expects the tags to be cleared when written to the xattr. Can check and log this as a separate issue
Comment 3 tagwerk19 2021-03-06 17:17:31 UTC
(In reply to tagwerk19 from comment #2)

> There might be an edge case when someone deletes tags within digiKam and
> expects the tags to be cleared when written to the xattr. Can check and log
> this as a separate issue
See bug 434060