Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache files created in $HOME -- XDG Base Directory Implementation Bug #25704

Open
alichtman opened this issue May 28, 2023 · 1 comment
Open

Comments

@alichtman
Copy link

alichtman commented May 28, 2023

First, thanks for supporting the XDG Base Dir spec!

I found this file in my $HOME directory:

$ cat .cachekeybase.app.serverConfig
{"alichtman":{"chatIndexProfilingEnabled":false,"dbCleanEnabled":false,"printRPCStaus":false},"lastLoggedInUser":"alichtman"}

It seems like the path is supposed to be .cache/keybase.app.serverConfig, but is missing a slash. I think this path is generated here:

const logDir = (useXDG && env.XDG_CACHE_HOME) || Path.join(homeEnv, '.cache', appName)
return {
cacheRoot: logDir,
dataRoot: (useXDG && env.XDG_DATA_HOME) || Path.join(homeEnv, '.local/share', appName),
guiConfigFilename: Path.join(homeConfigDir, appName, 'gui_config.json'),
jsonDebugFileName: `${logDir}keybase.app.debug`,
logDir,
serverConfigFileName: `${logDir}keybase.app.serverConfig`,

It seems like $XDG_CACHE_HOME is assumed to have a trailing slash, but this is non-default.

The XDG Base Dir spec says:

$XDG_CACHE_HOME defines the base directory relative to which user-specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

Some logic could be added to check for a trailing slash at the end of $XDG_CACHE_HOME to avoid creating this file in the wrong directory.

maquinas07 added a commit to maquinas07/client that referenced this issue May 30, 2023
@maquinas07
Copy link

Just noticed this as well, I created a PR with a fix.

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

No branches or pull requests

2 participants