浏览代码

Merge pull request #3397 from ThomasWaldmann/port-1.1.3-last-minute-changes

Port 1.1.3 last minute changes
TW 7 年之前
父节点
当前提交
c4e56169e5

+ 5 - 0
docs/3rd_party/README

@@ -0,0 +1,5 @@
+Here we store 3rd party documentation, licenses, etc.
+
+Please note that all files inside the "borg" package directory (except the
+stuff excluded in setup.py) will be INSTALLED, so don't keep docs or licenses
+there.

+ 0 - 0
src/borg/algorithms/blake2/COPYING → docs/3rd_party/blake2/COPYING


+ 0 - 0
src/borg/algorithms/blake2/README.md → docs/3rd_party/blake2/README.md


+ 1 - 3
src/borg/algorithms/crc32_slice_by_8.c

@@ -332,14 +332,12 @@ uint32_t crc32_slice_by_8(const void* data, size_t length, uint32_t previousCrc3
   uint32_t crc = ~previousCrc32; // same as previousCrc32 ^ 0xFFFFFFFF
   uint32_t crc = ~previousCrc32; // same as previousCrc32 ^ 0xFFFFFFFF
 
 
   const uint32_t* current;
   const uint32_t* current;
-  const uint8_t* currentChar;
+  const uint8_t* currentChar = (const uint8_t*) data;
 
 
   // enabling optimization (at least -O2) automatically unrolls the inner for-loop
   // enabling optimization (at least -O2) automatically unrolls the inner for-loop
   const size_t Unroll = 4;
   const size_t Unroll = 4;
   const size_t BytesAtOnce = 8 * Unroll;
   const size_t BytesAtOnce = 8 * Unroll;
 
 
-  currentChar = (const uint8_t*) data;
-
   // wanted: 32 bit / 4 Byte alignment, compute leading, unaligned bytes length
   // wanted: 32 bit / 4 Byte alignment, compute leading, unaligned bytes length
   uintptr_t unaligned_length = (4 - (((uintptr_t) currentChar) & 3)) & 3;
   uintptr_t unaligned_length = (4 - (((uintptr_t) currentChar) & 3)) & 3;
   // process unaligned bytes, if any (standard algorithm)
   // process unaligned bytes, if any (standard algorithm)

+ 1 - 0
src/borg/archiver.py

@@ -3806,6 +3806,7 @@ class Archiver:
                 return forced_result
                 return forced_result
             # we only take specific options from the forced "borg serve" command:
             # we only take specific options from the forced "borg serve" command:
             result.restrict_to_paths = forced_result.restrict_to_paths
             result.restrict_to_paths = forced_result.restrict_to_paths
+            result.restrict_to_repositories = forced_result.restrict_to_repositories
             result.append_only = forced_result.append_only
             result.append_only = forced_result.append_only
         return result
         return result
 
 

+ 1 - 1
src/borg/fuse.py

@@ -362,7 +362,7 @@ class FuseBackend(object):
             return name + version_enc + ext
             return name + version_enc + ext
 
 
         if 'source' in item and hardlinkable(item.mode):
         if 'source' in item and hardlinkable(item.mode):
-            source = os.path.join(*item.source.split(os.sep)[stripped_components:])
+            source = os.sep.join(item.source.split(os.sep)[stripped_components:])
             chunks, link_target = hardlink_masters.get(item.source, (None, source))
             chunks, link_target = hardlink_masters.get(item.source, (None, source))
             if link_target:
             if link_target:
                 # Hard link was extracted previously, just link
                 # Hard link was extracted previously, just link

+ 12 - 0
src/borg/testsuite/archiver.py

@@ -3546,10 +3546,22 @@ def test_get_args():
     assert args.restrict_to_paths == ['/p1', '/p2']
     assert args.restrict_to_paths == ['/p1', '/p2']
     assert args.umask == 0o027
     assert args.umask == 0o027
     assert args.log_level == 'info'
     assert args.log_level == 'info'
+    # similar, but with --restrict-to-repository
+    args = archiver.get_args(['borg', 'serve', '--restrict-to-repository=/r1', '--restrict-to-repository=/r2', ],
+                             'borg serve --info --umask=0027')
+    assert args.restrict_to_repositories == ['/r1', '/r2']
     # trying to cheat - break out of path restriction
     # trying to cheat - break out of path restriction
     args = archiver.get_args(['borg', 'serve', '--restrict-to-path=/p1', '--restrict-to-path=/p2', ],
     args = archiver.get_args(['borg', 'serve', '--restrict-to-path=/p1', '--restrict-to-path=/p2', ],
                              'borg serve --restrict-to-path=/')
                              'borg serve --restrict-to-path=/')
     assert args.restrict_to_paths == ['/p1', '/p2']
     assert args.restrict_to_paths == ['/p1', '/p2']
+    # trying to cheat - break out of repository restriction
+    args = archiver.get_args(['borg', 'serve', '--restrict-to-repository=/r1', '--restrict-to-repository=/r2', ],
+                             'borg serve --restrict-to-repository=/')
+    assert args.restrict_to_repositories == ['/r1', '/r2']
+    # trying to cheat - break below repository restriction
+    args = archiver.get_args(['borg', 'serve', '--restrict-to-repository=/r1', '--restrict-to-repository=/r2', ],
+                             'borg serve --restrict-to-repository=/r1/below')
+    assert args.restrict_to_repositories == ['/r1', '/r2']
     # trying to cheat - try to execute different subcommand
     # trying to cheat - try to execute different subcommand
     args = archiver.get_args(['borg', 'serve', '--restrict-to-path=/p1', '--restrict-to-path=/p2', ],
     args = archiver.get_args(['borg', 'serve', '--restrict-to-path=/p1', '--restrict-to-path=/p2', ],
                              'borg init --encryption=repokey /')
                              'borg init --encryption=repokey /')