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
Confusing error message from "ipfs key export" #7814
Comments
|
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
|
@teknomunk Thank you for bringing this to our attention. It probably makes sense to provide the same error that is given when trying to run |
Fixes Issue #7814 ipfs key commands that open the repo directly will not work when another process has the repo open and locked. For this reason these commands cannot run when the ipfs daemon is running, and an informative error message should be given to the user. This is already done for the `ipfs key rotate` command, and should be done for other commands that directly open and lock the repo. This PR applies the same PreRun check to these commands as is used for `ipfs key rotate`. While unlikely, it is possible to see the error reported if another process opens the repo at the same moment. In that case the "someone else has the lock" error is shown.
* Improve error message when running key commands that must be run when the daemon is not already running Fixes Issue #7814 `ipfs key export` now does a PreRun check like `ipfs key rotate` was to give a better error to the user then "someone else has the lock" in the event that the daemon is running while trying to execute these offline-only commands. While unlikely the "someone else has the lock" error can still be shown if two processes try and grab the repo lock at the same time. This PreRun function is also exported so it can be used by `ipfs init` where it was originally copied from. * Added more `ipfs key` command tests When daemon is running: - Test that import works - Test that export fails - Test that rotate fails
…7821) * Improve error message when running key commands that must be run when the daemon is not already running Fixes Issue ipfs#7814 `ipfs key export` now does a PreRun check like `ipfs key rotate` was to give a better error to the user then "someone else has the lock" in the event that the daemon is running while trying to execute these offline-only commands. While unlikely the "someone else has the lock" error can still be shown if two processes try and grab the repo lock at the same time. This PreRun function is also exported so it can be used by `ipfs init` where it was originally copied from. * Added more `ipfs key` command tests When daemon is running: - Test that import works - Test that export fails - Test that rotate fails
teknomunk commentedDec 9, 2020
Version information:
go-ipfs version: 0.8.0-dev-42d3f541d
Repo version: 11
System version: amd64/linux
Golang version: go1.15.6
Installed from a package I built today from https://aur.archlinux.org/packages/go-ipfs-git/
Description:
I reproduced the issue reported on the forums at ERROR with ipfs key export on my local machine.
When you run the command "ipfs key export $KEY_NAME" (where $KEY_NAME is not "self") while the ipfs daemon is running, it responds with the message:
Error: lock /home/teknomunk/.ipfs/repo.lock: someone else has the lock
When you stop the ipfs daemon, the command completes without issue.
If the requirement for key export to be an offline command cannot be removed, I think the error message should let the operator know that the command can only be run while the daemon is not.
The text was updated successfully, but these errors were encountered: