Cache files created in $HOME -- XDG Base Directory Implementation Bug
- Dominant language
- Go
- Stars
- 9.2k
- Forks
- 1.3k
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 56
Description
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:
https://github.com/keybase/client/blob/324f1120754b87ef5d4b249ba7000e408caae385/shared/constants/platform.desktop.tsx#L60-L68
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in shared/constants/platform.desktop.tsx at lines 60-68 and inspect how the XDG cache path is assembled. Reproduce the issue with XDG_CACHE_HOME set without a trailing slash, then verify that the generated cache file is placed beneath the configured cache directory rather than directly in $HOME.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100