guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: borg: Fix a data loss bug.


From: Leo Famulari
Subject: 01/01: gnu: borg: Fix a data loss bug.
Date: Sat, 16 Dec 2017 16:35:20 -0500 (EST)

lfam pushed a commit to branch master
in repository guix.

commit e908a5af89614987302b32ac84e7d3af1c33e549
Author: Leo Famulari <address@hidden>
Date:   Sat Dec 16 16:04:53 2017 -0500

    gnu: borg: Fix a data loss bug.
    
    See <https://github.com/borgbackup/borg/issues/3444> for more information.
    
    * gnu/packages/patches/borg-fix-archive-corruption-bug.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/backup.scm (borg)[source]: Use it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/backup.scm                            |  1 +
 .../patches/borg-fix-archive-corruption-bug.patch  | 68 ++++++++++++++++++++++
 3 files changed, 70 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 0e93f9f..d4237b5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -558,6 +558,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/binutils-ld-new-dtags.patch             \
   %D%/packages/patches/binutils-loongson-workaround.patch      \
   %D%/packages/patches/blast+-fix-makefile.patch               \
+  %D%/packages/patches/borg-fix-archive-corruption-bug.patch   \
   %D%/packages/patches/byobu-writable-status.patch             \
   %D%/packages/patches/cairo-CVE-2016-9082.patch                       \
   %D%/packages/patches/calibre-no-updates-dialog.patch         \
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index f021aa8..e634d6a 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -470,6 +470,7 @@ detection, and lossless compression.")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "borgbackup" version))
+              (patches (search-patches 
"borg-fix-archive-corruption-bug.patch"))
               (sha256
                (base32
                 "1rvn8b6clzd1r317r9jkvk34r31risi0dxfjc7jffhnwasck4anc"))
diff --git a/gnu/packages/patches/borg-fix-archive-corruption-bug.patch 
b/gnu/packages/patches/borg-fix-archive-corruption-bug.patch
new file mode 100644
index 0000000..0debf11
--- /dev/null
+++ b/gnu/packages/patches/borg-fix-archive-corruption-bug.patch
@@ -0,0 +1,68 @@
+Fix a bug in `borg check --repair` that corrupts existing archives:
+
+https://github.com/borgbackup/borg/issues/3444
+
+Patches copied from upstream source repository:
+
+https://github.com/borgbackup/borg/commit/e09892caec8a63d59e909518c4e9c230dbd69774
+https://github.com/borgbackup/borg/commit/a68d28bfa4db30561150c83eb6a0dca5efa4d9e8
+
+From a68d28bfa4db30561150c83eb6a0dca5efa4d9e8 Mon Sep 17 00:00:00 2001
+From: Thomas Waldmann <address@hidden>
+Date: Sat, 16 Dec 2017 01:11:40 +0100
+Subject: [PATCH 1/2] modify borg check unit test so it "hangs", see #3444
+
+it doesn't infinitely hang, but slows down considerably.
+---
+ src/borg/testsuite/archiver.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
+index c7def2c7..b3383e97 100644
+--- a/src/borg/testsuite/archiver.py
++++ b/src/borg/testsuite/archiver.py
+@@ -3006,7 +3006,7 @@ def test_missing_file_chunk(self):
+     def test_missing_archive_item_chunk(self):
+         archive, repository = self.open_archive('archive1')
+         with repository:
+-            repository.delete(archive.metadata.items[-5])
++            repository.delete(archive.metadata.items[0])
+             repository.commit()
+         self.cmd('check', self.repository_location, exit_code=1)
+         self.cmd('check', '--repair', self.repository_location, exit_code=0)
+-- 
+2.15.1
+
+
+From e09892caec8a63d59e909518c4e9c230dbd69774 Mon Sep 17 00:00:00 2001
+From: Thomas Waldmann <address@hidden>
+Date: Sat, 16 Dec 2017 01:16:05 +0100
+Subject: [PATCH 2/2] check --repair: fix malfunctioning validator, fixes #3444
+
+the major problem was the ('path' in item) expression.
+the dict has bytes-typed keys there, so it never succeeded as it
+looked for a str key. this is a 1.1 regression, 1.0 was fine.
+
+the dict -> StableDict change is just for being more specific,
+the check triggered correctly as StableDict subclasses dict,
+it was just a bit too general.
+---
+ src/borg/archive.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/borg/archive.py b/src/borg/archive.py
+index 239d00b7..be086800 100644
+--- a/src/borg/archive.py
++++ b/src/borg/archive.py
+@@ -1457,7 +1457,7 @@ def robust_iterator(archive):
+             """
+             item_keys = frozenset(key.encode() for key in 
self.manifest.item_keys)
+             required_item_keys = frozenset(key.encode() for key in 
REQUIRED_ITEM_KEYS)
+-            unpacker = RobustUnpacker(lambda item: isinstance(item, dict) and 
'path' in item,
++            unpacker = RobustUnpacker(lambda item: isinstance(item, 
StableDict) and b'path' in item,
+                                       self.manifest.item_keys)
+             _state = 0
+ 
+-- 
+2.15.1
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]