Skip to content

Improved XDG basedir spec compliance #554

@jasonkarns

Description

@jasonkarns

Describe the bug

$ gh --version
gh version 0.5.7 (2020-02-20)
https://github.com/cli/cli/releases/tag/v0.5.7

gh appears to conform to the XDG basedir spec by writing to ~/.config/gh. However, it does not respect XDG_CONFIG_HOME as it should. ~/.config is the default value for XDG_CONFIG_HOME, but should only be used if XDG_CONFIG_HOME itself is unset. If it is set, it should be respected.

Steps to reproduce the behavior

  1. rm -rf ~/.config/gh (or rename)
  2. export XDG_CONFIG_HOME=$(mktemp -d) (configure a custom config-home)
  3. gh issue list run a command to trigger authentication
  4. ls ~/.config/gh note that gh was re-created under ~/.config instead of the temp directory
  5. ls $XDG_CONFIG_HOME note that nothing was written to XDG_CONFIG_HOME; this is where gh/config.yml should have been written.

Expected vs actual behavior

Conformance to the XDG spec requires that the XDG_CONFIG_HOME variable be respected for where to write user configuration files. gh is writing to ~/.config but not respecting XDG_CONFIG_HOME when it is set.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingconfigpriority-3Affects a small number of users or is largely cosmetic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions