Skip to content

Respect XDG basedir spec #1031

@jasonkarns

Description

@jasonkarns

Your proposal
I propose that debug respect the XDG Base Directory Specification such that files are written to locations controlled by user environment variables.

There are at least three relevant files:

  • rdbg_history
  • rdbgrc
  • unix_domain_socket_dir

Presently, the history file may be forced into a different location with the RUBY_DEBUG_HISTORY_FILE env var. While helpful, this does not adhere to the desire for single-configuration (setting XDG_* vars once and not needing to configure each of hundreds of different utilities). It should default to a file or directory in XDG_STATE_HOME (which itself defaults to $HOME/.local/state)

The unix_domain_socket_dir is already very nearly adhering to Xdg, as its first implicit location (after checking explicit config setting) uses XDG_RUNTIME_DIR.

The rdbgrc (and .rb variant) have no env var equivalents and so cannot even be set explicitly. However, they should be using files within XDG_CONFIG_HOME (which defaults to $HOME/.config). Perhaps $XDG_CONFIG_HOME/rdbg/config or $XDG_CONFIG_HOME/rdbg/config.rb ?

Additional context
The Xdg basedir spec is here: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Rationale

  • keeps user's homedirectory clean
  • allows versioning of configuration files cleanly (ie, dotfiles repo to version-control .config but not cache or data files that also typically end up in homedir)
  • allows single-configuration changes to move configuration to different directory tree (for testing, for simulated environments, and many other unknowable use-cases)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions