Skip to content

v1.0.9 — Reliability & correctness fixes

Latest

Choose a tag to compare

@djekl djekl released this 13 Jun 14:29
151530d

What's changed

This release is a significant reliability overhaul following a full code audit. All changes are backwards-compatible — existing configs and volume mounts continue to work without modification.

Bug fixes

  • Empty repository crash — repos with no commits (rev-parse HEAD → exit 128) previously printed Backup failed. They are now silently skipped with a clear Skipping …: empty repository message.
  • Single-token run always exited with code 1 — backup_repositories_for_token never returned a value; main() treated the implicit None as failure and called sys.exit(1) even on a successful run.
  • Token config parsing — indexing tokens_config[0] without a type check meant a plain string token would be iterated character-by-character. Now handles str (split on comma), list (including a single comma-separated element), and exits cleanly on missing/empty/wrong-type config.
  • mkdir return value — mkdir always returned True, so "Created directory" was printed even when the directory already existed. Now returns True only on actual creation.
  • Bare except: in mkdir — replaced with except OSError: so signals such as KeyboardInterrupt are not swallowed silently.
  • Dead EEXIST branch — the except Exception / errno.errorcode branch in mkdir was unreachable with exist_ok=True and has been removed along with the unused errno import.
  • download_zip error handling — the warning print was commented out (failures were silent); it has been restored. The catch now covers all RequestException (timeouts, connection errors) instead of only HTTPError. Uses the shared session object instead of a bare requests.get.
  • shlex.split injection risk in mirror_repo — building a shell string and splitting it risked misparse if base_path contained a quote character. Replaced with a direct argument list passed to execve.
  • Config overwritten on every container restart — backup.sh unconditionally copied config.json.example over config.json on each start, discarding any volume-mounted or previously written config. Now seeds the example only when no config.json exists.

Improvements

  • Disable Git auto-GC — git config --global gc.auto 0 is set in backup.sh to prevent Git's automatic garbage collection from running mid-backup and interfering with mirror clones.
  • Removed duplicate backup_single_repo definition — a copy-paste leftover that silently shadowed the first definition.