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

Issue:
--timestamp time (vs list time)
The time set with `--timestamp` is the end time, whereas `list` shows the start time, e.g.:

```
$ borg create --timestamp 2017-01-01T00:00:00 ::foo bar
$ borg list
foo                                  Sat, 2016-12-31 23:59:59
$ borg info ::foo
[...]
Time (start): Sat, 2016-12-31 23:59:59
Time (end):   Sun, 2017-01-01 00:00:00
Command line: borg create --timestamp 2017-01-01T00:00:00 ::foo bar
[...]
```

Having a start and end time is weird with only a single timestamp given. But if current design should not be changed and the start time is considered the important one, that's what `--timestamp` should set.


Discussion:
I'll have a look. Sounds like a bug, but I have to look at docs and past behaviour.
stable and also latest docs:
```
  --timestamp yyyy-mm-ddThh:mm:ss
                        manually specify the archive creation date/time (UTC).
                        alternatively, give a reference file/directory.
```
So, it is not specified there.

But somehow the end time does not make sense, also `borg list` gives the start time (and that's also what we have in the manifest), so guess it is a bug.


Resolving patch:
diff --git a/borg/archive.py b/borg/archive.py
--- a/borg/archive.py
+++ b/borg/archive.py
@@ -307,15 +307,13 @@ def save(self, name=None, timestamp=None):
         self.items_buffer.flush(flush=True)
         duration = timedelta(seconds=time.monotonic() - self.start_monotonic)
         if timestamp is None:
-            self.end = datetime.utcnow()
-            self.start = self.end - duration
-            start = self.start
-            end = self.end
+            end = datetime.utcnow()
+            start = end - duration
         else:
-            self.end = timestamp
-            self.start = timestamp - duration
-            end = timestamp
-            start = self.start
+            end = timestamp + duration
+            start = timestamp
+        self.start = start
+        self.end = end
         metadata = StableDict({
             'version': 1,
             'name': name,


Test patch:
Repository: borgbackup/borg

Issue:
netbsd: fuse error msg confuses test
```
    def test_detect_attic_repo(self):
        path = attic_repo(self.repository_path)
        cmds = [
            ['create', path + '::test', self.tmpdir],
            ['extract', path + '::test'],
            ['check', path],
            ['rename', path + '::test', 'newname'],
            ['list', path],
            ['delete', path],
            ['prune', path],
            ['info', path + '::test'],
            ['mount', path, self.tmpdir],
            ['key', 'export', path, 'exported'],
            ['key', 'import', path, 'import'],
            ['change-passphrase', path],
            ['break-lock', path],
        ]
        for args in cmds:
            output = self.cmd(*args, fork=True, exit_code=2)
>           assert 'Attic repository detected.' in output
E           AssertionError: assert 'Attic repository detected.' in "borg mount not available: loading FUSE support failed [ImportError: No module named 'llfuse']\n"

.tox/py34/lib/python3.4/site-packages/borg/testsuite/archiver.py:2756: AssertionError
```


Discussion:
same for openbsd.

Resolving patch:
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -2745,7 +2745,6 @@ def test_detect_attic_repo(self):
             ['delete', path],
             ['prune', path],
             ['info', path + '::test'],
-            ['mount', path, self.tmpdir],
             ['key', 'export', path, 'exported'],
             ['key', 'import', path, 'import'],
             ['change-passphrase', path],


Test patch:
Repository: borgbackup/borg

Issue:
netbsd: no readline
Python build missing readline, likely:
```
    def import_paperkey(self, args):
        # imported here because it has global side effects
>       import readline
E       ImportError: No module named 'readline'

.tox/py34/lib/python3.4/site-packages/borg/crypto/keymanager.py:146: ImportError
```


Discussion:
If this can't be easily installed as an extra package (=> should be documented), then paperkey should be able to do without readline. I think it only uses the input()-side effect of RL, so no big deal.

Resolving patch:
diff --git a/src/borg/crypto/keymanager.py b/src/borg/crypto/keymanager.py
--- a/src/borg/crypto/keymanager.py
+++ b/src/borg/crypto/keymanager.py
@@ -142,8 +142,11 @@ def import_keyfile(self, args):
         self.store_keyblob(args)
 
     def import_paperkey(self, args):
-        # imported here because it has global side effects
-        import readline
+        try:
+            # imported here because it has global side effects
+            import readline
+        except ImportError:
+            print('Note: No line editing available due to missing readline support')
 
         repoid = bin_to_hex(self.repository.id)[:18]
         try:
@@ -151,8 +154,8 @@ def import_paperkey(self, args):
                 # id line input
                 while True:
                     idline = input('id: ').replace(' ', '')
-                    if idline == "":
-                        if yes("Abort import? [yN]:"):
+                    if idline == '':
+                        if yes('Abort import? [yN]:'):
                             raise EOFError()
 
                     try:
@@ -184,8 +187,8 @@ def import_paperkey(self, args):
                 while True:
                     inline = input('{0:2d}: '.format(idx))
                     inline = inline.replace(' ', '')
-                    if inline == "":
-                        if yes("Abort import? [yN]:"):
+                    if inline == '':
+                        if yes('Abort import? [yN]:'):
                             raise EOFError()
                     try:
                         (data, checksum) = inline.split('-')


Test patch:
Repository: borgbackup/borg

Issue:
Social media?
Ẁhat about creating, Twitter, GNUSocial/Mastodon or similar accounts?

(You can tag this with "community".)


Discussion:
https://twitter.com/@borgbackup
Ui, did not noticed it. Then maybe advertise that link on your website or (if that is possible) [GitHub organisation](https://github.com/borgbackup) or so. And as a FLOSS product, the idea to also be on GNUSocial/Mastodon is still there.
Well, personally I won't join social networks just to promote borg there.

But if I am using something anyway, it may happen that I operate a separate account for borg-news there.

I am not yet using GNUSocial/Mastodon and thay may or may not happen in the future.

I am fine with other regular contributors operating "borgbackup" accounts on other social networks. They just need to be prepared to get support or other questions (and also they likely should redistribute important announcements).

So, TODO for this ticket is imho to document our twitter account.

Note: the "how to release" docs in the development section mention my personal twitter account, that should be removed and replaced by @borgbackup at a better visible place.

Resolving patch:
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -2520,6 +2520,11 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
         change_passphrase_epilog = process_epilog("""
         The key files used for repository encryption are optionally passphrase
         protected. This command can be used to change this passphrase.
+
+        Please note that this command only changes the passphrase, but not any
+        secret protected by it (like e.g. encryption/MAC keys or chunker seed).
+        Thus, changing the passphrase after passphrase and borg key got compromised
+        does not protect future (nor past) backups to the same repository.
         """)
         subparser = key_parsers.add_parser('change-passphrase', parents=[common_parser], add_help=False,
                                           description=self.do_change_passphrase.__doc__,


Test patch:
Repository: borgbackup/borg

Issue:
Social media?
Ẁhat about creating, Twitter, GNUSocial/Mastodon or similar accounts?

(You can tag this with "community".)


Discussion:
https://twitter.com/@borgbackup
Ui, did not noticed it. Then maybe advertise that link on your website or (if that is possible) [GitHub organisation](https://github.com/borgbackup) or so. And as a FLOSS product, the idea to also be on GNUSocial/Mastodon is still there.
Well, personally I won't join social networks just to promote borg there.

But if I am using something anyway, it may happen that I operate a separate account for borg-news there.

I am not yet using GNUSocial/Mastodon and thay may or may not happen in the future.

I am fine with other regular contributors operating "borgbackup" accounts on other social networks. They just need to be prepared to get support or other questions (and also they likely should redistribute important announcements).

So, TODO for this ticket is imho to document our twitter account.

Note: the "how to release" docs in the development section mention my personal twitter account, that should be removed and replaced by @borgbackup at a better visible place.

Resolving patch:
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -2717,6 +2717,11 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
         change_passphrase_epilog = process_epilog("""
         The key files used for repository encryption are optionally passphrase
         protected. This command can be used to change this passphrase.
+
+        Please note that this command only changes the passphrase, but not any
+        secret protected by it (like e.g. encryption/MAC keys or chunker seed).
+        Thus, changing the passphrase after passphrase and borg key got compromised
+        does not protect future (nor past) backups to the same repository.
         """)
         subparser = key_parsers.add_parser('change-passphrase', parents=[common_parser], add_help=False,
                                           description=self.do_change_passphrase.__doc__,


Test patch:
Repository: borgbackup/borg

Issue:
Social media?
Ẁhat about creating, Twitter, GNUSocial/Mastodon or similar accounts?

(You can tag this with "community".)


Discussion:
https://twitter.com/@borgbackup
Ui, did not noticed it. Then maybe advertise that link on your website or (if that is possible) [GitHub organisation](https://github.com/borgbackup) or so. And as a FLOSS product, the idea to also be on GNUSocial/Mastodon is still there.
Well, personally I won't join social networks just to promote borg there.

But if I am using something anyway, it may happen that I operate a separate account for borg-news there.

I am not yet using GNUSocial/Mastodon and thay may or may not happen in the future.

I am fine with other regular contributors operating "borgbackup" accounts on other social networks. They just need to be prepared to get support or other questions (and also they likely should redistribute important announcements).

So, TODO for this ticket is imho to document our twitter account.

Note: the "how to release" docs in the development section mention my personal twitter account, that should be removed and replaced by @borgbackup at a better visible place.

Resolving patch:
diff --git a/borg/archiver.py b/borg/archiver.py
--- a/borg/archiver.py
+++ b/borg/archiver.py
@@ -1257,6 +1257,11 @@ def build_parser(self, args=None, prog=None):
         change_passphrase_epilog = textwrap.dedent("""
         The key files used for repository encryption are optionally passphrase
         protected. This command can be used to change this passphrase.
+
+        Please note that this command only changes the passphrase, but not any
+        secret protected by it (like e.g. encryption/MAC keys or chunker seed).
+        Thus, changing the passphrase after passphrase and borg key got compromised
+        does not protect future (nor past) backups to the same repository.
         """)
         subparser = subparsers.add_parser('change-passphrase', parents=[common_parser],
                                           description=self.do_change_passphrase.__doc__,


Test patch:
Repository: borgbackup/borg

Issue:
1.1.0rc4: pyi-binary subprocess env broken when LD_LIBRARY_PATH is empty
There is a small bug in the rc4 **pyinstaller-made single-file binaries** (it does not affect other installation methods, only when you use the pyinstaller-made binary).

You can work around it by:

```
export LD_LIBRARY_PATH=/doesntexist
```

Cause: wrong assumption about "else" branch in https://github.com/borgbackup/borg/pull/3060/commits/5dd16672c0e82e1bde24c53a45629527bda77d2a.

We still need the else-branch with pyi v3.2.1 because it is not only for ancient pyinstallers that do not support LD_LIBRARY_PATH_ORIG at all, but also for the case when LD_LIBRARY_PATH was not set when pyinstaller bootloader gets executed. It won't put LD_LIBRARY_PATH_ORIG into the environment in that case.


Discussion:

Resolving patch:
diff --git a/src/borg/helpers/process.py b/src/borg/helpers/process.py
--- a/src/borg/helpers/process.py
+++ b/src/borg/helpers/process.py
@@ -1,6 +1,7 @@
 import contextlib
 import os
 import os.path
+import re
 import shlex
 import signal
 import subprocess
@@ -130,14 +131,27 @@ def prepare_subprocess_env(system, env=None):
     """
     env = dict(env if env is not None else os.environ)
     if system:
-        # a pyinstaller binary's bootloader modifies LD_LIBRARY_PATH=/tmp/_ME...,
+        # a pyinstaller binary's bootloader modifies LD_LIBRARY_PATH=/tmp/_MEIXXXXXX,
         # but we do not want that system binaries (like ssh or other) pick 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
+        lp_orig = env.get(lp_key + '_ORIG')  # pyinstaller >= 20160820 / v3.2.1 has this
         if lp_orig is not None:
             env[lp_key] = lp_orig
+        else:
+            # We get here in 2 cases:
+            # 1. when not running a pyinstaller-made binary.
+            #    in this case, we must not kill LDLP.
+            # 2. when running a pyinstaller-made binary and there was no LDLP
+            #    in the original env (in this case, the pyinstaller bootloader
+            #    does *not* put ..._ORIG into the env either).
+            #    in this case, we must kill LDLP.
+            # The directory used by pyinstaller is created by mkdtemp("_MEIXXXXXX"),
+            # we can use that to differentiate between the cases.
+            lp = env.get(lp_key)
+            if lp is not None and re.search(r'/_MEI......', lp):
+                env.pop(lp_key)
     # security: do not give secrets to subprocess
     env.pop('BORG_PASSPHRASE', None)
     # for information, give borg version to the subprocess


Test patch:
Repository: borgbackup/borg

Issue:
1.1.0rc4: pyi-binary subprocess env broken when LD_LIBRARY_PATH is empty
There is a small bug in the rc4 **pyinstaller-made single-file binaries** (it does not affect other installation methods, only when you use the pyinstaller-made binary).

You can work around it by:

```
export LD_LIBRARY_PATH=/doesntexist
```

Cause: wrong assumption about "else" branch in https://github.com/borgbackup/borg/pull/3060/commits/5dd16672c0e82e1bde24c53a45629527bda77d2a.

We still need the else-branch with pyi v3.2.1 because it is not only for ancient pyinstallers that do not support LD_LIBRARY_PATH_ORIG at all, but also for the case when LD_LIBRARY_PATH was not set when pyinstaller bootloader gets executed. It won't put LD_LIBRARY_PATH_ORIG into the environment in that case.


Discussion:

Resolving patch:
diff --git a/src/borg/helpers.py b/src/borg/helpers.py
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -2330,14 +2330,27 @@ def prepare_subprocess_env(system, env=None):
     """
     env = dict(env if env is not None else os.environ)
     if system:
-        # a pyinstaller binary's bootloader modifies LD_LIBRARY_PATH=/tmp/_ME...,
+        # a pyinstaller binary's bootloader modifies LD_LIBRARY_PATH=/tmp/_MEIXXXXXX,
         # but we do not want that system binaries (like ssh or other) pick 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
+        lp_orig = env.get(lp_key + '_ORIG')  # pyinstaller >= 20160820 / v3.2.1 has this
         if lp_orig is not None:
             env[lp_key] = lp_orig
+        else:
+            # We get here in 2 cases:
+            # 1. when not running a pyinstaller-made binary.
+            #    in this case, we must not kill LDLP.
+            # 2. when running a pyinstaller-made binary and there was no LDLP
+            #    in the original env (in this case, the pyinstaller bootloader
+            #    does *not* put ..._ORIG into the env either).
+            #    in this case, we must kill LDLP.
+            # The directory used by pyinstaller is created by mkdtemp("_MEIXXXXXX"),
+            # we can use that to differentiate between the cases.
+            lp = env.get(lp_key)
+            if lp is not None and re.search(r'/_MEI......', lp):
+                env.pop(lp_key)
     # security: do not give secrets to subprocess
     env.pop('BORG_PASSPHRASE', None)
     # for information, give borg version to the subprocess


Test patch:
Repository: borgbackup/borg

Issue:
1.1.0rc4: pyi-binary subprocess env broken when LD_LIBRARY_PATH is empty
There is a small bug in the rc4 **pyinstaller-made single-file binaries** (it does not affect other installation methods, only when you use the pyinstaller-made binary).

You can work around it by:

```
export LD_LIBRARY_PATH=/doesntexist
```

Cause: wrong assumption about "else" branch in https://github.com/borgbackup/borg/pull/3060/commits/5dd16672c0e82e1bde24c53a45629527bda77d2a.

We still need the else-branch with pyi v3.2.1 because it is not only for ancient pyinstallers that do not support LD_LIBRARY_PATH_ORIG at all, but also for the case when LD_LIBRARY_PATH was not set when pyinstaller bootloader gets executed. It won't put LD_LIBRARY_PATH_ORIG into the environment in that case.


Discussion:

Resolving patch:
diff --git a/borg/helpers.py b/borg/helpers.py
--- a/borg/helpers.py
+++ b/borg/helpers.py
@@ -1576,14 +1576,27 @@ def prepare_subprocess_env(system, env=None):
     """
     env = dict(env if env is not None else os.environ)
     if system:
-        # a pyinstaller binary's bootloader modifies LD_LIBRARY_PATH=/tmp/_ME...,
+        # a pyinstaller binary's bootloader modifies LD_LIBRARY_PATH=/tmp/_MEIXXXXXX,
         # but we do not want that system binaries (like ssh or other) pick 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
+        lp_orig = env.get(lp_key + '_ORIG')  # pyinstaller >= 20160820 / v3.2.1 has this
         if lp_orig is not None:
             env[lp_key] = lp_orig
+        else:
+            # We get here in 2 cases:
+            # 1. when not running a pyinstaller-made binary.
+            #    in this case, we must not kill LDLP.
+            # 2. when running a pyinstaller-made binary and there was no LDLP
+            #    in the original env (in this case, the pyinstaller bootloader
+            #    does *not* put ..._ORIG into the env either).
+            #    in this case, we must kill LDLP.
+            # The directory used by pyinstaller is created by mkdtemp("_MEIXXXXXX"),
+            # we can use that to differentiate between the cases.
+            lp = env.get(lp_key)
+            if lp is not None and re.search(r'/_MEI......', lp):
+                env.pop(lp_key)
     # security: do not give secrets to subprocess
     env.pop('BORG_PASSPHRASE', None)
     # for information, give borg version to the subprocess


Test patch:
Repository: borgbackup/borg

Issue:
build_man issues
```
building man page borg-recreate(1)
building man page borg-rename(1)
building man page borg-serve(1)
building man page borg-umount(1)
building man page borg-upgrade(1)
building man page borg-with-lock(1)
building man page borg-patterns(1)
building man page borg-placeholders(1)
building man page borg-compression(1)
building man page borg(1)
docs/usage_general.rst.inc:410: (ERROR/3) Unknown interpreted text role "issue".
docs/usage_general.rst.inc:412: (ERROR/3) Unknown interpreted text role "issue".
docs/usage_general.rst.inc:413: (ERROR/3) Unknown interpreted text role "issue".
docs/usage_general.rst.inc:: (WARNING/2) "table row spanning" not supported
docs/usage_general.rst.inc:: (WARNING/2) "table row spanning" not supported
docs/usage_general.rst.inc:: (WARNING/2) "table cell spanning" not supported
docs/usage_general.rst.inc:: (WARNING/2) "table row spanning" not supported
```


Discussion:
This is not only a error msg on the terminal, the error msg also gets written into the man page:

```
       [1]  Only "nodump", "immutable", "compressed" and "append" are supported.  Feature request
            :issue:`618`
             for more flags.

       System Message: ERROR/3 (docs/usage_general.rst.inc:, line 410)
            Unknown interpreted text role "issue".
```

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -657,6 +657,13 @@ def write_see_also(self, write, man_title):
     def gen_man_page(self, name, rst):
         from docutils.writers import manpage
         from docutils.core import publish_string
+        from docutils.nodes import inline
+        from docutils.parsers.rst import roles
+
+        def issue(name, rawtext, text, lineno, inliner, options={}, content=[]):
+            return [inline(rawtext, '#' + text)], []
+
+        roles.register_local_role('issue', issue)
         # We give the source_path so that docutils can find relative includes
         # as-if the document where located in the docs/ directory.
         man_page = publish_string(source=rst, source_path='docs/virtmanpage.rst', writer=manpage.Writer())


Test patch: