[BUG] x11/mate/atril: EPUBs can't be read

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[BUG] x11/mate/atril: EPUBs can't be read

Lari Rasku
cc ajacoutot@ in case he has something to say re: the webkit errors
and debugging (bottom).

libepubdocument uses the (Linux-only?) {ftello,fseeko,fopen}64
functions, so trying to open an EPUB results in the following console
prints (and the misleading GUI error message "File type electronic
book document (application/epub+zip) is not supported"):

        atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'ftello64'
        atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'fseeko64'
        atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'fopen64'

        (atril:26401): AtrilDocument-WARNING **: Cannot load specified object

        (atril:26401): AtrilDocument-WARNING **: Cannot load backend 'epubdocument' since file '/usr/local/lib/atril/3/backends/libepubdocument.so' cannot be read.

This is easy to fix with the following (crude) patch:

diff --git x11/mate/atril/patches/patch-backend_epub_minizip_ioapi_h x11/mate/atril/patches/patch-backend_epub_minizip_ioapi_h
new file mode 100644
index 000000000..ba014a61d
--- /dev/null
+++ x11/mate/atril/patches/patch-backend_epub_minizip_ioapi_h
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: backend/epub/minizip/ioapi.h
+--- backend/epub/minizip/ioapi.h.orig
++++ backend/epub/minizip/ioapi.h
+@@ -50,7 +50,7 @@
+ #define ftello64 ftell
+ #define fseeko64 fseek
+ #else
+-#ifdef __FreeBSD__
++#ifdef __OpenBSD__
+ #define fopen64 fopen
+ #define ftello64 ftello
+ #define fseeko64 fseeko

Now EPUB files load, but they only show blank pages.  The following
error prints appear on the console:

        (atril:65545): GLib-GObject-WARNING **: value "-538976290" of type 'gint' is invalid or out of range for property 'page' of type 'gint'

        (atril:65545): GLib-GObject-WARNING **: value "-538976290" of type 'gint' is invalid or out of range for property 'page' of type 'gint'

        (atril:65545): GLib-GObject-WARNING **: value "-538976290" of type 'gint' is invalid or out of range for property 'page' of type 'gint'

        (atril:65545): Gtk-WARNING **: Allocating size to EvSidebar 0xd7a580d7f60 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?

        (atril:65545): AtrilView-WARNING **: Error loading data from file:///tmp/atril-65545/Metamorphosis-jackson.epubUWLRAZ/OEBPS/front-cover.html: Frame load interrupted

The last one is, I believe, the relevant one, but it comes from the
depths of webkitgtk4, and my attempts to debug it were stymied by my
failure to get the port to compile with debug symbols, which is
apparently a long-term unresolved issue for the library [1].

[1]: https://bugs.webkit.org/show_bug.cgi?id=140384

Reply | Threaded
Open this post in threaded view
|

Re: [BUG] x11/mate/atril: EPUBs can't be read

Rafael Sadowski
On Wed Jan 10, 2018 at 08:59:45PM +0200, Lari Rasku wrote:

> cc ajacoutot@ in case he has something to say re: the webkit errors
> and debugging (bottom).
>
> libepubdocument uses the (Linux-only?) {ftello,fseeko,fopen}64
> functions, so trying to open an EPUB results in the following console
> prints (and the misleading GUI error message "File type electronic
> book document (application/epub+zip) is not supported"):
>
> atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'ftello64'
> atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'fseeko64'
> atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'fopen64'
>
> (atril:26401): AtrilDocument-WARNING **: Cannot load specified object
>
> (atril:26401): AtrilDocument-WARNING **: Cannot load backend 'epubdocument' since file '/usr/local/lib/atril/3/backends/libepubdocument.so' cannot be read.
>
> This is easy to fix with the following (crude) patch:
>
> diff --git x11/mate/atril/patches/patch-backend_epub_minizip_ioapi_h x11/mate/atril/patches/patch-backend_epub_minizip_ioapi_h
> new file mode 100644
> index 000000000..ba014a61d
> --- /dev/null
> +++ x11/mate/atril/patches/patch-backend_epub_minizip_ioapi_h
> @@ -0,0 +1,14 @@
> +$OpenBSD$
> +
> +Index: backend/epub/minizip/ioapi.h
> +--- backend/epub/minizip/ioapi.h.orig
> ++++ backend/epub/minizip/ioapi.h
> +@@ -50,7 +50,7 @@
> + #define ftello64 ftell
> + #define fseeko64 fseek
> + #else
> +-#ifdef __FreeBSD__
> ++#ifdef __OpenBSD__

I would prefer:

if defined(__OpenBSD__) || defined(__FreeBSD__)

Anyway I like your commitment to x11/mate/*. Don't worry I quite sure
your diffs will find their way into the tree. You could report them
upstream.

Rafael

Reply | Threaded
Open this post in threaded view
|

Re: [BUG] x11/mate/atril: EPUBs can't be read

Lari Rasku
In reply to this post by Lari Rasku
On 01/10/18 20:59, Lari Rasku wrote:
> atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'ftello64'
> atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'fseeko64'
> atril:/usr/local/lib/atril/3/backends/libepubdocument.so: undefined symbol 'fopen64'
>
> (atril:26401): AtrilDocument-WARNING **: Cannot load specified object
>
> (atril:26401): AtrilDocument-WARNING **: Cannot load backend 'epubdocument' since file '/usr/local/lib/atril/3/backends/libepubdocument.so' cannot be read.
>
> This is easy to fix with the following (crude) patch:

I forgot to mention that a patch isn't the only way to fix this:
the atril source does define two feature test macros to gate the use
of the 64-bit functions, IOAPI_NO_64 and USE_FILE32API, but I don't
know what the preferred way to set them in a port Makefile would be.
Adding CPPFLAGS=-DIOAPI_NO_64 to CONFIGURE_ARGS overrides the
infrastructure-provided CPPFLAGS value and results in a broken build,
whereas adding it to CONFIGURE_ENV just gets it overridden by the
infrastructure-provided values in turn.  In situations like this, is
a patch like the above preferable to duplicating the default
CONFIGURE_ARGS CPPFLAGS values in the port Makefile?

But as Rafael suggested I'll also report this upstream.

Reply | Threaded
Open this post in threaded view
|

Re: [BUG] x11/mate/atril: EPUBs can't be read

Lari Rasku
For the archives, the build patch has now been merged upstream [1].
The issue with blank pages turned out to be a known open one [2].

[1]: https://github.com/mate-desktop/atril/issues/290
[2]: https://github.com/mate-desktop/atril/issues/125