Your message dated Thu, 16 Jan 2020 14:44:15 +0000
with message-id <e1is6nb-000cx9...@fasolo.debian.org>
and subject line Bug#947508: fixed in mcomix 1.2.1mcomix3+git20200116-1
has caused the Debian Bug report #947508,
regarding mcomix: Upgrade to Python 3 fork deletes user bookmarks
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
947508: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947508
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: mcomix
Version: 1.2.1mcomix3+git20190616-1
Severity: critical
Tags: patch upstream
Justification: causes serious data loss
Dear Maintainer,
User bookmarks for the MComix application are stored in a pickle file at
~/.local/share/mcomix/bookmarks.pickle . The Python 3 fork of MComix which
Debian has switched to is unable to read this file when it has been written by
the earlier, Python 2 version of the application. When this happens, the
application prints an error message to the console (which most users will not
see since they won't be opening the application from a terminal), and then
proceeds to start up. Since no bookmarks have been loaded, when the application
saves the current bookmarks back to the file, the contents of the file are reset
and the user's existing bookmark collection is destroyed.
I reported this problem to upstream, here:
https://github.com/multiSnow/mcomix3/issues/98
I also wrote a pull request to fix the problem, here:
https://github.com/multiSnow/mcomix3/pull/99
The patch from that PR is attached. The behavior of the application after
patching is that now it will be able to read a user bookmarks file produced by
the Python 2 version of the applicaton, and if any error is encountered, it will
make a backup of the bookmarks pickle file before proceeding, in order to avoid
data loss.
Thanks,
Keshav
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (990, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.3.0-3-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE,
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
Versions of packages mcomix depends on:
ii gir1.2-gtk-3.0 3.24.13-1
ii python3 3.7.5-3
ii python3-cairo 1.16.2-2
ii python3-gi 3.34.0-3
ii python3-gi-cairo 3.34.0-3
ii python3-pil 6.2.1-2+b1
Versions of packages mcomix recommends:
ii python3-chardet 3.0.4-4
Versions of packages mcomix suggests:
pn mupdf-tools <none>
ii p7zip 16.02+dfsg-7
ii unrar 1:5.6.6-2
-- no debconf information
>From 8a344788e18a31d34ae1681e1ebe75cd6a02f716 Mon Sep 17 00:00:00 2001
From: Keshav Kini <keshav.k...@gmail.com>
Date: Thu, 26 Dec 2019 19:45:23 -0800
Subject: [PATCH] Try to read bookmarks pickled by Python 2
When a pickle file is saved by Python 2, it can be unreadable from Python 3 if
certain kinds of objects are stored in it, such as non-Unicode strings. To
reliably unpickle these objects, a fallback string encoding must be supplied to
`pickle.load()`.
It turns out that `datetime` objects, which MComix saves as part of each
bookmark, are serialized as non-Unicode binary strings (using the pickle
format's opcode `SHORT_BINSTRING`). According to the [Python
documentation][1],
> Using `encoding='latin1'` is required for unpickling NumPy arrays and
> instances of *datetime*, *date* and *time* pickled by Python 2.
This commit does as recommended by the above sentence from the documentation.
Furthermore, this commit makes it so that if MComix fails to unpickle the
bookmarks file, it will back up the existing file before proceeding (because
otherwise it will be overwritten with an empty set of bookmarks later). If the
backup file cannot be saved, the program will crash to avoid destroying the
user's data.
[1]: https://docs.python.org/3/library/pickle.html#pickle.Unpickler "pickle"
---
mcomix/mcomix/bookmark_backend.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/mcomix/mcomix/bookmark_backend.py
b/mcomix/mcomix/bookmark_backend.py
index 0492600..8293ee2 100644
--- a/mcomix/mcomix/bookmark_backend.py
+++ b/mcomix/mcomix/bookmark_backend.py
@@ -6,6 +6,7 @@ from gi.repository import Gtk
import operator
import datetime
import time
+import shutil
from mcomix import constants
from mcomix import log
@@ -141,8 +142,8 @@ class __BookmarksStore(object):
try:
mtime = os.stat(path).st_mtime
with open(path, 'rb') as fd:
- version = pickle.load(fd)
- packs = pickle.load(fd)
+ version = pickle.load(fd, encoding='latin1')
+ packs = pickle.load(fd, encoding='latin1')
for pack in packs:
# Handle old bookmarks without date_added attribute
@@ -155,6 +156,13 @@ class __BookmarksStore(object):
except Exception:
log.error(_('! Could not parse bookmarks file %s'), path)
+ backup_path = path + '.bak'
+ if not os.path.exists(backup_path):
+ log.warning(_('! Backing up bookmarks file to %s'),
backup_path)
+ shutil.copyfile(path, backup_path)
+ else:
+ log.error(_('! Cannot create backup bookmarks file at
%s'), backup_path)
+ raise
return bookmarks, mtime
--
2.24.1
--- End Message ---
--- Begin Message ---
Source: mcomix
Source-Version: 1.2.1mcomix3+git20200116-1
We believe that the bug you reported is fixed in the latest version of
mcomix, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 947...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Emfox Zhou <em...@debian.org> (supplier of updated mcomix package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Thu, 16 Jan 2020 20:18:22 +0800
Source: mcomix
Architecture: source
Version: 1.2.1mcomix3+git20200116-1
Distribution: unstable
Urgency: medium
Maintainer: Krzysztof Klimonda <kklimo...@syntaxhighlighted.com>
Changed-By: Emfox Zhou <em...@debian.org>
Closes: 947508
Changes:
mcomix (1.2.1mcomix3+git20200116-1) unstable; urgency=medium
.
* New upstream release
- Back and convert bookmark file (Closes: #947508)
Checksums-Sha1:
e30e2b168c341a2efc6f9792b114126a8158a30e 1928
mcomix_1.2.1mcomix3+git20200116-1.dsc
b49666119f1a0d4b6dbfe34ad552c3f0a619d686 3038541
mcomix_1.2.1mcomix3+git20200116.orig.tar.bz2
a5fbe5197443efa853c996edb7f4e2aaef0ed339 3008
mcomix_1.2.1mcomix3+git20200116-1.debian.tar.xz
e2be451eee201bd44b3f99ea1cde5c33fe597266 6081
mcomix_1.2.1mcomix3+git20200116-1_amd64.buildinfo
Checksums-Sha256:
b156bf4a623968279a5a9e43947e8a55c4f4c53f4bfc466c19b71521ef49f6e2 1928
mcomix_1.2.1mcomix3+git20200116-1.dsc
bf00059785cc42a11807dfbe4c19870bbc0ddfa4bc30e35d0e0caf15b8ec1ad4 3038541
mcomix_1.2.1mcomix3+git20200116.orig.tar.bz2
055a6ee387265fc719692e158228bea7313486c868033744b26208eb9d45f7f7 3008
mcomix_1.2.1mcomix3+git20200116-1.debian.tar.xz
d7044f3aafcfd7f86a1f5689575550bbd56eb56e6f397708d972d022183a6732 6081
mcomix_1.2.1mcomix3+git20200116-1_amd64.buildinfo
Files:
bbc680e93f6083db77fb05bd0a90438b 1928 x11 optional
mcomix_1.2.1mcomix3+git20200116-1.dsc
b5e18d2c0d0b2a2133e3e57966982768 3038541 x11 optional
mcomix_1.2.1mcomix3+git20200116.orig.tar.bz2
85ca1c4a16775d1405be0e0b2552cf52 3008 x11 optional
mcomix_1.2.1mcomix3+git20200116-1.debian.tar.xz
3b371559b8eea0d0cbb1af940b7294d8 6081 x11 optional
mcomix_1.2.1mcomix3+git20200116-1_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEGSauJtItZVqOiaNpgImbv9t7vZQFAl4gWEEACgkQgImbv9t7
vZTV9RAAr8vUnnF51zOZzc6D/rKJzQGLhXlmzcsySCjs2nCTVNiftctBmMZn4D0t
QApwQ1g2NruKKDkE1l8ItPed1vSh4ry7UVj4RmFhRv/J6KfJWXlBsUJKu1YDLDBA
1rtykFe3lSlRr+sqAyOrdc67CWnT4PAXWPC+Y5fEblJM4SA7U+rIV2CH8QaHdQ8b
OKfIzefGzBTyEZEpAsiTDsBHiITdQGFJrOWSvIP4aWQW/2iWlTyp2XUQmlsrE7kK
AHMh5Db11affUHOVdu9Yv0MPSmd6Q+m4rvzDUkLUDLxQa2VdLIDM7edat9900uoA
CjD8Sohz2ItNtI17NQqfrdpPbHkj9o7C7O0llr07sHwhwy0wN0DqlKyzrrW7S6ab
RBZOFq2pFaP0mXuF5E9GbED5vOOMvJCcizt6RSVAkLWx5d0BTgKVTqQyMMnZC3nG
Gjy79AZHkTrt4MJrg29o3dktVborXU85pEkj/n7iaJ1SmWgDBGa6dxpEx08khAS5
7NxY7fYmXnrkdSe/lk+QTe24kBwJlHNgboAywkRd3vQ9nhLeE7CAG0etzylW79BJ
2IazUImVoe7OoyhCrKoHHsJ+M3tCznwqyfe9FYUmjwuAVtgs+dqhG4iCrPbIiInZ
4SAX64jfDIdy6J0bZ7d95STskyK0J2FfAc1bccC/nulnVnejvG8=
=6CG0
-----END PGP SIGNATURE-----
--- End Message ---