Skip to content

#258's regression test writes the cooldown marker to a path the hook no longer reads, so every corrupt value passes trivially #324

Closed

Description

@jmossie82

Summary

test_a_corrupt_cooldown_marker_does_not_kill_the_hook (tests/test_git_backup_silent_stops_257.py) writes the marker to a path the hook no longer reads, so every corrupt value passes trivially and #258's regression is currently unguarded.

The mismatch

  • Test writes <store>/.last-git-backup-ts (:433).
  • Hook resolves the marker through _gb_common_dir and reads $GB_STATE_DIR/last-git-backup-ts, i.e. <store>/.git/remember/last-git-backup-ts (50-git-backup.sh:125, :155).

Confirmed by running a backup and globbing for the file rather than by reading the code:

marker files created:
    .git/remember/last-git-backup-ts = 1786175184
legacy dotted path exists? False

The cleanup helper at the top of the same file already globs both names (:458-459), which looks like the trace of the path having moved.

Consequence

With the marker written where the hook reads it, 08 reaches the arithmetic and bash reports line 172: 08: value too great for base — the octal case a digits-only guard cannot catch. Written to the dotted path, the cooldown block is never entered at all, so the test asserts nothing about the guard it exists to protect.

Fixing the path is necessary but not sufficient

Measured on /bin/bash 3.2.57: with 08 at the real path the hook prints the octal diagnostic but still returns rc=0 and commits, because the failing arithmetic abandons the whole if/then body and $ELAPSED is never referenced. So the existing assertions (proc.returncode == 0, _slug_is_committed) stay green on the macOS leg while the same input behaves differently on newer bash.

Asserting on proc.stderr makes it fail on any version:

for _phrase in ("syntax error", "invalid arithmetic operator",
                "value too great for base"):
    assert _phrase not in proc.stderr

With the path fixed and that assertion added, 08/09 fail against the current hook and pass once 10# is added after the existing case guard.

Scope

Filing this separately from #322 on purpose: it is a test-coverage bug in 50-git-backup.sh's suite, independent of the save-session.sh reads that issue is about. I have the patch and can open a PR if useful — say which you'd prefer.

Activity

  1. added a commit that references this issue on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions