borg icon indicating copy to clipboard operation
borg copied to clipboard

Exit with an error if more than one of BORG_PASS* envvar is set

Open arjunak234 opened this issue 7 months ago • 1 comments

I'm creating a new repo with BORG_PASSCOMMAND, but a week ago i had set the BORG_PASSPHRASE var to access a different repo. Now for creation of the new repo, borg will silently use the old incorrect password in BORG_PASSPHRASE and not the one i just set recently. Borg will continue to use the incorrect password till i open a new shell.

For repo create operation, borg should exit with an error. For any other operations borg should warn about the presence of multiple password options.

arjunak234 avatar May 14 '25 16:05 arjunak234

borg will use whatever is currently set in the environment.

If you have multiple env vars set at the same time, it will use the one of them which the code processes first (sounds like that was BORG_PASSPHRASE). So ONLY have the correct one set which you need for the current operation.

That's the simplest way to solve this.

Related: borg master branch added a means to debug passphrase issues via a new env var and it would also display all the relevant env vars and their values (or tell if they are not set) in the debug output.

ThomasWaldmann avatar May 14 '25 18:05 ThomasWaldmann