Bug #1275

Exiv2 0.26-svn issue with ExifTags class MPF tags UPSTREAM

Added by Wil Cowb 10 months ago. Updated 8 months ago.

Status:ClosedStart date:06 Feb 2017
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:apiEstimated time:5.00 hours
Target version:0.26

Description

Hello,

digiKam dev team came to the conclusion that exiv2 0.26 can't handle MPF tags well.

There are more details on the bug here:
https://bugs.kde.org/show_bug.cgi?id=375809

Should you have any questions please feel free to contact either myself or Gilles Caulier / Maik Qualmann

Associated revisions

Revision 4704
Added by Robin Mills 10 months ago

#1275 Fix submitted.

Revision 4705
Added by Robin Mills 10 months ago

#1275 Fix issue with Exiv2::Key.familyName() for key.ifdId_ == mpfId

History

#1 Updated by Robin Mills 10 months ago

  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Priority changed from High to Normal

Please provide a test file and describe the problem using the exiv2(.exe) sample application and the issue will be investigated.

#2 Updated by Wil Cowb 10 months ago

Robin Mills wrote:

Please provide a test file and describe the problem using the exiv2(.exe) sample application and the issue will be investigated.

Hello Robin,
Here is how to reproduce the exception:
"
The problem come from MPF Tags declared from group at Exiv2::tags.cpp::line 2166.
Typically, if i try to resume:
Exiv2::ExifKey(Exiv2::ExifData::Internal::mpfTagsList())
Generate the exception...
"
It's possible that the crash cannot be reproduced in Exiv2 CLI tool if method explained above is not used.
There is no need of an image to test this crash. In digiKam it happens when code extract all available Exiftags with details, descriptions, etc... for the library database.

#3 Updated by Robin Mills 10 months ago

I'm not sure I understand what this is about. No application should ever call anything in the Internal namespace.

I see that I added mpfTagList() in r4165 in support of #1105 and #1108, so I'm not denying that I am to blame. Inspecting the code in src/tags.cpp, I don't see anything significantly different about iopTagList and mpfTagList.

I don't understand your code Exiv2::ExifKey(Exiv2::ExifData::Internal::mpfTagsList()); What does that mean? Why would you call that and what do you expect to happen.

Can you help me to isolate this as I don't know what I'm looking for.

#4 Updated by Robin Mills 10 months ago

  • Category set to api
  • % Done changed from 0 to 30
  • Estimated time set to 3.00

I think I know what you're trying to do with:

Exiv2::ExifKey(Exiv2::ExifData::Internal::mpfTagsList());
Are you trying to call the constructor:
Exiv2::ExifKey(const TagInfo&)
The compiler has converted the mpfTagList() pointer into a reference. However, it's not a reference, it's a "C" array of TagInfo structures.

#5 Updated by Wil Cowb 10 months ago

Hello Robin,

I cannot answer you questions since I am just a digiKam user however I am trying to get Gilles @ digiKam dev team here.
I am pretty sure you are correct about the API call but I would wait for Gilles to confirm.
Thanks a lot for your patience.

Cheers,
Andrey

#6 Updated by Gilles Caulier 10 months ago

The method in digiKam where Exiv2 exception is generated is this one :

https://cgit.kde.org/digikam.git/tree/libs/dmetadata/metaengine_exif.cpp#n1068

especially in line :

https://cgit.kde.org/digikam.git/tree/libs/dmetadata/metaengine_exif.cpp#n1105

The goal of this function is to populate a map of Exif tags recognized by Exiv2 and to fill a list view in GUI to let's user to filter tags to show in Exif tags viewer.

This code in line 1105 work as expected with all Exif tags, excepted from MPF Exif group. The expected result must be the same for all Exif tags group...

My patch in digiKam ignore MPF group until Exiv2 is patched.

Gilles Caulier

#7 Updated by Robin Mills 10 months ago

  • % Done changed from 30 to 50

This team-work stuff really works. Well done, everybody. I know exactly what you're doing and there is something wrong here. I'm working on it.

Gilles: Your "band-aid" is sufficient to avoid my crasher, however you won't need it for long. I hope to fix this within an hour.

#8 Updated by Robin Mills 10 months ago

Fix submitted r4704. Gilles: Can you confirm that works for you and I'll close this.

#9 Updated by Gilles Caulier 10 months ago

[gilles@localhost exiv2]$ svn info
Path: .
Working Copy Root Path: /home/gilles/Devel/exiv2
URL: svn://dev.exiv2.org/svn/trunk
Relative URL: ^/trunk
Repository Root: svn://dev.exiv2.org/svn
Repository UUID: b7c8b350-86e7-0310-a4b4-de8f6a8f16a3
Revision: 4704
Node Kind: directory
Schedule: normal
Last Changed Author: robinwmills
Last Changed Rev: 4704
Last Changed Date: 2017-02-08 21:10:01 +0100 (Wed, 08 Feb 2017)

[gilles@localhost exiv2]$

Scanning dependencies of target exiv2
[ 94%] Building CXX object src/CMakeFiles/exiv2.dir/exiv2.cpp.o
[ 95%] Building CXX object src/CMakeFiles/exiv2.dir/actions.cpp.o
/home/gilles/Devel/exiv2/src/actions.cpp: In member function ‘int Action::Print::printTag(const Exiv2::ExifData&, Action::Print::EasyAccessFct, const string&) const’:
/home/gilles/Devel/exiv2/src/actions.cpp:514:42: error: no matching function for call to ‘Exiv2::Exifdatum::write(std::ostream&, const Exiv2::ExifData&) const’
md->write(std::cout, exifData);
^
In file included from /home/gilles/Devel/exiv2/include/exiv2/bmpimage.hpp:34:0,
from /home/gilles/Devel/exiv2/include/exiv2/exiv2.hpp:36,
from /home/gilles/Devel/exiv2/src/exiv2app.hpp:34,
from /home/gilles/Devel/exiv2/src/actions.hpp:40,
from /home/gilles/Devel/exiv2/src/actions.cpp:35:
/home/gilles/Devel/exiv2/include/exiv2/exif.hpp:182:23: note: candidate: virtual std::ostream& Exiv2::Exifdatum::write(std::ostream&, const Exiv2::ExifData*) const
std::ostream& write(std::ostream& os, const ExifData* pMetadata =0) const;
^
/home/gilles/Devel/exiv2/include/exiv2/exif.hpp:182:23: note: no known conversion for argument 2 from ‘const Exiv2::ExifData’ to ‘const Exiv2::ExifData*’
src/CMakeFiles/exiv2.dir/build.make:86: recipe for target 'src/CMakeFiles/exiv2.dir/actions.cpp.o' failed
make2: * [src/CMakeFiles/exiv2.dir/actions.cpp.o] Error 1
CMakeFiles/Makefile2:348: recipe for target 'src/CMakeFiles/exiv2.dir/all' failed
make1:
[src/CMakeFiles/exiv2.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *
* [all] Error 2

#10 Updated by Robin Mills 10 months ago

  • % Done changed from 50 to 80

I think you have a header file conflict. I think you're compiling with the wrong set of include files for the source code. Maybe you have 0.25 headers in /usr/include (or /usr/local/include) which are being used to compile the v0.26 code.

#11 Updated by Gilles Caulier 10 months ago

You want mean that /usr/include/ files from older Exiv2 install are used to compile a new one. This must never happen... Only local headers must be used to compile local Exiv2 source code, else it's the hell to manage.

To have compiled a lots of time eXiv2 since few month, it's the first time that i see this error.

Gilles

#12 Updated by Gilles Caulier 10 months ago

problem reproducible with a clean build directory and a re-configure from scratch (cmake)

Gilles Caulier

#13 Updated by Robin Mills 10 months ago

I agree that this shouldn't happen. However that is my diagnosis. Perhaps you've only been compiling the library. The message is arriving at the very end of the build when it's compiling/linking the sample applications including the exiv2(.exe) command-line program.

It is rather odd, the compiler says the header is: /home/gilles/Devel/exiv2/include/exiv2/exif.hpp. Perhaps you need to rebuild with something like:

make clean ; make

The code is good. I rebuild it frequently (with CMake and ./configure) and so does the build server. I'll build it clean in the next few minutes.

Can I access your machine with SSH and have a look?

#14 Updated by Gilles Caulier 10 months ago

make clean ; make

==> I already cleaned build directory which is typically the best way to be sure that all is done from scratch.

Gilles

#15 Updated by Gilles Caulier 10 months ago

No ssh access here. There is a FW where i cannot admin to open a port...

Gilles

#16 Updated by Gilles Caulier 10 months ago

I take another VM and build is fine now. I don't know why build is broken on another one.

Testing now.

Gilles

#17 Updated by Gilles Caulier 10 months ago

I just tested with you last patches, and this do not fix the problem :

digikam.metaengine: Cannot get Exif Tags list using Exiv2 (Error # 23 : Invalid ifdId 8

The exception still here...

Gilles

#18 Updated by Robin Mills 10 months ago

That's odd. I added the following code (based on your code) to exiv2.cpp and it runs smoothly with the command $ exiv2 -h . Here's the code:

// *****************************************************************************
// Main
int main(int argc, char* const argv[])
{
#ifdef EXV_ENABLE_NLS
    setlocale(LC_ALL, "");
    bindtextdomain(EXV_PACKAGE, EXV_LOCALEDIR);
    textdomain(EXV_PACKAGE);
#endif

    const Exiv2::GroupInfo* gi = Exiv2::ExifTags::groupList();
    while (gi->tagList_ != 0)
    {
        Exiv2::TagListFct tl     = gi->tagList_;
        const Exiv2::TagInfo* ti = tl();

        while (ti->tag_ != 0xFFFF)
        {
            std::cout << ti->title_ << std::endl;
            ++ti;
        }
        ++gi;
    }
And here's the output from my build (done with CMake/Xcode on the Mac):
720 rmills@rmillsmbp:~/gnu/exiv2/trunk/build $ bin/Debug/exiv2 -h | grep MPF
MPFVersion
MPFNumberOfImages
MPFImageList
MPFImageUIDList    
MPFTotalFrames
MPFIndividualNum
MPFPanOrientation
MPFPanOverlapH
MPFPanOverlapV
MPFBaseViewpointNum
MPFConvergenceAngle
MPFBaselineLength
MPFVerticalDivergence
MPFAxisDistanceX
MPFAxisDistanceY
MPFAxisDistanceZ
MPFYawAngle
MPFPitchAngle
MPFRollAngle
721 rmills@rmillsmbp:~/gnu/exiv2/trunk/build $ 

#19 Updated by Robin Mills 10 months ago

  • Estimated time changed from 3.00 to 5.00

I've submitted a fix for this: r4705

The modified code in exiv2.cpp (which will not be submitted) is:

// *****************************************************************************
// Main
int main(int argc, char* const argv[])
{
#ifdef EXV_ENABLE_NLS
    setlocale(LC_ALL, "");
    bindtextdomain(EXV_PACKAGE, EXV_LOCALEDIR);
    textdomain(EXV_PACKAGE);
#endif

    // #1275
    const Exiv2::GroupInfo* gi = Exiv2::ExifTags::groupList();
    while (gi->tagList_ != 0)
    {
        Exiv2::TagListFct tl     = gi->tagList_;
        const Exiv2::TagInfo* ti = tl();

        while (ti->tag_ != 0xFFFF)
        {
            Exiv2::ExifKey key(*ti);
            std::cout << key.familyName() << "." 
                      << key.groupName()  << "." 
                      << key.tagName()    << std::endl;
            ++ti;
        }
        ++gi;
    }
    if ( argc == 1 ) exit(0);
And here it's working:
768 rmills@rmillsmbp:~/gnu/exiv2/trunk $ build/bin/Debug/exiv2 | grep MPF
Exif.MpfInfo.MPFVersion
Exif.MpfInfo.MPFNumberOfImages
Exif.MpfInfo.MPFImageList
Exif.MpfInfo.MPFImageUIDList
Exif.MpfInfo.MPFTotalFrames
Exif.MpfInfo.MPFIndividualNum
Exif.MpfInfo.MPFPanOrientation
Exif.MpfInfo.MPFPanOverlapH
Exif.MpfInfo.MPFPanOverlapV
Exif.MpfInfo.MPFBaseViewpointNum
Exif.MpfInfo.MPFConvergenceAngle
Exif.MpfInfo.MPFBaselineLength
Exif.MpfInfo.MPFVerticalDivergence
Exif.MpfInfo.MPFAxisDistanceX
Exif.MpfInfo.MPFAxisDistanceY
Exif.MpfInfo.MPFAxisDistanceZ
Exif.MpfInfo.MPFYawAngle
Exif.MpfInfo.MPFPitchAngle
Exif.MpfInfo.MPFRollAngle
769 rmills@rmillsmbp:~/gnu/exiv2/trunk $ 

#20 Updated by Gilles Caulier 10 months ago

  • Status changed from Assigned to Resolved
  • % Done changed from 80 to 100

I recompile all digiKam and i confirm that commit #4705 fix the problem.

Gilles

#21 Updated by Robin Mills 10 months ago

  • Status changed from Resolved to Closed

Thanks for letting me know, Gilles. I'm going to close this issue.

#22 Updated by Robin Mills 9 months ago

  • Assignee changed from Robin Mills to Gilles Caulier

#23 Updated by Robin Mills 8 months ago

  • Assignee changed from Gilles Caulier to Robin Mills

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux