Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add key does not report the new key's ID #4656

Closed
ls-initiatives opened this issue Jan 25, 2024 · 0 comments · Fixed by #4657
Closed

add key does not report the new key's ID #4656

ls-initiatives opened this issue Jan 25, 2024 · 0 comments · Fixed by #4657

Comments

@ls-initiatives
Copy link
Contributor

Output of restic version

restic 0.16.3 compiled with go1.21.6 on linux/amd64

What backend/service did you use to store the repository?

rest:http://

Problem description / Steps to reproduce

When adding a key to a repository, we currently have no "easy" way to know the new key's ID.
This is a problem because sometimes we need to pass this ID as a hint for other commands.

In particular, a key hint is needed when the repository has many keys - otherwise opening the repository may fail with "Fatal: maximum number of keys reached" even when a proper password is provided.

Expected behavior

I suppose the author of the "key add" command wanted to have the ID printed like this:

saved new key as 116b1f6aaf7a299f6355bd7d892e2602e1a91f5b9ce8a69c6938ba3e4f1fcc79

Actual behavior

Currently key add displays instead:

restic -r /tmp/kevo/ key add
enter password for repository: 
repository 70789ef8 opened (version 2, compression level auto)
enter new password: 
enter password again: 
saved new key as <Key of xx@yyy, created on 2024-01-25 10:17:55.560224177 +0100 CET m=+10.381054308>

Do you have any idea what may have caused this?

The command dumps the Go object instead of the ID.
A trivial 1 line patch will be provided.

Did restic help you today? Did it make you happy in any way?

One day someone will outsmart all our defenses, burn our IT to the ground and destroy our other backups. Then the restic repos on the hard drives on the shelf it will save the day.

ls-initiatives added a commit to numerigraphe/restic that referenced this issue Jan 25, 2024
Other commands like key list and key remove show the key's ID.

Showing the ID here lets users easily reuse the ID as a key hint for subsequent commands.
In particular, a key hint is needed when the repository has many keys - otherwise opening the repository may fail with "Fatal: maximum number of keys reached" even when a proper password is provided.

Fixes restic#4656
ls-initiatives added a commit to numerigraphe/restic that referenced this issue Jan 25, 2024
Other commands like key list and key remove show the key's ID.

Showing the ID here lets users easily reuse the ID as a key hint for subsequent commands.
In particular, a key hint is needed when the repository has many keys - otherwise opening the repository may fail with "Fatal: maximum number of keys reached" even when a proper password is provided.

Fixes restic#4656
ls-initiatives added a commit to numerigraphe/restic that referenced this issue Jan 29, 2024
Other commands like key list and key remove show the key's ID.

Showing the ID here lets users easily reuse the ID as a key hint for subsequent
commands.
In particular, a key hint is needed when the repository has many keys - otherwise
opening the repository may fail with "Fatal: maximum number of keys reached" even
when a proper password is provided.

Fixes restic#4656
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 a pull request may close this issue.

1 participant