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

kubectx errors with Ubound Variable #322

Open
Sodman opened this issue Sep 6, 2021 · 6 comments
Open

kubectx errors with Ubound Variable #322

Sodman opened this issue Sep 6, 2021 · 6 comments

Comments

@Sodman
Copy link

Sodman commented Sep 6, 2021

Whenever I run kubectx I get the error message in the output: /usr/local/bin/kubectx: line 250: $@: unbound variable.

I assume this is a reference to

kubectx/kubectx

Line 250 in 3504e66

main "$@"

I'm on MacOS (amd64 intel CPU).

kubectx version 0.9.4, installed via brew. Tried reinstalling, no difference.

Happens in both Bash and zsh.

FWIW, kubens also errors - with /usr/local/bin/kubens: line 226: $@: unbound variable

Any idea what might I might be missing in my env?

Edit: I should also add that kubectx some-context actually works fine, it's just the bare kubectx which should list all contexts which is failing for me.

@ahmetb
Copy link
Owner

ahmetb commented Sep 7, 2021

There's a very decent chance your bash version has updated to a newer version that broke something.
I cannot repro this right now. But if you provide a full output with DEBUG=1 env var set, I can take a look.

To unblock yourself, go to Releases tab and download the binary version of kubectx implemented in Go.

@ahmetb
Copy link
Owner

ahmetb commented Nov 4, 2021

Last call to provide s repro with DEBUG=1.

@Sodman
Copy link
Author

Sodman commented Nov 4, 2021

Thank you for the reminder, apologies for the delay, I had missed the original notification. I will grab latest and try to reproduce again tonight with DEBUG=1.

@Sodman
Copy link
Author

Sodman commented Nov 4, 2021

Output with DEBUG=1:

$ DEBUG=1 kubectx
+ set -eou pipefail
+ IFS='
	'
+ SELF_CMD=/usr/local/bin/kubectx
+ KUBECTX=/Users/sod/.kube/kubectx
/usr/local/bin/kubectx: line 250: $@: unbound variable

Running on zsh 5.7.1 (x86_64-apple-darwin19.0)

I grabbed the binary version from the release and that does indeed work for me, so I'll just pop that in my path. If you'd like me to try anything else, I'm happy to assist - but this workaround fixes all my issues so we can close this out if it's a niche edge case / environment-specific issue not affecting anyone else.

@ahmetb
Copy link
Owner

ahmetb commented Nov 8, 2021

I assume kubectx is running in bash (despite you launch it from zsh) so I may need your bash version as well. 😇

@Sodman
Copy link
Author

Sodman commented Jan 3, 2022

Apologies for the delay. Bash version info below:

$ bash --version
GNU bash, version 4.0.0(1)-release (i386-apple-darwin19.4.0)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants