Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: at...@packages.debian.org
Control: affects -1 + src:atril

While preparing a new upstream release upload of atril 1.26.1-1 to
unstable (already some days ago), a bookwork-pu upload has (now) also
been prepared.

[ Reason ]
Upstream fixed two issues regarding epub file opening robustness in
v1.26.1. Also, one patch could be cherry-picked from a bug report in
Debian BTS (#972715).

Additionally, the 'Hide sidebar' button was lacking a11y text which has
also now been added.

[ Impact ]
Impact of rejecting this bookworm-pu is low. Outcome: Less epub
robustness, a11y text for 'Hide sidebar' remains missing.

[ Tests ]
Manually (build and test on local bookworm system).

[ Risks ]
Regressions are always possible. Atril is used as PDF reader in MATE and
Xfce4, so those users will be affected.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]

+  * debian/patches:
+    + Add 1002-avoid-crash-on-certain-epub-files.patch. Avoid crashes when
+      opening certain epub files. (Closes: #972715).
+    + Add 0001-Accessibility-add-button-description.patch. Accessibility: add
+      'Hide sidebar' button description. (Cherry-picked from v1.26.1).
+    + Add 0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch. Fix
+      index loading for certain epub documents. (Cherry-picked from v1.26.1).
+    + Add 0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch. 
epub:
+      add fallback for malformed epub files in check_mime_type. (Cherry-picked 
from
+      v1.26.1).

[ Other info ]
None.
diff -Nru atril-1.26.0/debian/changelog atril-1.26.0/debian/changelog
--- atril-1.26.0/debian/changelog       2022-10-27 11:00:10.000000000 +0200
+++ atril-1.26.0/debian/changelog       2024-01-06 07:18:28.000000000 +0100
@@ -1,3 +1,18 @@
+atril (1.26.0-2+deb12u1) bookworm; urgency=medium
+
+  * debian/patches:
+    + Add 1002-avoid-crash-on-certain-epub-files.patch. Avoid crashes when
+      opening certain epub files. (Closes: #972715).
+    + Add 0001-Accessibility-add-button-description.patch. Accessibility: add
+      'Hide sidebar' button description. (Cherry-picked from v1.26.1).
+    + Add 0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch. Fix
+      index loading for certain epub documents. (Cherry-picked from v1.26.1).
+    + Add 0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch. 
epub:
+      add fallback for malformed epub files in check_mime_type. (Cherry-picked 
from
+      v1.26.1).
+
+ -- Mike Gabriel <sunwea...@debian.org>  Sat, 06 Jan 2024 07:18:28 +0100
+
 atril (1.26.0-2) unstable; urgency=medium
 
   [ Mike Gabriel ]
diff -Nru 
atril-1.26.0/debian/patches/0001-Accessibility-add-button-description.patch 
atril-1.26.0/debian/patches/0001-Accessibility-add-button-description.patch
--- atril-1.26.0/debian/patches/0001-Accessibility-add-button-description.patch 
1970-01-01 01:00:00.000000000 +0100
+++ atril-1.26.0/debian/patches/0001-Accessibility-add-button-description.patch 
2024-01-06 07:18:28.000000000 +0100
@@ -0,0 +1,47 @@
+From 9a981607b36488ea5d2ce8646540b1545e35ecd5 Mon Sep 17 00:00:00 2001
+From: Valentin Villenave <vvillen...@hypra.fr>
+Date: Tue, 26 Oct 2021 19:29:01 +0200
+Subject: [PATCH 01/10] Accessibility: add button description
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ po/POTFILES.in     | 1 +
+ shell/ev-sidebar.c | 3 +++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/po/POTFILES.in b/po/POTFILES.in
+index 02b9435..08ab5ec 100644
+--- a/po/POTFILES.in
++++ b/po/POTFILES.in
+@@ -67,6 +67,7 @@ shell/ev-password-view.c
+ shell/ev-properties-dialog.c
+ shell/ev-properties-fonts.c
+ shell/ev-properties-license.c
++shell/ev-sidebar.c
+ shell/ev-sidebar-annotations.c
+ shell/ev-sidebar-attachments.c
+ shell/ev-sidebar-bookmarks.c
+diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c
+index b9173cd..0cdb6be 100644
+--- a/shell/ev-sidebar.c
++++ b/shell/ev-sidebar.c
+@@ -26,6 +26,8 @@
+ 
+ #include <string.h>
+ 
++#include <glib.h>
++#include <glib/gi18n.h>
+ #include <gtk/gtk.h>
+ #include <gdk/gdkkeysyms.h>
+ 
+@@ -362,6 +364,7 @@ ev_sidebar_init (EvSidebar *ev_sidebar)
+       g_signal_connect (close_button, "clicked",
+                         G_CALLBACK (ev_sidebar_close_clicked_cb),
+                         ev_sidebar);
++      gtk_widget_set_tooltip_text (close_button, _("Hide sidebar"));
+ 
+       image = gtk_image_new_from_icon_name ("window-close",
+                                             GTK_ICON_SIZE_MENU);
+-- 
+2.39.2
+
diff -Nru 
atril-1.26.0/debian/patches/0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch
 
atril-1.26.0/debian/patches/0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch
--- 
atril-1.26.0/debian/patches/0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch
 1970-01-01 01:00:00.000000000 +0100
+++ 
atril-1.26.0/debian/patches/0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch
 2024-01-06 07:18:28.000000000 +0100
@@ -0,0 +1,38 @@
+From 9f5d7343f79f6ff8295884df3229bc6696b4386c Mon Sep 17 00:00:00 2001
+From: Michael Webster <miketwebs...@gmail.com>
+Date: Mon, 18 Jul 2022 10:43:47 -0400
+Subject: [PATCH 03/10] epub: Fix index loading for certain documents - look
+ for epub:type instead of epub:id.
+
+Add a null check as well.
+
+ref:
+https://help.apple.com/itc/booksassetguide/en.lproj/itc0f175a5b9.html#apdd3c4c6d1c0904
+https://idpf.org/epub/301/spec/epub-contentdocs-20140626.html#sec-xhtml-nav
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ backend/epub/epub-document.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c
+index 52530f4..385d2fe 100644
+--- a/backend/epub/epub-document.c
++++ b/backend/epub/epub-document.c
+@@ -1201,7 +1201,13 @@ setup_index_from_navfile(gchar *tocpath)
+     GList *index = NULL;
+     open_xml_document(tocpath);
+     set_xml_root_node(NULL);
+-    xmlNodePtr nav = 
xml_get_pointer_to_node((xmlChar*)"nav",(xmlChar*)"id",(xmlChar*)"toc");
++    xmlNodePtr nav = 
xml_get_pointer_to_node((xmlChar*)"nav",(xmlChar*)"type",(xmlChar*)"toc");
++
++    if (nav == NULL) {
++        xml_free_doc();
++        return NULL;
++    }
++
+     xmlretval=NULL;
+     xml_parse_children_of_node(nav,(xmlChar*)"ol", NULL,NULL);
+     gchar *navdirend = g_strrstr(tocpath,"/");
+-- 
+2.39.2
+
diff -Nru 
atril-1.26.0/debian/patches/0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch
 
atril-1.26.0/debian/patches/0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch
--- 
atril-1.26.0/debian/patches/0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch
 1970-01-01 01:00:00.000000000 +0100
+++ 
atril-1.26.0/debian/patches/0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch
 2024-01-06 07:18:28.000000000 +0100
@@ -0,0 +1,98 @@
+From c585b945d27e883908c437d12aa9c453db2143f4 Mon Sep 17 00:00:00 2001
+From: rbuj <robert....@gmail.com>
+Date: Sun, 7 Aug 2022 23:08:59 +0200
+Subject: [PATCH 04/10] epub: add fallback for malformed epub files in
+ check_mime_type
+
+Signed-off-by: Mike Gabriel <mike.gabr...@das-netzwerkteam.de>
+---
+ backend/epub/epub-document.c | 66 +++++++++++++++++++++---------------
+ 1 file changed, 38 insertions(+), 28 deletions(-)
+
+diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c
+index 385d2fe..451c884 100644
+--- a/backend/epub/epub-document.c
++++ b/backend/epub/epub-document.c
+@@ -625,41 +625,51 @@ xml_get_data_from_node(xmlNodePtr node,
+ static gboolean
+ check_mime_type(const gchar* uri,GError** error)
+ {
+-    GError * err = NULL ;
+-    const gchar* mimeFromFile = ev_file_get_mime_type(uri,FALSE,&err);
++    GError * err = NULL;
++    const gchar* mimeFromFile;
+ 
+-    gchar* mimetypes[] = {"application/epub+zip","application/x-booki+zip"};
+-    int typecount = 2;
+-    if ( !mimeFromFile )
++    mimeFromFile = ev_file_get_mime_type(uri, FALSE, &err);
++    if (mimeFromFile)
+     {
+-        if (err)    {
+-            g_propagate_error (error, err);
+-        }
+-        else    {
+-            g_set_error_literal (error,
+-                         EV_DOCUMENT_ERROR,
+-                         EV_DOCUMENT_ERROR_INVALID,
+-                         _("Unknown MIME Type"));
+-        }
+-        return FALSE;
+-    }
+-    else
+-    {
+-        int i=0;
+-        for (i=0; i < typecount ;i++) {
+-           if ( g_strcmp0(mimeFromFile, mimetypes[i]) == 0  ) {
++        const gchar* mimetypes[] = {"application/epub+zip", 
"application/x-booki+zip", NULL};
++        guint i;
++
++        for (i = 0; i < g_strv_length (mimetypes); i++) {
++           if (strcmp(mimeFromFile, mimetypes[i]) == 0)
+                 return TRUE;
+-           }
++      }
++
++        /* fallback for malformed epub files */
++        if (strcmp (mimeFromFile, "application/zip") == 0)
++        {
++            mimeFromFile = ev_file_get_mime_type (uri, TRUE, &err);
++            if (mimeFromFile)
++            {
++                for (i = 0; i < g_strv_length (mimetypes); i++) {
++                    if (g_strcmp0(mimeFromFile, mimetypes[i]) == 0)
++                        return TRUE;
++                }
++
++                /*We didn't find a match*/
++                g_set_error_literal (error,
++                                     EV_DOCUMENT_ERROR,
++                                     EV_DOCUMENT_ERROR_INVALID,
++                                     _("Not an ePub document"));
++
++                return FALSE;
++            }
+         }
++    }
+ 
+-        /*We didn't find a match*/
++    if (err)
++        g_propagate_error (error, err);
++    else
+         g_set_error_literal (error,
+-                     EV_DOCUMENT_ERROR,
+-                     EV_DOCUMENT_ERROR_INVALID,
+-                     _("Not an ePub document"));
++                             EV_DOCUMENT_ERROR,
++                             EV_DOCUMENT_ERROR_INVALID,
++                             _("Unknown MIME Type"));
+ 
+-        return FALSE;
+-    }
++    return FALSE;
+ }
+ 
+ static gboolean
+-- 
+2.39.2
+
diff -Nru 
atril-1.26.0/debian/patches/1002-avoid-crash-on-certain-epub-files.patch 
atril-1.26.0/debian/patches/1002-avoid-crash-on-certain-epub-files.patch
--- atril-1.26.0/debian/patches/1002-avoid-crash-on-certain-epub-files.patch    
1970-01-01 01:00:00.000000000 +0100
+++ atril-1.26.0/debian/patches/1002-avoid-crash-on-certain-epub-files.patch    
2024-01-06 07:18:28.000000000 +0100
@@ -0,0 +1,27 @@
+Description: Avoid crash on certain epub files
+
+Author: Bernhard Übelacker <bernha...@mailbox.org>
+Bug-Debian: https://bugs.debian.org/972715
+Forwarded: no
+Last-Update: 2020-11-01
+
+--- a/backend/epub/epub-document.c
++++ b/backend/epub/epub-document.c
+@@ -1279,7 +1279,7 @@
+             xml_parse_children_of_node(navLabel,(xmlChar*)"text",NULL,NULL);
+             linknode *newnode = g_new0(linknode,1);
+             newnode->linktext = NULL;
+-            while (newnode->linktext == NULL) {
++            while (xmlretval && newnode->linktext == NULL) {
+                 newnode->linktext = 
(gchar*)xml_get_data_from_node(xmlretval,XML_KEYWORD,NULL);
+                 xmlretval = xmlretval->next;
+             }
+@@ -1597,7 +1597,7 @@
+     contentListNode *pagedata;
+ 
+     guint flag=0;
+-    while (!flag) {
++    while (listiter && !flag) {
+         pagedata = listiter->data;
+         if (link_present_on_page(Link->pagelink, pagedata->value)) {
+             flag=1;
diff -Nru atril-1.26.0/debian/patches/series atril-1.26.0/debian/patches/series
--- atril-1.26.0/debian/patches/series  2022-10-27 10:40:29.000000000 +0200
+++ atril-1.26.0/debian/patches/series  2024-01-06 07:18:28.000000000 +0100
@@ -1 +1,5 @@
 1001-webkit2gtk4.1.patch
+1002-avoid-crash-on-certain-epub-files.patch
+0001-Accessibility-add-button-description.patch
+0003-epub-Fix-index-loading-for-certain-documents-look-fo.patch
+0004-epub-add-fallback-for-malformed-epub-files-in-check_.patch

Reply via email to