Respect XDG basedir spec

Open
#1,031 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby
Domain
cli, tooling

Research direction

Start by locating how rdbg_history, rdbgrc, and unix_domain_socket_dir are currently resolved, then compare those locations with the XDG Base Directory Specification. Define the appropriate XDG state, config, and runtime locations, including defaults, and verify that all three files or directories follow the selected behavior.

Written by the indexing model from the issue text.

Description

enhancement

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)
Dominant language
Ruby
Stars
1.3k
Forks
146
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/debug

All issues in ruby/debug

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.