jwilk-archive/pdf2djvu

test-xmp-broken.test.test_no_verbatim: AssertionError: 'XMP metadata error: XMP Toolkit error 201: Error in XMLValidator\n' != …

Kamilcuk opened this issue · 3 comments

I am using archlinux with /usr/lib/libexiv2.so.27 $ pacman -Q exiv2 -> exiv2 0.27.5-1. The issue also affects other people: https://aur.archlinux.org/packages/pdf2djvu/ .

I get the following error when running tests:

$ pdf2djvu=../pdf2djvu LC_ALL=C PYTHON=2 nosetests2 -v test-xmp-broken.py
test-xmp-broken.test.test_no_verbatim ... FAIL
test-xmp-broken.test.test_verbatim ... ok

======================================================================
FAIL: test-xmp-broken.test.test_no_verbatim
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.py", line 30, in test_no_verbatim
    r.assert_(stderr='XMP metadata error: XMP Toolkit error 201: XML parsing failure\n')
  File "/home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/tools.py", line 98, in assert_
    assert_multi_line_equal(self.stderr, stderr)
AssertionError: 'XMP metadata error: XMP Toolkit error 201: Error in XMLValidator\n' != 'XMP metadata error: XMP Toolkit error 201: XML parsing failure\n'
- XMP metadata error: XMP Toolkit error 201: Error in XMLValidator
?                                            ---------   ^  ^^^^^
+ XMP metadata error: XMP Toolkit error 201: XML parsing failure
?                                               ^^ +++++++++ ^ +

-------------------- >> begin captured stdout << ---------------------
$ ../pdf2djvu -q /home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.pdf -o /home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.djvu --version
$ ../pdf2djvu -q /home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.pdf -o /home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.djvu

--------------------- >> end captured stdout << ----------------------

----------------------------------------------------------------------
Ran 2 tests in 0.335s

FAILED (failures=1)

The error happens on exiv2 side, and wasn't there before:

$ ,gdbbatchrun ../pdf2djvu -q /home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.pdf -o /home/kamil/.cache/yay/pdf2djvu/src/pdf2djvu-0.9.18.1/tests/test-xmp-broken.djvu
....
#2  0x00005555555686f4 in error_handler(int, char const*) ()
#3  0x00007ffff7605253 in Exiv2::LogMsg::~LogMsg() () from /usr/lib/libexiv2.so.27
#4  0x00007ffff7533e2f in ?? () from /usr/lib/libexiv2.so.27
#5  0x00005555555945a5 in xmp::transform(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pdf::Metadata const&) ()
#6  0x000055555557eb43 in xmain(int, char* const*) [clone .isra.0] ()
#7  0x0000555555568bf1 in main ()

Commit Exiv2/exiv2@b35cc5f changed error messages in exiv2 side. The test checks for wrong string - upstream changed. Is it possible to add regex in _assert or write two _assert? Or maybe choose the message depending on if ldd ../pdf2djvu | grep libexiv2 | sed 's/.*\.\([0-9]*\) =>.*/\1/' is greater than 26?

@edit Is it possible to add regex in _assert Well... so... so I added a pull request with the regex, it works on my part.

Works fine. It's fixed.

jwilk commented

Let's keep the issue open until it's fixed in a release.

jwilk commented

Fixed in 0.9.18.2.