[Bug 275311] New: XMP sidecars are not written for symbolic links

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] New: XMP sidecars are not written for symbolic links

Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311

           Summary: XMP sidecars are not written for symbolic links
           Product: digikam
           Version: 2.0.0
          Platform: Ubuntu Packages
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Metadata
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


Version:           2.0.0 (using KDE 4.6.2)
OS:                Linux

Because I am experimenting with using git-annex to store my photos, images in
my library are not regular files, but instead are symbolic links.  When I try
to modify metadata for these images, digikam silently does not write XMP
sidecar files, even though I have set "Write to XMP sidecar only".  The same
image, when copied to a new filename, does get an XMP sidecar written.

Reproducible: Always

Steps to Reproduce:
$ cp ~/image1.jpg ~/Pictures
$ ln -s ~/image2.jpg ~/Pictures

In Digikam, add a tag to bath image1 and image2.


Actual Results:  
~/Pictures/image1.jpg.xmp is created, but ~/Pictures/image2.jpg.xmp is not.  If
~/Pictures/image2.jpg.xmp existed already, it is unchanged.

Expected Results:  
~/Pictures/image1.jpg.xmp and ~/Pictures/image2.jpg.xmp are created containing
the tag that was just added.

I tried using kdebugdialog to turn on debugging output for digikam but I didn't
get any messages about XMP files.  On the other hand, I might have screwed up
using kdebugdialog.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links

Bugzilla from leif@dkstat.com
https://bugs.kde.org/show_bug.cgi?id=275311


Leif Huhn <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]




--- Comment #1 from Leif Huhn <leif dkstat com>  2011-07-09 05:24:07 ---
I'm having the exact same problem.

I think what's happening here is that Digikam tries to write the .xmp file in
the same directory as the real file.  Git-annex has arranged the file
permissions such that the real file exists in a directory without write
permission.  Digikam is probably silently failing when it tries to write the
.xmp.

This is a tricky one, because you could imagine another user using symbolic
links in such a way that they would want the sidecar to be written in the same
place as the real file (that is, the current behavior).

For now I'm planning on compiling digikam myself and finding the code that
notices symbolic links and changing it.  I'll let you know what I find.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links

Bugzilla from leif@dkstat.com
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311





--- Comment #2 from Leif Huhn <leif dkstat com>  2011-07-09 05:42:58 ---
I think this code in extra/libkexiv2/libkexiv2/kexiv2.cpp may be responsible:

    // ensure that symlinks are used correctly
    QString fileName = filePath;
    QFileInfo info(fileName);
    if (info.isSymLink())
    {
        kDebug() << "filePath" << filePath << "is a symlink."
                 << "Using target" << info.symLinkTarget();
        fileName = info.symLinkTarget();
    }

Unfortunately, the behavior we want is opposite of what the author of that code
wanted.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links

Bugzilla from leif@dkstat.com
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311





--- Comment #3 from Leif Huhn <leif dkstat com>  2011-07-09 06:47:52 ---
Interestingly, Digikam only follows one level of symlink.  It doesn't resolve
the symlinks all the way down (if you have symlinks pointing to symlinks).

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links

Bugzilla from leif@dkstat.com
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311





--- Comment #4 from Leif Huhn <leif dkstat com>  2011-07-09 14:41:48 ---
SVN commit 1196422 from bug 140175 comment #12 is responsible for this bug.  As
it turns out, they wanted to follow the symlink so that editing of symlinked
files would work properly (not so the sidecar would appear near the real file).

We could probably agree on a patch that causes the sidecar to appear near the
symlink.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links

Bugzilla from leif@dkstat.com
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311





--- Comment #5 from Leif Huhn <leif dkstat com>  2011-07-09 18:22:25 ---
Created an attachment (id=61730)
 --> (http://bugs.kde.org/attachment.cgi?id=61730)
Don't follow the symlink if we are writing to only the sidecar

Here's a patch that will avoid following the symlink if we are configured to
write to only the sidecar.  There is no point at all in following the symlink
if we aren't editing the tag on the image (since the whole point of following
the symlink is to edit the real file).

With this patch, you can use digikam with sidecars and git annex.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links [patch]

Gilles Caulier-4
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311


Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]
            Summary|XMP sidecars are not        |XMP sidecars are not
                   |written for symbolic links  |written for symbolic links
                   |                            |[patch]




--- Comment #6 from Gilles Caulier <caulier gilles gmail com>  2011-07-09 18:35:19 ---
Thanks. I will review your patch monday morning

Gilles Caulier

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links [patch]

Bugzilla from leif@dkstat.com
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311


Leif Huhn <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #61730|0                           |1
        is obsolete|                            |




--- Comment #7 from Leif Huhn <leif dkstat com>  2011-07-09 20:56:35 ---
Created an attachment (id=61734)
 --> (http://bugs.kde.org/attachment.cgi?id=61734)
Only follow the symlink when writing to the image file

Please ignore the previous patch (also ignore the comments about pass by
reference...I misread the original code).

This patch should be a proper fix for the problem.  Instead of traversing the
symlink when we load the metadata, we only resolve it when we save.  We only
use the resolved path when writing out the file (not when computing the path
for the sidecar).

This resolves more than one level of symlink.  It still does not handle the
situation where the sidecar is a symlink.

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links [patch]

Gilles Caulier-4
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311





--- Comment #8 from Gilles Caulier <caulier gilles gmail com>  2011-07-11 09:03:16 ---
Git commit 895fa43e61034daae00e70525d72482beeff1ca2 by Gilles Caulier.
Committed on 11/07/2011 at 10:58.
Pushed by cgilles into branch 'master'.

apply patch #61734 and #61736 from Leif Huhn to manage XMP sidecar and symbolic
links properlly
- If sidecar exists, still read size, mimetype, comments, exif, and iptc from
original image.
- Only follow the symlink when writing to the image file.
CCBUGS: 275311
CCBUGS: 272175

M  +83   -49   libkexiv2/kexiv2.cpp    

http://commits.kde.org/libkexiv2/895fa43e61034daae00e70525d72482beeff1ca2

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links [patch]

Gilles Caulier-4
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311


Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED




--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 275311] XMP sidecars are not written for symbolic links [patch]

Gilles Caulier-4
In reply to this post by Bugzilla from ethan@betacantrips.com
https://bugs.kde.org/show_bug.cgi?id=275311

Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Version Fixed In|                            |2.0.0

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel