cosmos-sdk: [Bug]: `--home` flag is not respected
Is there an existing issue for this?
- I have searched the existing issues
What happened?
When running simd, --home flag is not fully respected. The application still creates the config directory under the default home location which is ~/.simapp.
My initial findings show that this line which reads the application flags is called after this line which is used for injecting the sdk’s cli options.
Cosmos SDK Version
0.50.x,main
How to reproduce?
- Remove the home directory:
rm -rf ~/.simapp - Start the application by setting the home directory to a non-default location:
./simd start --home ./other-location - Check if the default home directory is created:
ls ~/.simapp
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 16 (14 by maintainers)
Hey, I wanted to kindly ask what is the ETA on fixing this? We are waiting for this to do an upgrade. We could also help with a PR in case you have other priorities. cc @PoisonPhang
Hi folks, we noticed this issue isn’t working on main still for some cases. For example:
./build/simd version --home ~/.simapp2Now both
~/.simapp2/and the default~/.simapp/exist. Notably only~/.simapp2/has thedatadirectory; both have theconfigdirectory.Turns out this was an issue with how simapp was configured on our fork. Solution is working on v0.50.2 now.
I see, thanks. My solution may prove helpful in the meantime while a much larger refactor is conducted. Though, a few of my changes are genuine fixes. See the description of #18994 for more details.
Tentative solution #18994 I’m not entirely happy with this, but from what I’ve grasped - AutoCLI needs some hefty redesign surrounding how it boot straps itself and supplies context.
IMO, calling
WithKeyringDir(ctx.HomeDir)inReadFromClientConfigfeels like a bug.Hi, first of all I would advise you to work being based off main, as it will complicate your life when opening a PR otherwise.
To answer your question, in v0.50, all modules are using AutoCLI for queries but mostly not for txs. In main all modules have migrated to AutoCLI (queries + txs) unless the UX of a manually defined CLI was better.
Correct, AutoCLI needs some prefilled default data. This will be fixed at the same time as this: https://github.com/cosmos/cosmos-sdk/issues/18122