From 3d3e9572dc452fea53d328c101b3d1440bbefe40 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 20 Oct 2023 09:42:19 +0200 Subject: [PATCH 01/17] fix makefile to allow building packages with current python version It all breaks all the time, it's just like that. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7aa5a71..a0a2d0e 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ release:: clean force_release:: clean git push --tags - python3 setup.py sdist bdist_wheel + python3 -m build --sdist --wheel twine upload dist/* doc:: From 965d2d36703a60f610e4b4a3fb1b86fe244d63d5 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 06:46:10 -0400 Subject: [PATCH 02/17] Never add a vendored smmap directory to sys.path This removes the logic that appended the git submodule directory for smmap to sys.path under most circumstances when the version of gitdb was not from PyPI. Now gitdb does not modify sys.path. See https://github.com/gitpython-developers/GitPython/issues/1717 and https://github.com/gitpython-developers/GitPython/pull/1720 for context. This change is roughly equivalent to the change to GitPython, though as noted the behavior being eliminated is subtly different here and there. --- gitdb/__init__.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 803a428..9b77e9f 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -4,34 +4,12 @@ # the New BSD License: https://opensource.org/license/bsd-3-clause/ """Initialize the object database module""" -import sys -import os - -#{ Initialization - - -def _init_externals(): - """Initialize external projects by putting them into the path""" - if 'PYOXIDIZER' not in os.environ: - where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap') - if os.path.exists(where): - sys.path.append(where) - - import smmap - del smmap - # END handle imports - -#} END initialization - -_init_externals() - __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) - # default imports from gitdb.base import * from gitdb.db import * From dfbfb12beee6b2c61cb02f193fabc427e0a949f6 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 07:24:33 -0400 Subject: [PATCH 03/17] Revise and update the readme Changes worth mentioning: - Format commands as code blocks instead of blockquotes. (This is particularly useful for the submodule update step, whose lines were inadvertently concatenated, but it also improves appearance overall.) - Mention smmap as a requirement. (But also that it doesn't need to be separately installed.) - Mention that gitdb-speedups is not currently maintained. - No longer say gitdb has source code in gitorious. (Since that site no longer exists.) - Call GitPython "GitPython" rather than "git-python". - Replace the old git-python Google Groups link with a link to the Discussions page on the GitHub repository for GitPython. (This seems like the closest currently available resource.) --- README.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 29c70f7..61ce28b 100644 --- a/README.rst +++ b/README.rst @@ -16,34 +16,38 @@ Installation :target: https://readthedocs.org/projects/gitdb/?badge=latest :alt: Documentation Status -From `PyPI `_ +From `PyPI `_:: pip install gitdb SPEEDUPS ======== -If you want to go up to 20% faster, you can install gitdb-speedups with: +If you want to go up to 20% faster, you can install gitdb-speedups with:: pip install gitdb-speedups +However, please note that gitdb-speedups is not currently maintained. + REQUIREMENTS ============ +* smmap - declared as a dependency, automatically installed * pytest - for running the tests SOURCE ====== -The source is available in a git repository at gitorious and github: + +The source is available in a git repository on GitHub: https://github.com/gitpython-developers/gitdb -Once the clone is complete, please be sure to initialize the submodules using +Once the clone is complete, please be sure to initialize the submodule using:: cd gitdb git submodule update --init -Run the tests with +Run the tests with:: pytest @@ -53,13 +57,13 @@ DEVELOPMENT .. image:: https://github.com/gitpython-developers/gitdb/workflows/Python%20package/badge.svg :target: https://github.com/gitpython-developers/gitdb/actions -The library is considered mature, and not under active development. It's primary (known) use is in git-python. +The library is considered mature, and not under active development. Its primary (known) use is in GitPython. INFRASTRUCTURE ============== -* Mailing List - * http://groups.google.com/group/git-python +* Discussions + * https://github.com/gitpython-developers/GitPython/discussions * Issue Tracker * https://github.com/gitpython-developers/gitdb/issues From e998429c01f928da7ff7c922ba3f1249c43ff569 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 07:47:10 -0400 Subject: [PATCH 04/17] Set Dependabot submodule update cadence to weekly This changes it from monthly to weekly. See #99 and https://github.com/gitpython-developers/GitPython/pull/1702#issuecomment-1761182333 for context. --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5acde1a..2fe73ca 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,4 +8,4 @@ updates: - package-ecosystem: "gitsubmodule" directory: "/" schedule: - interval: "monthly" + interval: "weekly" From 24ecf58262eb2e76906689dbc4e28397f4f628dc Mon Sep 17 00:00:00 2001 From: Antoine C Date: Fri, 8 Dec 2023 16:58:24 +0100 Subject: [PATCH 05/17] fix #101 --- gitdb/test/test_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/test/test_base.py b/gitdb/test/test_base.py index 8fc9e35..17906c9 100644 --- a/gitdb/test/test_base.py +++ b/gitdb/test/test_base.py @@ -73,7 +73,7 @@ def test_streams(self): # test deltapackstream dpostream = ODeltaPackStream(*(dpinfo + (stream, ))) - dpostream.stream is stream + assert dpostream.stream is stream dpostream.read(5) stream._assert() assert stream.bytes == 5 @@ -92,7 +92,7 @@ def test_streams(self): assert istream.size == s istream.size = s * 2 - istream.size == s * 2 + assert istream.size == s * 2 assert istream.type == str_blob_type istream.type = "something" assert istream.type == "something" From 86402e67e7d999b2b2665dc1029c5e1ccd3ada35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:03:07 +0000 Subject: [PATCH 06/17] Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 73b3902..ec7550d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} allow-prereleases: ${{ matrix.experimental }} From 5aeb6e073ebe007d43695976eccdcca64568d025 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:39:28 +0000 Subject: [PATCH 07/17] Bump gitdb/ext/smmap from `256c5a2` to `04dd210` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `256c5a2` to `04dd210`. - [Commits](https://github.com/gitpython-developers/smmap/compare/256c5a21de2d14aca02c9689d7d63f78c4e0ef61...04dd2103ee6e0b7483889e5feda25053c6df2b52) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 256c5a2..04dd210 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 256c5a21de2d14aca02c9689d7d63f78c4e0ef61 +Subproject commit 04dd2103ee6e0b7483889e5feda25053c6df2b52 From d50b2e3245f472637c6b86722d6dd969fb4c7183 Mon Sep 17 00:00:00 2001 From: Almaz Ilaletdinov Date: Sun, 9 Jun 2024 14:00:05 +0300 Subject: [PATCH 08/17] Use contextlib.suppress instead of except: pass --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 256fec9..87cde86 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -2,6 +2,8 @@ # # This module is part of GitDB and is released under # the New BSD License: https://opensource.org/license/bsd-3-clause/ +from contextlib import suppress + from gitdb.db.base import ( FileDBBase, ObjectDBR, @@ -90,10 +92,8 @@ def readable_db_object_path(self, hexsha): """ :return: readable object path to the object identified by hexsha :raise BadObject: If the object file does not exist""" - try: + with suppress(KeyError): return self._hexsha_to_file[hexsha] - except KeyError: - pass # END ignore cache misses # try filesystem From 5bc95043792c2412b05263fb4bfca67d7923645c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 01:01:55 -0600 Subject: [PATCH 09/17] Add support for Python 3.13 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 73b3902..8e0ff8e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] include: - experimental: false continue-on-error: ${{ matrix.experimental }} diff --git a/setup.py b/setup.py index f67f7a5..51065c9 100755 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3 :: Only", ] ) From b38cbc43354523ffcd59a58c5a3aded054bd4442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 01:05:50 -0600 Subject: [PATCH 10/17] Use older ubuntu to get Python 3.7 --- .github/workflows/pythonpackage.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 8e0ff8e..40e1c0a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -8,12 +8,17 @@ on: [push, pull_request, workflow_dispatch] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + os: [ubuntu-latest] + experimental: [false] include: - - experimental: false + - python-version: "3.7" + os: ubuntu-22.04 + experimental: false continue-on-error: ${{ matrix.experimental }} steps: From 74a0eabbc03209593ea1562498802359ae8a3db7 Mon Sep 17 00:00:00 2001 From: Jonathan Dekhtiar Date: Mon, 23 Dec 2024 23:02:58 -0500 Subject: [PATCH 11/17] Potential Race Condition Fix - OS Rename & Chmod --- gitdb/db/loose.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 87cde86..ccefe40 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -54,6 +54,7 @@ import tempfile import os import sys +import time __all__ = ('LooseObjectDB', ) @@ -205,7 +206,7 @@ def store(self, istream): # END assure target stream is closed except: if tmp_path: - os.remove(tmp_path) + remove(tmp_path) raise # END assure tmpfile removal on error @@ -228,9 +229,25 @@ def store(self, istream): rename(tmp_path, obj_path) # end rename only if needed - # make sure its readable for all ! It started out as rw-- tmp file - # but needs to be rwrr - chmod(obj_path, self.new_objects_mode) + # Ensure rename is actually done and file is stable + # Retry up to 14 times - exponential wait & retry in ms. + # The total maximum wait time is 1000ms, which should be vastly enough for the + # OS to return and commit the file to disk. + for exp_backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: + with suppress(PermissionError): + # make sure its readable for all ! It started out as rw-- tmp file + # but needs to be rwrr + chmod(obj_path, self.new_objects_mode) + break + time.sleep(exp_backoff_ms / 1000.0) + else: + raise PermissionError( + "Impossible to apply `chmod` to file {}".format(obj_path) + ) + + # Cleanup + with suppress(FileNotFoundError): + remove(tmp_path) # END handle dry_run istream.binsha = hex_to_bin(hexsha) From b71e2730c3dcab148816f0193a45550ef0a38c79 Mon Sep 17 00:00:00 2001 From: Jonathan DEKHTIAR Date: Sun, 29 Dec 2024 19:44:26 -0500 Subject: [PATCH 12/17] Update gitdb/db/loose.py Co-authored-by: Sebastian Thiel --- gitdb/db/loose.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index ccefe40..03d387e 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -245,9 +245,6 @@ def store(self, istream): "Impossible to apply `chmod` to file {}".format(obj_path) ) - # Cleanup - with suppress(FileNotFoundError): - remove(tmp_path) # END handle dry_run istream.binsha = hex_to_bin(hexsha) From 104138c742a56d85bd2cb2cd8a9f90336daa5483 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 2 Jan 2025 08:15:19 +0100 Subject: [PATCH 13/17] bump patch level to prepare for next release --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 0b8de13..b4340e4 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +4.0.12 +****** + +- various improvements - please see the release on GitHub for details. + ****** 4.0.11 ****** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 9b77e9f..1fb7df8 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 11) +version_info = (4, 0, 12) __version__ = '.'.join(str(i) for i in version_info) # default imports diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 04dd210..f31bfa3 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 04dd2103ee6e0b7483889e5feda25053c6df2b52 +Subproject commit f31bfa378c8840d38d31e7e11ef2b84f191a491e diff --git a/setup.py b/setup.py index 51065c9..3a91543 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 11) +version_info = (4, 0, 12) __version__ = '.'.join(str(i) for i in version_info) setup( From 775cfe8299ea5474f605935469359a9d1cdb49dc Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 2 Jan 2025 08:20:58 +0100 Subject: [PATCH 14/17] update scripts to allow release (copied from smmap) --- Makefile | 42 +++++++----------------------------------- build-release.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 35 deletions(-) create mode 100755 build-release.sh diff --git a/Makefile b/Makefile index a0a2d0e..20436bb 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,12 @@ -PYTHON = python3 -SETUP = $(PYTHON) setup.py -TESTFLAGS = +.PHONY: all clean release force_release -all:: +all: @grep -Ee '^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all -release:: clean - # Check if latest tag is the current head we're releasing - echo "Latest tag = $$(git tag | sort -nr | head -n1)" - echo "HEAD SHA = $$(git rev-parse head)" - echo "Latest tag SHA = $$(git tag | sort -nr | head -n1 | xargs git rev-parse)" - @test "$$(git rev-parse head)" = "$$(git tag | sort -nr | head -n1 | xargs git rev-parse)" - make force_release +clean: + rm -rf build/ dist/ .eggs/ .tox/ -force_release:: clean - git push --tags - python3 -m build --sdist --wheel +force_release: clean + ./build-release.sh twine upload dist/* - -doc:: - make -C doc/ html - -build:: - $(SETUP) build - $(SETUP) build_ext -i - -build_ext:: - $(SETUP) build_ext -i - -install:: - $(SETUP) install - -clean:: - $(SETUP) clean --all - rm -f *.so - -coverage:: build - PYTHONPATH=. $(PYTHON) -m pytest --cov=gitdb gitdb - + git push --tags origin master diff --git a/build-release.sh b/build-release.sh new file mode 100755 index 0000000..5840e44 --- /dev/null +++ b/build-release.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# This script builds a release. If run in a venv, it auto-installs its tools. +# You may want to run "make release" instead of running this script directly. + +set -eEu + +function release_with() { + $1 -m build --sdist --wheel +} + +if test -n "${VIRTUAL_ENV:-}"; then + deps=(build twine) # Install twine along with build, as we need it later. + echo "Virtual environment detected. Adding packages: ${deps[*]}" + pip install --quiet --upgrade "${deps[@]}" + echo 'Starting the build.' + release_with python +else + function suggest_venv() { + venv_cmd='python -m venv env && source env/bin/activate' + printf "HELP: To avoid this error, use a virtual-env with '%s' instead.\n" "$venv_cmd" + } + trap suggest_venv ERR # This keeps the original exit (error) code. + echo 'Starting the build.' + release_with python3 # Outside a venv, use python3. +fi From 26209528a0303e47c88c174184adbf25d206a824 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 5 Jan 2025 03:21:33 -0500 Subject: [PATCH 15/17] Add SECURITY.md, referencing GitPython's Along with https://github.com/gitpython-developers/smmap/pull/59 and a forthcoming related PR in GitPython, this will fix #116. --- SECURITY.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..95389ff --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +# Security Policy + +See [GitPython](https://github.com/gitpython-developers/GitPython/blob/main/SECURITY.md). Vulnerabilities found in `gitdb` can be reported there. From 4fe56572894f9668c1ffd0808c96aed27c65e584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 10:38:13 +0000 Subject: [PATCH 16/17] Bump gitdb/ext/smmap from `f31bfa3` to `8f82e6c` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `f31bfa3` to `8f82e6c`. - [Release notes](https://github.com/gitpython-developers/smmap/releases) - [Commits](https://github.com/gitpython-developers/smmap/compare/f31bfa378c8840d38d31e7e11ef2b84f191a491e...8f82e6c19661f9b735cc55cc89031a189e408894) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index f31bfa3..8f82e6c 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit f31bfa378c8840d38d31e7e11ef2b84f191a491e +Subproject commit 8f82e6c19661f9b735cc55cc89031a189e408894 From b4fd74ce8e28c372c511db2e0a491fa8b67c93f4 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 26 Jan 2025 11:51:11 -0500 Subject: [PATCH 17/17] Improve description of backoff sequence in db.loose The sequence of backoff wait times used in `gitdb.db.loose` is quadratic rather than exponential, as discussed in: https://github.com/gitpython-developers/gitdb/pull/115#discussion_r1903215598 This corrects the variable name by making it more general, and the comment by having it explicitly describe the backoff as quadratic. This is conceptually related to GitoxideLabs/gitoxide#1815, but this is a non-breaking change, as no interfaces are affected: only a local variable and comment. --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 03d387e..e6765cd 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -230,16 +230,16 @@ def store(self, istream): # end rename only if needed # Ensure rename is actually done and file is stable - # Retry up to 14 times - exponential wait & retry in ms. + # Retry up to 14 times - quadratic wait & retry in ms. # The total maximum wait time is 1000ms, which should be vastly enough for the # OS to return and commit the file to disk. - for exp_backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: + for backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: with suppress(PermissionError): # make sure its readable for all ! It started out as rw-- tmp file # but needs to be rwrr chmod(obj_path, self.new_objects_mode) break - time.sleep(exp_backoff_ms / 1000.0) + time.sleep(backoff_ms / 1000.0) else: raise PermissionError( "Impossible to apply `chmod` to file {}".format(obj_path)