Skip to content

fix: respect XDG_CACHE_HOME instead of hardcoding $HOME/.cache#762

Merged
RoyalOughtness merged 2 commits into
secureblue:livefrom
ymcx:use-xdg-cache-home
May 29, 2026
Merged

fix: respect XDG_CACHE_HOME instead of hardcoding $HOME/.cache#762
RoyalOughtness merged 2 commits into
secureblue:livefrom
ymcx:use-xdg-cache-home

Conversation

@ymcx
Copy link
Copy Markdown
Contributor

@ymcx ymcx commented May 28, 2026

I have set the XDG_CACHE_HOME environment variable to a location different than the default value of $HOME/.cache. For some odd reason, when trying to launch Trivalent with this configuration by using the provided trivalent.sh script on a vanilla Fedora installition, it fails to launch if $HOME/.cache doesn't exist. The following error gets printed to stdout/stderr:

bwrap: Can't mkdir /home/MYUSER/.cache: Permission denied

Creating that directory manually and rerunning the script makes Trivalent launch just fine, even though it doesn't create any temp files in that directory.

I then copied the script from /usr/bin/trivalent to another directory and modified it such that it could be executed from this new location, and for whatever reason, it now launched just fine after having automatically created the hidden cache directory on my home folder.

Anyhow, we shouldn't assume that the cache directory is located at $HOME/.cache on each system, since the XDG spec allows moving its location via the XDG_CACHE_HOME env variable. Using XDG_CACHE_HOME would fix both of the issues mentioned above, i.e. allowing Trivalent to run with a custom cache directory location and in some cases, not creating a new cache directory at the wrong location. As per the spec, we should however default to the old directory in case XDG_CACHE_HOME isn't set.

@ymcx ymcx requested a review from RoyalOughtness as a code owner May 28, 2026 10:21
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 28, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ymcx ymcx changed the title respect XDG_CACHE_HOME instead of hardcoding $HOME/.cache fix: respect XDG_CACHE_HOME instead of hardcoding $HOME/.cache May 28, 2026
@RoyalOughtness
Copy link
Copy Markdown
Contributor

@ymcx Thank you for this! If you have a moment can you sign the commit?

@ymcx ymcx force-pushed the use-xdg-cache-home branch from 8745fc6 to ab271f4 Compare May 29, 2026 10:56
@ymcx
Copy link
Copy Markdown
Contributor Author

ymcx commented May 29, 2026

If you have a moment can you sign the commit?

Alright so I tried to sign the commit as is but it seems like that wasn't possible. I recently moved over to Codeberg and as such I changed my global git credentials to match the new email address while preserving the user.name and the signing key.

I figured it would be the easiest to just merge all of the changes in this branch into a new commit that's signed with the new email address. I hope that's okay.

@RoyalOughtness
Copy link
Copy Markdown
Contributor

@ymcx that works, thanks

@RoyalOughtness RoyalOughtness merged commit 8770542 into secureblue:live May 29, 2026
5 checks passed
@ymcx ymcx deleted the use-xdg-cache-home branch May 30, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants