Repository: borgbackup/borg

Issue:
fix stretch vagrant box
we use the `debian/stretch64` box (currently 9.12.0) and it is broken since the apt source was moved to archive server.

we use the box to intentionally build a old borg binary that works on stretch and similarly old linux systems.

Changes needed to the box, todo for box maintainer:

- apt sources.list: the `security.` and `deb.` server do not work any more, use `archive.`!
- apt update
- apt dist-upgrade -y
- apt install rsync  # pre-install rsync so vagrant does not have to install it when booting the box
- re-package and upload to app.vagrantup.com

https://app.vagrantup.com/debian/boxes/stretch64

Note: because `vagrant up` already breaks at trying to install `rsync`, this can not be fixed easily by box users.


Discussion:
Hi, I was able to fix the issue and to repackage the vagrant box. I would like to contact the box owner (debian) to upload it to app.vagrantup.com, but until now I could not figure out how to do it. Could you give me a hint on that?
@jk4949 https://app.vagrantup.com/debian there are some infos about how to file an issue / contact them.
@ThomasWaldmann  Thank you! I have already read it... I will try to contact them...
@jk4949 did you communicate with the maintainer?
@ThomasWaldmann I still have not received any feedback .

 Is the support for the outdated system absolutely necessary or could it be replaced with a current LTS version for example?

The vagrant box of Debian/Stretch seems to be no longer maintained.
A borg binary built with an old glibc (so it can run on old Linux) depends on that.

Moved this to rc1 milestone. If the box is not fixed until then, there will be no binary built on stretch / built with a glibc as old as found on debian stretch.
todo: try https://app.vagrantup.com/generic/boxes/debian9

Update: their box is not working **yet**, but they recently fixed the apt sources, so their next box build should work again: https://github.com/lavabit/robox/commit/4053504f67b64e4f250f464bfc978ef4ffd0b86d

Update 2: the box was updated 2023-09-21, so it might work now.

Update 3: box 4.3.0 seems to work!
Due to OpenSSL 1.1.1 being EOL now, guess we won't keep the stretch box alive.

Update: OpenSSL gets built from source in that box, maybe it could use OpenSSL 3.0.x?

Please, do not drop support of "fat" binary "borg-linuxold64" (stretch) for Borg 1.2.X.

OpenVZ/Virtuozzo 7 provides "OpenSSL 1.0.2k-fips  26 Jan 2017"

I know this is absolutely outdated but OpenVZ/Virtuozzo 9 is not ready at all (beta almost unusable).

In the meantime, I will check how to build Borg from sources (I am not a dev...)

Resolving patch:
diff --git a/setup_docs.py b/setup_docs.py
--- a/setup_docs.py
+++ b/setup_docs.py
@@ -6,7 +6,7 @@
 import sys
 import textwrap
 from collections import OrderedDict
-from datetime import datetime
+from datetime import datetime, timezone
 import time
 
 from setuptools import Command
@@ -460,10 +460,8 @@ def write_man_header(self, write, title, description):
         self.write_heading(write, description, double_sided=True)
         # man page metadata
         write(':Author: The Borg Collective')
-        write(
-            ':Date:',
-            datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).date().isoformat(),
-        )
+        source_date_epoch = int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
+        write(':Date:', datetime.fromtimestamp(source_date_epoch, timezone.utc).date().isoformat())
         write(':Manual section: 1')
         write(':Manual group: borg backup tool')
         write()
diff --git a/src/borg/testsuite/helpers.py b/src/borg/testsuite/helpers.py
--- a/src/borg/testsuite/helpers.py
+++ b/src/borg/testsuite/helpers.py
@@ -1084,6 +1084,11 @@ def test_swidth_slice_mixed_characters():
     assert swidth_slice(string, 6) == '나윤a'
 
 
+def utcfromtimestamp(timestamp):
+    """Returns a naive datetime instance representing the timestamp in the UTC timezone"""
+    return datetime.fromtimestamp(timestamp, timezone.utc).replace(tzinfo=None)
+
+
 def test_safe_timestamps():
     if SUPPORT_32BIT_PLATFORMS:
         # ns fit into int64
@@ -1095,9 +1100,9 @@ def test_safe_timestamps():
         # datetime won't fall over its y10k problem
         beyond_y10k = 2 ** 100
         with pytest.raises(OverflowError):
-            datetime.utcfromtimestamp(beyond_y10k)
-        assert datetime.utcfromtimestamp(safe_s(beyond_y10k)) > datetime(2038, 1, 1)
-        assert datetime.utcfromtimestamp(safe_ns(beyond_y10k) / 1000000000) > datetime(2038, 1, 1)
+            utcfromtimestamp(beyond_y10k)
+        assert utcfromtimestamp(safe_s(beyond_y10k)) > datetime(2038, 1, 1)
+        assert utcfromtimestamp(safe_ns(beyond_y10k) / 1000000000) > datetime(2038, 1, 1)
     else:
         # ns fit into int64
         assert safe_ns(2 ** 64) <= 2 ** 63 - 1
@@ -1108,9 +1113,9 @@ def test_safe_timestamps():
         # datetime won't fall over its y10k problem
         beyond_y10k = 2 ** 100
         with pytest.raises(OverflowError):
-            datetime.utcfromtimestamp(beyond_y10k)
-        assert datetime.utcfromtimestamp(safe_s(beyond_y10k)) > datetime(2262, 1, 1)
-        assert datetime.utcfromtimestamp(safe_ns(beyond_y10k) / 1000000000) > datetime(2262, 1, 1)
+            utcfromtimestamp(beyond_y10k)
+        assert utcfromtimestamp(safe_s(beyond_y10k)) > datetime(2262, 1, 1)
+        assert utcfromtimestamp(safe_ns(beyond_y10k) / 1000000000) > datetime(2262, 1, 1)
 
 
 class TestPopenWithErrorHandling:


Test patch: