derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
25.79k stars 1.61k forks source link

Creating random `~/` directories in current dir #2764

Open tj-smith47 opened 2 weeks ago

tj-smith47 commented 2 weeks ago




Describe the bug Whenever I open k9s, after I close out the window, there will be a new ~/ directory there containing ./~/Library/Application\ Support/k9s/.

To Reproduce Steps to reproduce the behavior:

  1. mkdir ~/k9s-temp
  2. cd ~/k9s-temp/
  3. k9s -n <namespace>
  4. Exit k9s
  5. ls -lah
  6. Observe ~/k9s-temp/~/Library/Application\ Support/k9s

Historical Documents When applicable please include any supporting artifacts: k9s debug logs, configurations, resource manifests, ...

Expected behavior No random artifacts being created.

Screenshots If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

Additional context Add any other context about the problem here.

wjiec commented 2 weeks ago

I guess it could be that you set the path with ~ in the K9S_CONFIG_DIR environment variable (k9s hasn't adapted this yet)

tj-smith47 commented 2 weeks ago

I don't have K9S_CONFIG_DIR set. I do see screenDumpDir: ~/Library/Application Support/k9s/screen-dumps in my config file at ~/.config/k9s/config.yaml, but I do not believe that's something I would manually configure, I'm not familiar with that feature at all.

Screenshot 2024-06-27 at 12 04 45

I do however have XDG_CONFIG_HOME=${HOME}/.config for portability of my config across systems, but there is definitively no use of ~ in any ENV's K9S should be concerned with. In fact, there isn't a single use of ~ anywhere in my ~/.envs file that gets sourced each session.

tj-smith47 commented 2 weeks ago

Here's the output of k9s info:

Version:           0.32.5
Config:            /Users/tjsmith/.config/k9s/config.yaml
Custom Views:      /Users/tjsmith/.config/k9s/views.yaml
Plugins:           /Users/tjsmith/.config/k9s/plugins.yaml
Hotkeys:           /Users/tjsmith/.config/k9s/hotkeys.yaml
Aliases:           /Users/tjsmith/.config/k9s/aliases.yaml
Skins:             /Users/tjsmith/.config/k9s/skins
Context Configs:   /Users/tjsmith/Library/Application Support/k9s/clusters
Logs:              /Users/tjsmith/Library/Application Support/k9s/k9s.log
Benchmarks:        /Users/tjsmith/Library/Application Support/k9s/benchmarks
ScreenDumps:       ~/Library/Application Support/k9s/screen-dumps

Sure, I can (and will) remove that setting in my config file. The reason I bring this up is the issue just started happening within the past week, and while I do not remember editing this value but cannot say for certain I never have - I can say with certainty that I have not touched my k9s config since April 19th, when I added the dracula theme.

wjiec commented 2 weeks ago

@tj-smith47 It is indeed a problem with the screenDumpDir: ~/Library/Application Support/k9s/screen-dumps configuration, k9s creates this directory after loading the configuration (but k9s doesn't adapt ~) https://github.com/derailed/k9s/blob/626bde11f31e08cf8081bced7d911f6d121582fc/internal/config/config.go#L108