kube-ps1
kube-ps1 copied to clipboard
_kube_ps1_file_newer_than:16: division by zero
Using kube-ps1 on my Linux machine with zsh and found that zstat doesn't output nanoseconds leading to error _kube_ps1_file_newer_than:16: division by zero
zstat +mtime -F %s.%N ~/kube/config
1658797744.%N
Full output of zstat
zstat ~/.kube/config
device 64768
inode 68653976
mode 33152
nlink 1
uid 37543
gid 101
rdev 0
size 18637
atime 1658797746
mtime 1658797744
ctime 1658797744
blksize 4096
blocks 40
link
We should probably get the OS type and convert command zstat +mtime -F %s.%N to zstat +mtime -F %s if it is Linux here
Interesting. Which version of zsh are you using? I am running Linux and tested on different distributions without that issue:
$ zsh --version
zsh 5.8 (x86_64-ubuntu-linux-gnu)
testuser at dev-box in ~
$ zstat +mtime -F %s.%N ~/.kube/config
1658946238.553962684
testuser at dev-box in ~
$
zsh --version
zsh 5.0.2 (x86_64-redhat-linux-gnu)
Wow, ok. This version was released almost 10 years ago: 2012-12-21. I assume you are on an older version of RHEL? The nanosecond precision was introduced around version 5.5. I will add a condition for older versions of ZSH but would definitely suggest upgrading your shell at some point.
I also got this issue:
_kube_ps1_file_newer_than:15: division by zero
zsh --version
zsh 5.0.2 (x86_64-redhat-linux-gnu)