Ctrl-C does not interrupt borg check
Using borg 1.2.6.
Running borg check -p.
Apart from printing '^C', Ctrl-C doesn't have an effect.
Pressing Ctrl-C twice didn't abort borg check.
Originally posted by @rvanlaar in https://github.com/borgbackup/borg/issues/6057
For create, borg behaves like this:
Pressing Ctrl-C once should make a checkpoint / commit the repo (that can take a while) and then abort.
Pressing Ctrl-C twice aborts immediately.
Reproducing:
with remote (ssh://...) repo
- while doing the repository-part of check: interrupting with Ctrl-C is not possible (1, 2, any amount)
- while doing the archives-part of check: 2x Ctrl-C aborts the check
with local repo
- while doing the repository-part of check: 2x Ctrl-C aborts the check
- while doing the archives-part of check: (not tested, but I assume that 2x Ctrl-C aborts the check)
Guess that the repository part of the check running on the remote side might cause this problem.
Hmm, this might be difficult to fix in borg 1.x:
- we ignore sigint for the ssh subprocess (because it must not be killed for clean borg shutdown)
- it is the ssh subprocess that outputs the remote output of
Repository.check() - there is no output from the borg client process in this phase
Guess this likely has changed due to the sigint ctrl-c related fix a while ago:
- the fix was not to let Ctrl-C (SIGINT) kill the ssh subprocess, because the ssh connection is needed for clean shutdown of borg.
- after the fix, because ssh is not killed by Ctrl-C any more, there is no way to interrupt borg if there is no local terminal output of borg.
Likely, this is a borg1 problem only.
In borg2, logging works very differently and in a way that does not have this problem.
Workaround: shoot the ssh subprocess of borg in some other way, like e.g.: kill <pid_of_ssh_subprocess>