Front page

[PATCH] verify_plugin: verify_chunks - consider case when live file has grown

3979d2a6019547edaa6ebd332f80cc78
CLASSROOM INERTIA STANDARD

From: Thomas Waldmann <thomas.j.waldmann@gmail.com>
Date: Fri, 27 Feb 2015 14:16:29 +0100

   When the live file has new data appended at the end, the verification
   should fail.
   
   It previously did not, because it only compared the data up to the length
   of all backup data chunks (== the backupped file's length).
   ---
    obnamlib/plugins/verify_plugin.py | 4 ++++
    1 file changed, 4 insertions(+)
   
   diff --git a/obnamlib/plugins/verify_plugin.py
   b/obnamlib/plugins/verify_plugin.py
   index 50cd1d0..9e1ae7c 100644
   --- a/obnamlib/plugins/verify_plugin.py
   +++ b/obnamlib/plugins/verify_plugin.py
   @@ -207,6 +207,10 @@ class VerifyPlugin(obnamlib.ObnamPlugin):
                self.app.ts['done_bytes'] += len(backed_up)
                if backed_up != live_data:
                    return False
   +        # check whether more data has been appended to the live data
   +        live_data = f.read(1)
   +        if live_data:
   +            return False
            return True
   
        def walk(self, gen_id, args):
From: Thomas Waldmann <thomas.j.waldmann@gmail.com>
Date: Fri, 27 Feb 2015 14:16:29 +0100

   When the live file has new data appended at the end, the verification
   should fail.
   
   It previously did not, because it only compared the data up to the length
   of all backup data chunks (== the backupped file's length).
   ---
    obnamlib/plugins/verify_plugin.py | 4 ++++
    1 file changed, 4 insertions(+)
   
   diff --git a/obnamlib/plugins/verify_plugin.py
   b/obnamlib/plugins/verify_plugin.py
   index 50cd1d0..9e1ae7c 100644
   --- a/obnamlib/plugins/verify_plugin.py
   +++ b/obnamlib/plugins/verify_plugin.py
   @@ -207,6 +207,10 @@ class VerifyPlugin(obnamlib.ObnamPlugin):
                self.app.ts['done_bytes'] += len(backed_up)
                if backed_up != live_data:
                    return False
   +        # check whether more data has been appended to the live data
   +        live_data = f.read(1)
   +        if live_data:
   +            return False
            return True
   
        def walk(self, gen_id, args):
From: Lars Wirzenius <liw@liw.fi>
Date: Sat, 28 Feb 2015 19:48:21 +0200

   That's a nice bug, thank you for catching it. It would be really nice
   to add a regression test for it in the yarn test suite. Could you do
   that, please? The yarns/0080-verify.yarn file would be the right
   place. If you'd rather I did that, please say so.
   
   On Fri, Feb 27, 2015 at 02:16:29PM +0100, Thomas Waldmann wrote:
   > When the live file has new data appended at the end, the verification
   > should fail.
   > 
   > It previously did not, because it only compared the data up to the length
   > of all backup data chunks (== the backupped file's length).
   > ---
   >  obnamlib/plugins/verify_plugin.py | 4 ++++
   >  1 file changed, 4 insertions(+)
   > 
   > diff --git a/obnamlib/plugins/verify_plugin.py
   > b/obnamlib/plugins/verify_plugin.py
   > index 50cd1d0..9e1ae7c 100644
   > --- a/obnamlib/plugins/verify_plugin.py
   > +++ b/obnamlib/plugins/verify_plugin.py
   > @@ -207,6 +207,10 @@ class VerifyPlugin(obnamlib.ObnamPlugin):
   >              self.app.ts['done_bytes'] += len(backed_up)
   >              if backed_up != live_data:
   >                  return False
   > +        # check whether more data has been appended to the live data
   > +        live_data = f.read(1)
   > +        if live_data:
   > +            return False
   >          return True
   > 
   >      def walk(self, gen_id, args):
   > -- 
   > 1.9.1
   
   > _______________________________________________
   > obnam-dev mailing list
   > obnam-dev@obnam.org
   > http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org