From eeaa43b66845d58669e7e7c363c6cca978008433 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 6 Sep 2017 03:49:45 +0200 Subject: [PATCH] with-lock: close segment file before invoking subprocess (cherry picked from commit b9dce0ebdcdd709818de2ca61ca02065af69f01c) --- src/borg/archiver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 0a684c19b..0e567b911 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -1664,6 +1664,11 @@ class Archiver: # the encryption key (and can operate just with encrypted data). data = repository.get(Manifest.MANIFEST_ID) repository.put(Manifest.MANIFEST_ID, data) + # usually, a 0 byte (open for writing) segment file would be visible in the filesystem here. + # we write and close this file, to rather have a valid segment file on disk, before invoking the subprocess. + # we can only do this for local repositories (with .io), though: + if hasattr(repository, 'io'): + repository.io.close_segment() try: # we exit with the return code we get from the subprocess return subprocess.call([args.command] + args.args)