Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby-poppler test failure with poppler 0.63.0 #1159

Closed
dai-vdr opened this issue Apr 23, 2018 · 6 comments
Closed

ruby-poppler test failure with poppler 0.63.0 #1159

dai-vdr opened this issue Apr 23, 2018 · 6 comments

Comments

@dai-vdr
Copy link
Contributor

dai-vdr commented Apr 23, 2018

forwarded from https://bugs.debian.org/896596


...
Started
......................Poppler-INFO **: Syntax error at position -1: Document stream is empty
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `block (2 levels) in load_constructor_infos'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/lib/poppler/document.rb:58:in `initialize'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-document.rb:10:in `new'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-document.rb:10:in `test_data'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:793:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:499:in `block (2 levels) in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:270:in `block in create_fixtures_runner'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:270:in `block in create_fixtures_runner'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:251:in `run_fixture'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:286:in `run_setup'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:497:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:496:in `catch'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:496:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:67:in `run_suite'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:45:in `block (2 levels) in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:102:in `with_listener'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:41:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:39:in `catch'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:39:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:40:in `start_mediator'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:25:in `start'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnerutilities.rb:24:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:435:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:491:in `change_work_directory'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:434:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:62:in `run'
	from test/run-test.rb:56:in `<main>'
E
===============================================================================
Error: test_data(TestDocument::#initialize): Poppler::Error::Invalid: Failed to load document
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `invoke'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `block (2 levels) in load_constructor_infos'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/lib/poppler/document.rb:58:in `initialize'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-document.rb:10:in `new'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-document.rb:10:in `test_data'
      7:       context.show_text("Hello")
      8:       surface.finish
      9: 
  => 10:       document = Poppler::Document.new(:data => pdf.string)
     11:       assert_equal("Hello", document[0].text)
     12:     end
     13:   end
===============================================================================
.........Poppler-INFO **: Syntax error at position -1: Document stream is empty
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `block (2 levels) in load_constructor_infos'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/lib/poppler/document.rb:58:in `initialize'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `new'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `create_document'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:109:in `test_exist'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:793:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:499:in `block (2 levels) in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:270:in `block in create_fixtures_runner'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:270:in `block in create_fixtures_runner'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:251:in `run_fixture'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:286:in `run_setup'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:497:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:496:in `catch'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:496:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:67:in `run_suite'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:45:in `block (2 levels) in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:102:in `with_listener'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:41:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:39:in `catch'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:39:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:40:in `start_mediator'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:25:in `start'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnerutilities.rb:24:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:435:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:491:in `change_work_directory'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:434:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:62:in `run'
	from test/run-test.rb:56:in `<main>'
E
===============================================================================
Error: test_exist(TestPage::#thumbnail_size): Poppler::Error::Invalid: Failed to load document
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `invoke'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `block (2 levels) in load_constructor_infos'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/lib/poppler/document.rb:58:in `initialize'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `new'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `create_document'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:109:in `test_exist'
     106: 
     107:     def test_exist
     108:       only_cairo_version(1, 15, 4)
  => 109:       document = create_document do |surface|
     110:         surface.set_thumbnail_size(5, 10)
     111:       end
     112:       page = document[0]
===============================================================================Poppler-INFO **: Syntax error at position -1: Document stream is empty
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `block (2 levels) in load_constructor_infos'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/lib/poppler/document.rb:58:in `initialize'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `new'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `create_document'
	from /tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:117:in `test_not_exist'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:793:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:499:in `block (2 levels) in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:270:in `block in create_fixtures_runner'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:270:in `block in create_fixtures_runner'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:251:in `run_fixture'
	from /usr/lib/ruby/vendor_ruby/test/unit/fixture.rb:286:in `run_setup'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:497:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:496:in `catch'
	from /usr/lib/ruby/vendor_ruby/test/unit/testcase.rb:496:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:124:in `run_test'
	from /usr/lib/ruby/vendor_ruby/test/unit/testsuite.rb:53:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:67:in `run_suite'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:45:in `block (2 levels) in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:102:in `with_listener'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:41:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:39:in `catch'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnermediator.rb:39:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:40:in `start_mediator'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunner.rb:25:in `start'
	from /usr/lib/ruby/vendor_ruby/test/unit/ui/testrunnerutilities.rb:24:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:435:in `block in run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:491:in `change_work_directory'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:434:in `run'
	from /usr/lib/ruby/vendor_ruby/test/unit/autorunner.rb:62:in `run'
	from test/run-test.rb:56:in `<main>'

E
===============================================================================
Error: test_not_exist(TestPage::#thumbnail_size): Poppler::Error::Invalid: Failed to load document
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `invoke'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/gobject-introspection/lib/gobject-introspection/loader.rb:317:in `block (2 levels) in load_constructor_infos'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/lib/poppler/document.rb:58:in `initialize'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `new'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:98:in `create_document'
/tmp/autopkgtest-lxc.tw7vr2na/downtmp/build.m7f/src/poppler/test/test-page.rb:117:in `test_not_exist'
     114:     end
     115: 
     116:     def test_not_exist
  => 117:       document = create_document
     118:       page = document[0]
     119:       assert_nil(page.thumbnail_size)
     120:     end
===============================================================================
....

Finished in 0.48902299 seconds.
------
38 tests, 63 assertions, 0 failures, 3 errors, 0 pendings, 0 omissions, 0 notifications
92.1053% passed
------
77.71 tests/s, 128.83 assertions/s
Failed to run test: poppler
--------------------------------------------------------------------------------
Failed targets: poppler
@dai-vdr dai-vdr changed the title ruby-popper test failure with poppler 0.63.0 ruby-poppler test failure with poppler 0.63.0 Apr 23, 2018
@kou
Copy link
Member

kou commented Apr 28, 2018

I think that this is a poppler-glib problem.

Poppler adds getLength() check at https://cgit.freedesktop.org/poppler/poppler/commit/?id=a59f61641fcb36859b625749afb4561557e419f6 for https://bugs.freedesktop.org/show_bug.cgi?id=103552 .
But PopplerInputStream created by poppler-glib always returns 0 for getLength(): https://cgit.freedesktop.org/poppler/poppler/tree/glib/poppler-document.cc#n301

I think that poppler-glib computes length in poppler_document_new_from_stream() and specifies the length to PopplerInputStream.

Can you re-report it to poppler-glib?

@kou
Copy link
Member

kou commented Apr 28, 2018

We'll be able to compute length by g_seekable_seek(0, G_SEEK_END) and g_seekable_tell().

@kou
Copy link
Member

kou commented Apr 28, 2018

Ah, we can just use the length passed by argument:

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index b343eb90..504042cd 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -298,7 +298,7 @@ poppler_document_new_from_stream (GInputStream *stream,
   }
 
   if (stream_is_memory_buffer_or_local_file(stream)) {
-    str = new PopplerInputStream(stream, cancellable, 0, gFalse, 0, Object(objNull));
+    str = new PopplerInputStream(stream, cancellable, 0, gFalse, length, Object(objNull));
   } else {
     CachedFile *cachedFile = new CachedFile(new PopplerCachedFileLoader(stream, cancellable, length), new GooString());
     str = new CachedFileStream(cachedFile, 0, gFalse, cachedFile->getLength(), Object(objNull));

@kou kou closed this as completed in ca96495 Apr 28, 2018
@kou
Copy link
Member

kou commented Apr 28, 2018

I've pushed workaround for now.
It should be removed when poppler-glib fixes this problem.

@dai-vdr
Copy link
Contributor Author

dai-vdr commented Apr 29, 2018

@kou
Copy link
Member

kou commented Apr 29, 2018

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants