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

Don't store command history inside ~/.cache #769

Closed
haasn opened this issue Feb 8, 2018 · 11 comments
Closed

Don't store command history inside ~/.cache #769

haasn opened this issue Feb 8, 2018 · 11 comments
Assignees
Milestone

Comments

@haasn
Copy link
Contributor

haasn commented Feb 8, 2018

➡️ First read the guidelines! ⬅️

Version

Version: 1.4.2-131-git-5c5665ef-dirty (git-r3/HEAD)

Configuration

https://0x0.st/sc9d.txt

Launch Command

rofi -show run

Steps to reproduce

  • Modify the command history (e.g. by entering a custom command, or affecting the command frequency)
  • Delete the contents of ~/.cache

What behaviour you see

  • The command history gets reset

What behaviour you expect to see

  • The command history gets preserved

Extra notes

~/.cache seems like a poor fit for what's essentially a command history. A better fit, to me, would be ~/.local/share/. Nuking ~/.cache should not drastically modify application functionality - but in rofi, deleting my entire command history impacts my ability to easily start the commands I frequently start.

Applications should be designed to be robust against ~/.cache going away.

@DaveDavenport
Copy link
Collaborator

I always found history data non-essentials (and nuke it occasionally). But I can see people relying on it.
It is fine to move it, not sure where though when reading this.

@benoliver999
Copy link
Contributor

benoliver999 commented Feb 8, 2018 via email

@haasn
Copy link
Contributor Author

haasn commented Feb 8, 2018

For comparison, gtk stores its “recently used places” files in $XDG_DATA_HOME.

@sudoforge
Copy link

sudoforge commented Apr 1, 2018

Applications should be designed to be robust against ~/.cache going away.

Can you explain your reasoning for this? I don't think applications should purposefully avoid a standard. I also find it frustrating that this "command history" cache exists at all - or at least that it persists across reboots. Commands, once called via rofi, will remain in the rofi history (and thus show up when I use rofi) whether or not they're still valid commands. If we move it away from the cache directory (which is possible to purge on a schedule), there is no way to solve this other than editing the file directly.

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Apr 1, 2018

Can you explain your reasoning for this? I don't think applications should purposefully avoid a standard. I also find it frustrating that this "command history" cache exists at all - or at least that it persists across reboots. Commands, once called via rofi, will remain in the rofi history (and thus show up when I use rofi) whether or not they're still valid commands. If we move it away from the cache directory (which is possible to purge on a schedule), there is no way to solve this other than editing the file directly.

@bddenhartog You can disable history in the config file and you can delete (wrong) entries with a keybinding in rofi. See manpage.

@haasn
Copy link
Contributor Author

haasn commented Apr 28, 2018

@sudoforge Not sure why you linked that URL, maybe you meant this one? If so, it specifically states thate .cache is for non-essential (cached) data.

Non-essential cached data is data that can be regenerated if lost, albeit perhaps more slowly. (For example, it may need to be retrieved from a remote source, or recomputed). The purpose of a cache is to speed up access, rather than store persistent state. Clearing a cache should have no observable effects besides degrading performance.

If you look at other examples of programs that store files in ~/.cache, you'll find that they adhere to definition consistently: Deleting ~/.cache/fontconfig, for example, only causes fontconfig to spend more time figuring out information about fonts. Deleting ~/.cache/mozilla only causes firefox to lose its on-disk cache of network objects, causing it to redownload them on future requests. Deleting ~/.cache/mesa_shader_cache only causes the mesa shader compiler to spend CPU time recompile shader objects the next time you try using them. In none of these instances does the user-facing behavior of the program change.

An acceptable use of ~/.cache would be to cache the list of programs that exist on the system, because that can be regenerated at any point in time. What is not a good use of ~/.cache is storing history information about the user's executed programs, which essentially constitutes a user preference and cannot be regenerated in any way after lost.

@philer
Copy link

philer commented Feb 8, 2019

Any news on this? I want to move my ~/.cache onto tmpfs. The loss of my rofi history is the only obstacle. I rely on it quite heavily.

@DaveDavenport
Copy link
Collaborator

Added option to move the location of the files.
cache-dir .

@DaveDavenport DaveDavenport added this to the 1.5.3 milestone Feb 8, 2019
@ghost
Copy link

ghost commented Feb 9, 2019

I gott say I think ~/.local/share/rofi/rofi.cache seems to fit the bill on this one dave.

@philer
Copy link

philer commented Feb 9, 2019

That was some prompt action. Thank you @DaveDavenport, much appreciated!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants