Direnv: use XDG_RUNTIME_DIR instead of XDG_DATA_DIR

Created on 21 Jan 2020  路  4Comments  路  Source: direnv/direnv

Describe the bug
The migration to XDG_RUNTIME_DIR seems incomplete. The XDG_DATA_DIR value is being used instead of the XDG_RUNTIME_DIR value as the error message states.

The cache dir or data dir may actually be a better place for this tho since the value persists across shell instances. https://wiki.archlinux.org/index.php/XDG_Base_Directory (#notanexpert)

To Reproduce
in a "pre-migrated" state run direnv allow and get the following error:

Migrating the allow data to the new location

The allowed .envrc permissions used to be stored in the XDG_CONFIG_DIR. It's
better to keep that folder for user-editable configuration so the data is
being moved to XDG_RUNTIME_DIR.

moving /Users/adam/.config/direnv/allow to /Users/adam/.local/share/direnv/allow
direnv: error rename /Users/adam/.config/direnv/allow /Users/adam/.local/share/direnv/allow: no such file or directory

my current environment is set up as such:

XDG_CACHE_HOME=/Users/adam/.cache
XDG_CONFIG_HOME=/Users/adam/.config
XDG_DATA_HOME=/Users/adam/.local/share
XDG_RUNTIME_DIR=/Users/adam/.runtime

note that the "move to" location is using XDG_DATA_HOME, not XDG_RUNTIME_DIR.

Expected behavior
use the env var XDG_RUNTIME_DIR as stated.

Environment

  • OS: MacOS 10.14.6
  • Shell: zsh
  • Direnv version 2.20.1
Bug

Most helpful comment

I had to manually create some folders for the migration to work:

mkdir -p ~/.local/share/direnv

All 4 comments

so fast! thank you :)

see, that helps :)

sorry for being grumpy

XDG_DATA_HOME has a weird location but I want the info to persist so XDG_CACHE_HOME and XDG_RUNTIME_DIR are not really appropriate I think. It should be treated more like asset files that are generated by the user.

I had to manually create some folders for the migration to work:

mkdir -p ~/.local/share/direnv

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Thomazella picture Thomazella  路  8Comments

mikepqr picture mikepqr  路  5Comments

fschuindt picture fschuindt  路  3Comments

shariq picture shariq  路  3Comments

mcandre picture mcandre  路  6Comments