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

kdb stash: does not remove errornous config files #2386

Open
sanssecours opened this Issue Feb 8, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@sanssecours
Copy link
Member

sanssecours commented Feb 8, 2019

Issue Description

Currently we offer the tool kdb stash that, at least in theory, should backup the current configuration and after that remove all custom configuration values. However, the tool does not remove “broken” configuration data:

# Add erroneous data
printf 'Error' > "$(kdb file user/tests/error)"
kdb ls user/tests/error
# RET: 5

# Try to remove all configuration data
kdb stash
# RET: 1

# The configuration data still exists
kdb ls user/tests/error
# RET: 5

. A command kdb reset could get rid of this problem, for example, by removing all mounted configuration files. We have to take proper care to not remove any configuration data used by other configuration tools, such as /etc/hosts though.

@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Feb 8, 2019

Thank you for the suggestion!

Why not extend kdb stash with this behavior?

@sanssecours

This comment has been minimized.

Copy link
Member Author

sanssecours commented Feb 8, 2019

Why not extend kdb stash with this behavior?

That is of course another valid option. The advantage of a new command would be that kdb reset does not have to care about a backup at all. We could also just call kdb reset in kdb stash, just like we do now with kdb backup. Anyway, I just want a tool that reverts to the default configuration. If it is called kdb stash, kdb reset (in my opinion, a better name for the task described above) or kdb napalm-death, I do not care.

@kodebach

This comment has been minimized.

Copy link
Contributor

kodebach commented Feb 8, 2019

This would be very useful for testing.

in my opinion, a better name for the task described above

Yes, reset immediately tells me that all my data is gone afterwards.

@markus2330 markus2330 changed the title KDB Reset: Create Tool to Reset Key Database to Default State kdb stash: does not remove errornous config files Feb 9, 2019

@markus2330 markus2330 added bug and removed enhancement labels Feb 9, 2019

@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Feb 9, 2019

Anyway, I just want a tool that reverts to the default configuration.

This is exactly what kdb stash should do.

This would be very useful for testing.

Yes, this was the idea of kdb stash.

Yes, reset immediately tells me that all my data is gone afterwards.

Which is not a very nice behavior if you are actually also using Elektra on that system. And of course it is the goal that Elektra devs also use Elektra. Thus we should fix kdb stash. If there are any other problems in kdb stash, please report them.

To fix the bug described here, I think it would be enough if kdb stash removes the files using rm instead of kdb rm -r. The files are backed-up using cp anyway.

@sanssecours

This comment has been minimized.

Copy link
Member Author

sanssecours commented Feb 9, 2019

This is exactly what kdb stash should do.

That might be the case. However, I still think the name “stash” does not make that very clear:

stash1 | staʃ | informal
verb [with object and adverbial of place]
store (something) safely in a hidden or secret place: their wealth had been stashed away in Swiss
banks.

(Source: New Oxford American Dictionary).

Yes, reset immediately tells me that all my data is gone afterwards.

Which is not a very nice behavior if you are actually also using Elektra on that system.

I do not think that providing a way to get rid of all custom configuration is bad behavior. A lot of tools even show such options quite prominently. For example, the preferences window of Docker Desktop contains a tab “Reset”:

docker

.

@kodebach

This comment has been minimized.

Copy link
Contributor

kodebach commented Feb 9, 2019

Thus we should fix kdb stash

Like @sanssecours suggested, I think we should implement kdb reset and then change kdb stash to basically be kdb backup && kdb reset. That fixes kdb stash and provides the kdb reset option for anyone who doesn't care about a backup.

@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Feb 9, 2019

store (something) safely in a hidden or secret place

This describes it quite well, doesn't it? The only problem is that it is not "something" but "everything". And that "store" only implies "move" on real objects. The name is taken from git terminology.

Better suggestions are always welcomed.

I do not think that providing a way to get rid of all custom configuration is bad behavior.

It is not "bad", it is only very against usability. Everything that you remove, format, clear, reset, ... without any way of undo requires a good backup and restore strategy which typical end users often do not have. So if you take usability serious, you try to avoid such functionality (see #898 for how harmful a simple kdb umount can be).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment