ux: borg check asks for passphrase very late
while running check on my repo i noticed, that borg check will ask for a passphrase after the segment check instead of before the checks start
thats about 50 minutes in for me, and pain wrt interactivity of a largely unattended process
Maybe this can be solved by some docs:
- the passphrase can be put in a env var, so it won't ask
- using --repository-only and --archives-only one can split the check into 2 runs
Documenting this could help, but only if the user looks at the documentation every time. It would be more useful if borg check printed at start-up something like "You will be prompted for the passphrase after the repository check is done, which could take a long time. Set BORG_PASSPHRASE to avoid this." (unless BORG_PASSPHRASE is set).
Still, I was hoping this one would be easy enough to just fix, avoiding the docs and workarounds. :)
By the way, I'm pretty sure 1.0.11 used to show % progress as it ran borg check, but 1.1.0 doesn't, so I can't even estimate how long I have to wait.
Also, borg should make sure to verify the entered passphrase immediately (from #3153 - just wanted to note it here). This should apply whether the user enters it or it's read from BORG_PASSPHRASE, otherwise the user might come back much later to find that only half of the operation they wanted was done.
The problem with asking for the passphrase (and setting up the key object) early is that we need a valid chunk for this. The current code just uses the first chunk id given by the repo index.
But the repo index is rebuilt in first phase, so we can only be rather sure to get a valid chunk after that.
So I guess displaying a hint about that a passphrase might be required for archive checking phase and how to give it early (env var) is the best we can easily do.
A hint is much better than nothing, but still really annoying if the passphrase is wrong. If I do something like borg list it verifies the passphrase quite quickly. Why can't borg check do whatever borg list does early on (just to check the passphrase)?
For well-working repos, it could be done early (and maybe the passphrase just written into process env internally).
For damaged repos (or lost chunks cache), we first need to do some other stuff before getting a valid chunk, see above.
Hmm, fair enough. The repo is probably not damaged most of the time (I'm just running check to make sure), so maybe borg could attempt to get a valid chunk, but continue if that fails?
an early warning if the chunk getting failed would be fabulous