Skip to content

check: handle Ctrl-C at safe boundaries (#7893) - #9966

Draft
mr-raj12 wants to merge 1 commit into
borgbackup:masterfrom
mr-raj12:check-soft-interrupt-7893
Draft

check: handle Ctrl-C at safe boundaries (#7893)#9966
mr-raj12 wants to merge 1 commit into
borgbackup:masterfrom
mr-raj12:check-soft-interrupt-7893

Conversation

@mr-raj12

@mr-raj12 mr-raj12 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

borg check had no signal handling. The first Ctrl-C did nothing, because nothing polled the soft-interrupt flag, and the second one raised KeyboardInterrupt from wherever execution happened to be. Under --repair that could land mid-rebuild, or before finish() ran, which leaves a stale chunk index behind (#9850).

Now the pack scan, verify_data, rebuild_archives_directory and rebuild_archives check sig_int and stop at a safe boundary: chunk boundaries for the read-only scans, between whole archives for the repair rebuild. The repository check saves its PackTracker so a later run picks up where it left off. finish() runs before we raise either way, so the index and manifest stay consistent. This follows what compact already does (#9890).

Includes tests for both the read-only and --repair interrupt paths.

Fixes #7893.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.71%. Comparing base (a50eb6f) to head (a62911e).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/archive.py 83.33% 1 Missing and 1 partial ⚠️
src/borg/archiver/check_cmd.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9966      +/-   ##
==========================================
+ Coverage   85.70%   85.71%   +0.01%     
==========================================
  Files          95       95              
  Lines       16815    16860      +45     
  Branches     2577     2588      +11     
==========================================
+ Hits        14411    14452      +41     
- Misses       1668     1671       +3     
- Partials      736      737       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl-C does not interrupt borg check

1 participant