Przeglądaj źródła

Merge pull request #821 from borgbackup/1.0-maint

merge 1.0-maint
TW 9 lat temu
rodzic
commit
d6590b4e2d
4 zmienionych plików z 60 dodań i 8 usunięć
  1. 6 2
      borg/_chunker.c
  2. 5 5
      borg/fuse.py
  3. 12 1
      borg/testsuite/chunker.py
  4. 37 0
      docs/changes.rst

+ 6 - 2
borg/_chunker.c

@@ -174,6 +174,10 @@ chunker_fill(Chunker *c)
             return 0;
         }
         n = PyBytes_Size(data);
+        if(PyErr_Occurred()) {
+            // we wanted bytes(), but got something else
+            return 0;
+        }
         if(n) {
             memcpy(c->data + c->position + c->remaining, PyBytes_AsString(data), n);
             c->remaining += n;
@@ -200,12 +204,12 @@ chunker_process(Chunker *c)
             PyErr_SetString(PyExc_Exception, "chunkifier byte count mismatch");
         return NULL;
     }
-    if(c->remaining <= window_size) {
+    while(c->remaining <= window_size && !c->eof) {
         if(!chunker_fill(c)) {
             return NULL;
         }
     }
-    if(c->remaining < window_size) {
+    if(c->eof) {
         c->done = 1;
         if(c->remaining) {
             c->bytes_yielded += c->remaining;

+ 5 - 5
borg/fuse.py

@@ -174,15 +174,15 @@ class FuseOperations(llfuse.Operations):
             else:
                 entry.st_ctime_ns = bigint_to_int(item[b'mtime'])
         else:
-            entry.st_mtime_ns = bigint_to_int(item[b'mtime']) / 1e9
+            entry.st_mtime = bigint_to_int(item[b'mtime']) / 1e9
             if b'atime' in item:
-                entry.st_atime_ns = bigint_to_int(item[b'atime']) / 1e9
+                entry.st_atime = bigint_to_int(item[b'atime']) / 1e9
             else:
-                entry.st_atime_ns = bigint_to_int(item[b'mtime']) / 1e9
+                entry.st_atime = bigint_to_int(item[b'mtime']) / 1e9
             if b'ctime' in item:
-                entry.st_ctime_ns = bigint_to_int(item[b'ctime']) / 1e9
+                entry.st_ctime = bigint_to_int(item[b'ctime']) / 1e9
             else:
-                entry.st_ctime_ns = bigint_to_int(item[b'mtime']) / 1e9
+                entry.st_ctime = bigint_to_int(item[b'mtime']) / 1e9
         return entry
 
     def listxattr(self, inode, ctx=None):

+ 12 - 1
borg/testsuite/chunker.py

@@ -1,7 +1,7 @@
 from io import BytesIO
 
 from ..chunker import Chunker, buzhash, buzhash_update
-from ..archive import CHUNK_MAX_EXP
+from ..archive import CHUNK_MAX_EXP, CHUNKER_PARAMS
 from . import BaseTestCase
 
 
@@ -29,3 +29,14 @@ class ChunkerTestCase(BaseTestCase):
         self.assert_equal(buzhash(b'abcdefghijklmnop', 1), buzhash_update(buzhash(b'Xabcdefghijklmno', 1), ord('X'), ord('p'), 16, 1))
         # Test with more than 31 bytes to make sure our barrel_shift macro works correctly
         self.assert_equal(buzhash(b'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 0), 566521248)
+
+    def test_small_reads(self):
+        class SmallReadFile:
+            input = b'a' * (20 + 1)
+
+            def read(self, nbytes):
+                self.input = self.input[:-1]
+                return self.input[:1]
+
+        reconstructed = b''.join(Chunker(0, *CHUNKER_PARAMS).chunkify(SmallReadFile()))
+        assert reconstructed == b'a' * 20

+ 37 - 0
docs/changes.rst

@@ -1,6 +1,43 @@
 Changelog
 =========
 
+Version 1.0.1 (not released yet)
+--------------------------------
+
+New features:
+
+Usually there are no new features in a bugfix release, but these 2 were added
+to get them out quickly - as both positively affect your safety/security:
+
+- append-only mode for repositories, #809, #36
+  (please read the docs about how this can improve your security)
+- implement password roundtrip, #695 (make sure the user can know/verify the
+  encryption key password/passphrase, to avoid double-typos, wrong keyboard
+  layout or locale/encoding issues)
+
+Bug fixes:
+
+- fix silently skipping EIO, #748
+- do not sleep for >60s while waiting for lock, fixes #773
+- unpack file stats before passing to FUSE
+- fix build on illumos
+- don't try to backup doors or event ports (Solaris and derivates)
+- fix capitalization, add ellipses, change log level to debug for 2 messages, fixes #798
+- remove useless/misleading libc version display, fixes #738
+
+Other changes:
+
+- update llfuse requirement, llfuse 1.0 works
+- update OS / dist packages on build machines, fixes #717
+- docs:
+
+  - fix cygwin requirements (gcc-g++)
+  - document how to debug / file filesystem issues, fixes #664
+  - fix reproducible build of api docs
+  - RTD theme: CSS !important overwrite. Fix borgbackup/borg#727
+  - Document logo font. Recreate logo png. Remove GIMP logo file.
+
+
 Version 1.0.0
 -------------