internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: borgbackup/borg

Issue:
please make the build reproducible [PATCH]
``` diff
--- a/debian/patches/reproducible_build 1970-01-01 02:00:00.000000000 +0200
--- b/debian/patches/reproducible_build 2016-07-18 11:27:31.058419685 +0200
@@ -0,0 +1,23 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby@debian.org>
+Last-Update: 2016-07-18
+
+--- borgbackup-1.0.5.orig/borg/archiver.py
++++ borgbackup-1.0.5/borg/archiver.py
+@@ -14,6 +14,7 @@ import stat
+ import sys
+ import textwrap
+ import traceback
++import collections
+ 
+ from . import __version__
+ from .helpers import Error, location_validator, archivename_validator, 
format_line, format_time, format_file_size, \
+@@ -736,7 +737,7 @@ class Archiver:
+         Cache.break_lock(repository)
+         return self.exit_code
+ 
+-    helptext = {}
++    helptext = collections.OrderedDict()
+     helptext['patterns'] = textwrap.dedent('''
+         Exclusion patterns support four separate styles, fnmatch, shell, 
regular
+         expressions and path prefixes. By default, fnmatch is used. If 
followed

```



Discussion:
I'm giving you the patch file in the Debian way :) please set Chris as author!

if you make it hard, at least use file attachments -_-

lets make a pr


Resolving patch:
diff --git a/borg/archiver.py b/borg/archiver.py
--- a/borg/archiver.py
+++ b/borg/archiver.py
@@ -14,6 +14,7 @@
 import sys
 import textwrap
 import traceback
+import collections
 
 from . import __version__
 from .helpers import Error, location_validator, archivename_validator, format_line, format_time, format_file_size, \
@@ -736,7 +737,7 @@ def do_break_lock(self, args, repository):
         Cache.break_lock(repository)
         return self.exit_code
 
-    helptext = {}
+    helptext = collections.OrderedDict()
     helptext['patterns'] = textwrap.dedent('''
         Exclusion patterns support four separate styles, fnmatch, shell, regular
         expressions and path prefixes. By default, fnmatch is used. If followed


Test patch:
Repository: borgbackup/borg

Issue:
test_non_ascii_acl failing
`E       AssertionError: b'user:\xc3\xbcbel:rw-:666' not found in b'user::rw-\nuser:666:rw-:666\ngroup::r--\ngroup:666:rw-:666\nmask::rw-\nother::---'` from [src/borg/testsuite/platform.py:90](https://github.com/borgbackup/borg/blob/504af0206d3abb0dba1a20e9519d23eb0ed15957/src/borg/testsuite/platform.py#L90)

I'm running this without fakeroot BTW (for #1359 testing). It is consistent across filesystems (edit: or maybe not, but it occurs on a lot of them including ext4).

test_non_ascii_acl failing
`E       AssertionError: b'user:\xc3\xbcbel:rw-:666' not found in b'user::rw-\nuser:666:rw-:666\ngroup::r--\ngroup:666:rw-:666\nmask::rw-\nother::---'` from [src/borg/testsuite/platform.py:90](https://github.com/borgbackup/borg/blob/504af0206d3abb0dba1a20e9519d23eb0ed15957/src/borg/testsuite/platform.py#L90)

I'm running this without fakeroot BTW (for #1359 testing). It is consistent across filesystems (edit: or maybe not, but it occurs on a lot of them including ext4).



Discussion:
maybe this test requires a user and group "übel", see comment in line 82 there.

This test only passes in the vagrant boxes iirc.

Add a check that the user dübel exist (pwd.getpwnam?) and pytest.skip otherwise?

Oh, makes sense. I missed that comment. I'll add a PR to check if the user exists first.

maybe this test requires a user and group "übel", see comment in line 82 there.

This test only passes in the vagrant boxes iirc.

Add a check that the user dübel exist (pwd.getpwnam?) and pytest.skip otherwise?

Oh, makes sense. I missed that comment. I'll add a PR to check if the user exists first.


Resolving patch:
diff --git a/src/borg/testsuite/platform.py b/src/borg/testsuite/platform.py
--- a/src/borg/testsuite/platform.py
+++ b/src/borg/testsuite/platform.py
@@ -2,6 +2,7 @@
 import shutil
 import sys
 import tempfile
+import pwd
 import unittest
 
 from ..platform import acl_get, acl_set, swidth
@@ -35,6 +36,14 @@ def fakeroot_detected():
     return 'FAKEROOTKEY' in os.environ
 
 
+def user_exists(username):
+    try:
+        pwd.getpwnam(username)
+        return True
+    except KeyError:
+        return False
+
+
 @unittest.skipUnless(sys.platform.startswith('linux'), 'linux only test')
 @unittest.skipIf(fakeroot_detected(), 'not compatible with fakeroot')
 class PlatformLinuxTestCase(BaseTestCase):
@@ -72,6 +81,7 @@ def test_default_acl(self):
         self.assert_equal(self.get_acl(self.tmpdir)['acl_access'], ACCESS_ACL)
         self.assert_equal(self.get_acl(self.tmpdir)['acl_default'], DEFAULT_ACL)
 
+    @unittest.skipIf(not user_exists('übel'), 'requires übel user')
     def test_non_ascii_acl(self):
         # Testing non-ascii ACL processing to see whether our code is robust.
         # I have no idea whether non-ascii ACLs are allowed by the standard,


Test patch:
Repository: borgbackup/borg

Issue:
fix remote repo teardown
When quickly starting a lot of (30) borg (1.0-maint branch) against same repository via ssh (to localhost), I frequently see this, but the majority of tasks work:

```
Remote: ssh_exchange_identification: Connection closed by remote host
Exception ignored in: <bound method RemoteRepository.__del__ of <RemoteRepository ssh://tw@localhost/home/tw/w/borg/repo>>
Traceback (most recent call last):
  File "/home/tw/w/borg/borg/remote.py", line 184, in __del__
    assert False, "cleanup happened in Repository.__del__"
AssertionError: cleanup happened in Repository.__del__
Connection closed by remote host. Is borg working on the server?
terminating with error status, rc 2
```



Discussion:
Guess [here](https://github.com/borgbackup/borg/blob/1.0-maint/borg/remote.py#L168) are also explicit close calls needed, like in L177. Or just wrap the whole block in a try/finally?

Yup, that's helping. Not that ugly any more.

The remaining question is of course why it is "closed by remote" in some cases before it even started.


Resolving patch:
diff --git a/borg/remote.py b/borg/remote.py
--- a/borg/remote.py
+++ b/borg/remote.py
@@ -170,12 +170,12 @@ def __init__(self, location, create=False, lock_wait=None, lock=True, append_onl
         self.x_fds = [self.stdin_fd, self.stdout_fd, self.stderr_fd]
 
         try:
-            version = self.call('negotiate', RPC_PROTOCOL_VERSION)
-        except ConnectionClosed:
-            raise ConnectionClosedWithHint('Is borg working on the server?') from None
-        if version != RPC_PROTOCOL_VERSION:
-            raise Exception('Server insisted on using unsupported protocol version %d' % version)
-        try:
+            try:
+                version = self.call('negotiate', RPC_PROTOCOL_VERSION)
+            except ConnectionClosed:
+                raise ConnectionClosedWithHint('Is borg working on the server?') from None
+            if version != RPC_PROTOCOL_VERSION:
+                raise Exception('Server insisted on using unsupported protocol version %d' % version)
             # Because of protocol versions, only send append_only if necessary
             if append_only:
                 try:


Test patch:
Repository: borgbackup/borg

Issue:
minor doc tweaks on master
A couple suggestions for master (with reference to: http://borgbackup.readthedocs.io/en/latest/usage.html):
- [x] borg list has an example (the last one) for showing diff. This should be removed since there is a dedicated borg diff command now;
- [x] elaborate a bit more on _auto,C[,L]_ heuristic: based on file extension, file type or it tries to compress and use none if the compressed is just X% smaller?

Thanks



Discussion:
borg list: true, it is not needed any more.

auto,C,L heuristics:
- if you just give that as a param to `borg create`, it will not look at the filename, but just try to compress with lz4 to decide about compressibility. if it compresses ok, it will then compress with the given C,L compression algo/level. if it does not compress, it will save the content uncompressed.
  lz4 is very fast, so we don't waste many cycles by using it that way.
- if you use it in a compression config, the above mechanism will be used after matching filename/extension.


Resolving patch:
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -1541,7 +1541,8 @@ def build_parser(self, prog=None):
                                    type=CompressionSpec, default=dict(name='none'), metavar='COMPRESSION',
                                    help='select compression algorithm (and level):\n'
                                         'none == no compression (default),\n'
-                                        'auto,C[,L] == built-in heuristic decides between none or C[,L] - with C[,L]\n'
+                                        'auto,C[,L] == built-in heuristic (try with lz4 whether the data is\n'
+                                        '              compressible) decides between none or C[,L] - with C[,L]\n'
                                         '              being any valid compression algorithm (and optional level),\n'
                                         'lz4 == lz4,\n'
                                         'zlib == zlib (default level 6),\n'


Test patch:
Repository: borgbackup/borg

Issue:
confusing msg with >= 1.0.7rc client against <1.0.7 remote repo
e.g. client: borg 1.0.7rc1 + server: borg 1.0.6

there will be always a TypeError traceback in the remote log about too many open() parameters given by the client.

this should be ignored if the server is older than 1.0.7 because it is a cosmetic side effect of the compatibility code we use to support old servers, too:
- we first try calling open() with 7 params (we needed to add 2 for locking and append-only, will work with servers >= 1.0.7)
- if that raises a TypeError on the server side, we call again with 5 params (will work with servers < 1.0.7)



Discussion:
Ideas (from IRC):
- document it in release notes
- emit a msg on the client to ignore that traceback (if we detect an old server)


Resolving patch:
diff --git a/borg/remote.py b/borg/remote.py
--- a/borg/remote.py
+++ b/borg/remote.py
@@ -185,6 +185,16 @@ def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock
             except self.RPCError as err:
                 if err.remote_type != 'TypeError':
                     raise
+                msg = """\
+Please note:
+If you see a TypeError complaining about the number of positional arguments
+given to open(), you can ignore it if it comes from a borg version < 1.0.7.
+This TypeError is a cosmetic side effect of the compatibility code borg
+clients >= 1.0.7 have to support older borg servers.
+This problem will go away as soon as the server has been upgraded to 1.0.7+.
+"""
+                # emit this msg in the same way as the "Remote: ..." lines that show the remote TypeError
+                sys.stderr.write(msg)
                 if append_only:
                     raise self.NoAppendOnlyOnServer()
                 self.id = self.call('open', self.location.path, create, lock_wait, lock)


Test patch:
Repository: borgbackup/borg

Issue:
Answering questions via env vars should print that they were answered via env var
It's very confusing that it prints the question, but not that it was answered from the env var.

Patch suggestion: set the default of `env_msg` of `helpers.yes` to something like `{} (from {})`.

From #1426



Discussion:

Resolving patch:
diff --git a/borg/helpers.py b/borg/helpers.py
--- a/borg/helpers.py
+++ b/borg/helpers.py
@@ -912,7 +912,7 @@ def is_slow_msgpack():
 
 
 def yes(msg=None, false_msg=None, true_msg=None, default_msg=None,
-        retry_msg=None, invalid_msg=None, env_msg=None,
+        retry_msg=None, invalid_msg=None, env_msg='{} (from {})',
         falsish=FALSISH, truish=TRUISH, defaultish=DEFAULTISH,
         default=False, retry=True, env_var_override=None, ofile=None, input=input):
     """Output <msg> (usually a question) and let user input an answer.
@@ -933,8 +933,8 @@ def yes(msg=None, false_msg=None, true_msg=None, default_msg=None,
     :param true_msg: message to output before returning True [None]
     :param default_msg: message to output before returning a <default> [None]
     :param invalid_msg: message to output after a invalid answer was given [None]
-    :param env_msg: message to output when using input from env_var_override [None],
-           needs to have 2 placeholders for answer and env var name, e.g.: "{} (from {})"
+    :param env_msg: message to output when using input from env_var_override ['{} (from {})'],
+           needs to have 2 placeholders for answer and env var name
     :param falsish: sequence of answers qualifying as False
     :param truish: sequence of answers qualifying as True
     :param defaultish: sequence of answers qualifying as <default>
diff --git a/borg/testsuite/helpers.py b/borg/testsuite/helpers.py
--- a/borg/testsuite/helpers.py
+++ b/borg/testsuite/helpers.py
@@ -805,6 +805,16 @@ def test_yes_output(capfd):
     assert 'false-msg' in err
 
 
+def test_yes_env_output(capfd, monkeypatch):
+    env_var = 'OVERRIDE_SOMETHING'
+    monkeypatch.setenv(env_var, 'yes')
+    assert yes(env_var_override=env_var)
+    out, err = capfd.readouterr()
+    assert out == ''
+    assert env_var in err
+    assert 'yes' in err
+
+
 def test_progress_percentage_multiline(capfd):
     pi = ProgressIndicatorPercent(1000, step=5, start=0, same_line=False, msg="%3.0f%%", file=sys.stderr)
     pi.show(0)


Test patch:
Repository: borgbackup/borg

Issue:
crash: manifest.timestamp == None?
current git master:

```
[nix-shell:/run/media/ronny/backups]$ borg list borg::home-ronny-pc-2016-05-07T15:02:35+0200 --format '{path}{LF}'
Local Exception.
Traceback (most recent call last):
  File "/nix/store/lskgyhvci1wzzc4nv02g6f8c4dl3bhaf-borgbackup-1.0.6/lib/python3.4/site-packages/borg/archiver.py", line 2368, in main
    exit_code = archiver.run(args)
  File "/nix/store/lskgyhvci1wzzc4nv02g6f8c4dl3bhaf-borgbackup-1.0.6/lib/python3.4/site-packages/borg/archiver.py", line 2301, in run
    return args.func(args)
  File "/nix/store/lskgyhvci1wzzc4nv02g6f8c4dl3bhaf-borgbackup-1.0.6/lib/python3.4/site-packages/borg/archiver.py", line 97, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/nix/store/lskgyhvci1wzzc4nv02g6f8c4dl3bhaf-borgbackup-1.0.6/lib/python3.4/site-packages/borg/archiver.py", line 792, in do_list
    with Cache(repository, key, manifest, lock_wait=self.lock_wait) as cache:
  File "/nix/store/lskgyhvci1wzzc4nv02g6f8c4dl3bhaf-borgbackup-1.0.6/lib/python3.4/site-packages/borg/cache.py", line 102, in __init__
    self.commit()
  File "/nix/store/lskgyhvci1wzzc4nv02g6f8c4dl3bhaf-borgbackup-1.0.6/lib/python3.4/site-packages/borg/cache.py", line 227, in commit
    self.config.set('cache', 'timestamp', self.manifest.timestamp)
  File "/nix/store/n9p1x3ss0y0fj7j7h5mrzrajjhi08m3z-python3-3.4.5/lib/python3.4/configparser.py", line 1165, in set
    self._validate_value_types(option=option, value=value)
  File "/nix/store/n9p1x3ss0y0fj7j7h5mrzrajjhi08m3z-python3-3.4.5/lib/python3.4/configparser.py", line 1154, in _validate_value_types
    raise TypeError("option values must be strings")
TypeError: option values must be strings

Platform: Linux ronny-rh-work-nix 4.4.17 #1-NixOS SMP Wed Aug 10 09:49:43 UTC 2016 x86_64 
Linux:   
Borg: 1.1+git  Python: CPython 3.4.5
PID: 31509  CWD: /run/media/ronny/backups
sys.argv: ['borg', 'list', 'borg::home-ronny-pc-2016-05-07T15:02:35+0200', '--format', '{path}{LF}']
SSH_ORIGINAL_COMMAND: None
```



Discussion:
Is there no "timestamp" in borg 1.0.5 repo manifest, so the .get('timestamp') results in None?


Resolving patch:
diff --git a/src/borg/item.py b/src/borg/item.py
--- a/src/borg/item.py
+++ b/src/borg/item.py
@@ -259,6 +259,6 @@ class ManifestItem(PropDict):
 
     version = PropDict._make_property('version', int)
     archives = PropDict._make_property('archives', dict)  # name -> dict
-    timestamp = PropDict._make_property('time', str, 'surrogate-escaped str', encode=safe_encode, decode=safe_decode)
+    timestamp = PropDict._make_property('timestamp', str, 'surrogate-escaped str', encode=safe_encode, decode=safe_decode)
     config = PropDict._make_property('config', dict)
     item_keys = PropDict._make_property('item_keys', tuple)


Test patch:
Repository: borgbackup/borg

Issue:
restore original (system) LD_LIBRARY_PATH
https://github.com/pyinstaller/pyinstaller/pull/2148/commits

as soon as we use a pyinstaller that has this, we can change our code (borg.remote) that generates the ssh subprocess to use LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ORIG.



Discussion:

Resolving patch:
diff --git a/src/borg/remote.py b/src/borg/remote.py
--- a/src/borg/remote.py
+++ b/src/borg/remote.py
@@ -162,9 +162,15 @@ def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock
         env = dict(os.environ)
         if not testing:
             borg_cmd = self.ssh_cmd(location) + borg_cmd
-            # pyinstaller binary adds LD_LIBRARY_PATH=/tmp/_ME... but we do not want
-            # that the system's ssh binary picks up (non-matching) libraries from there
-            env.pop('LD_LIBRARY_PATH', None)
+            # pyinstaller binary modifies LD_LIBRARY_PATH=/tmp/_ME... but we do not want
+            # that the system's ssh binary picks up (non-matching) libraries from there.
+            # thus we install the original LDLP, before pyinstaller has modified it:
+            lp_key = 'LD_LIBRARY_PATH'
+            lp_orig = env.get(lp_key + '_ORIG')  # pyinstaller >= 20160820 has this
+            if lp_orig is not None:
+                env[lp_key] = lp_orig
+            else:
+                env.pop(lp_key, None)
         env.pop('BORG_PASSPHRASE', None)  # security: do not give secrets to subprocess
         env['BORG_VERSION'] = __version__
         self.p = Popen(borg_cmd, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)


Test patch:
Repository: borgbackup/borg

Issue:
BORG_FILES_CACHE_TTL env var missing unit
https://borgbackup.readthedocs.io/en/stable/usage.html#environment-variables `BORG_FILES_CACHE_TTL` doesn't specify which unit the value is in. Seconds? Hours? Days?



Discussion:
Neither. It is "generations" kind of. See FAQ, there is a bit of explanation.

Ah. Maybe `BORG_FILES_CACHE_TTL` documentation should point to that FAQ?

Or: move that part of the FAQ to the env var description, point to there from faq.


Resolving patch:
diff --git a/borg/archiver.py b/borg/archiver.py
--- a/borg/archiver.py
+++ b/borg/archiver.py
@@ -1344,6 +1344,15 @@ def build_parser(self, args=None, prog=None):
 
         info_epilog = textwrap.dedent("""
         This command displays some detailed information about the specified archive.
+
+        Please note that the deduplicated sizes of the individual archives do not add
+        up to the deduplicated size of the repository ("all archives"), because the two
+        are meaning different things:
+
+        This archive / deduplicated size = amount of data stored ONLY for this archive
+                                         = unique chunks of this archive.
+        All archives / deduplicated size = amount of data stored in the repo
+                                         = all chunks in the repository.
         """)
         subparser = subparsers.add_parser('info', parents=[common_parser],
                                           description=self.do_info.__doc__,


Test patch:
Repository: borgbackup/borg

Issue:
Does not catch SIGHUP
borg does not catch SIGHUP, which means that the repository might remain locked if the SSH connection between the server and the client is lost in a remote operation. This seems to manifest especially with systemd-logind having KillUserProcesses set to yes, for unknown reasons.



Discussion:

Resolving patch:
diff --git a/borg/archiver.py b/borg/archiver.py
--- a/borg/archiver.py
+++ b/borg/archiver.py
@@ -1666,6 +1666,14 @@ def sig_term_handler(signum, stack):
     raise SIGTERMReceived
 
 
+class SIGHUPReceived(BaseException):
+    pass
+
+
+def sig_hup_handler(signum, stack):
+    raise SIGHUPReceived
+
+
 def setup_signal_handlers():  # pragma: no cover
     sigs = []
     if hasattr(signal, 'SIGUSR1'):
@@ -1674,7 +1682,12 @@ def setup_signal_handlers():  # pragma: no cover
         sigs.append(signal.SIGINFO)  # kill -INFO pid (or ctrl-t)
     for sig in sigs:
         signal.signal(sig, sig_info_handler)
+    # If we received SIGTERM or SIGHUP, catch them and raise a proper exception
+    # that can be handled for an orderly exit. SIGHUP is important especially
+    # for systemd systems, where logind sends it when a session exits, in
+    # addition to any traditional use.
     signal.signal(signal.SIGTERM, sig_term_handler)
+    signal.signal(signal.SIGHUP, sig_hup_handler)
 
 
 def main():  # pragma: no cover
@@ -1713,6 +1726,9 @@ def main():  # pragma: no cover
     except SIGTERMReceived:
         msg = 'Received SIGTERM.'
         exit_code = EXIT_ERROR
+    except SIGHUPReceived:
+        msg = 'Received SIGHUP.'
+        exit_code = EXIT_ERROR
     if msg:
         logger.error(msg)
     if args.show_rc:


Test patch:
Repository: borgbackup/borg

Issue:
borg crashes in narrow terminal
System info:
- Debian 7
- Borg 1.0.7
- tmux 1.9.6
## How to reproduce (hopefully):
1. Open tmux
2. open 4 panes (`ctrl+b` then `shift + 2` opens new pane)
3. make sure your terminal windows is not too big, font size 13 in a window circa 1202x739px is perfect
4. start `borg create -v --list`
5. change tmux layout with `ctrl+b` then `space`
6. do that several times so you get the the narrow-st view
7. hope that borg crashes
## Traceback

```
423.63 GB O 113.70 GB C 80.11 GB D 8393152 N vps_...4ac52ne3
Traceback (most recent call last):
  File "borg/archiver.py", line 1684, in main
  File "borg/archiver.py", line 1621, in run
  File "borg/archiver.py", line 85, in wrapper
  File "borg/archiver.py", line 249, in do_create
  File "borg/archiver.py", line 223, in create_inner
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 303, in _process
  File "borg/archiver.py", line 277, in _process
  File "borg/archive.py", line 647, in process_file
  File "borg/archive.py", line 287, in add_item
  File "borg/helpers.py", line 228, in show_progress
ValueError: Sign not allowed in string format specifier

Platform: Linux atlas 3.14-0.bpo.1-amd64 #1 SMP Debian 3.14.12-1~bpo70+1 (2014-07-13) x86_64 
Linux: debian 7.11 
Borg: 1.0.7  Python: CPython 3.5.2
PID: 7017  CWD: /root
sys.argv: ['borg', 'create', '-vpsC', 'lz4', '/mnt/nas-03/borgbackup/::{now:%Y-%m-%d}-vps', '/vps', '--exclude=*[cC]ache*']
SSH_ORIGINAL_COMMAND: None
```



Discussion:

Resolving patch:
diff --git a/borg/helpers.py b/borg/helpers.py
--- a/borg/helpers.py
+++ b/borg/helpers.py
@@ -223,9 +223,13 @@ def show_progress(self, item=None, final=False, stream=None, dt=None):
                 msg = '{0.osize_fmt} O {0.csize_fmt} C {0.usize_fmt} D {0.nfiles} N '.format(self)
                 path = remove_surrogates(item[b'path']) if item else ''
                 space = columns - len(msg)
-                if space < len('...') + len(path):
-                    path = '%s...%s' % (path[:(space // 2) - len('...')], path[-space // 2:])
-                msg += "{0:<{space}}".format(path, space=space)
+                if space < 12:
+                    msg = ''
+                    space = columns - len(msg)
+                if space >= 8:
+                    if space < len('...') + len(path):
+                        path = '%s...%s' % (path[:(space // 2) - len('...')], path[-space // 2:])
+                    msg += "{0:<{space}}".format(path, space=space)
             else:
                 msg = ' ' * columns
             print(msg, file=stream or sys.stderr, end="\r", flush=True)


Test patch: