Closed ghost closed 6 years ago
One reason might be that sshconfig is modified at runtime. Is the PREFIX env var still set at runtime? Perhaps a better way would be to see where kr
is on the path and derive PREFIX from that.
No, PREFIX is not set at runtime. You are 100% correct and I have just reproduced this. I did not think to try with PREFIX at runtime. This is definitely a bug because PREFIX is something that generally only exists in build environments to modify software for the OS at compile time.
Would it be enough to patch it like this?
const DEFAULT_PREFIX = os.Getenv("PREFIX")
edit: Not all build environments may set a PREFIX, though... I don't know go well enough to know if you can express something like
const DEFAULT_PREFIX = os.Getenv("PREFIX") ? "/usr"
I don't think so, that Getenv is only run at runtime so I don't think it will change anything. The best option I can think of is to infer it from which kr
This was fixed with https://github.com/kryptco/kr/commit/a51b73256ef435ed64a8518367b02821d0169326
When using a custom PREFIX as in the install process for FreeBSD, the sshconfig values are not updated to honor the PREFIX. It is unclear why this does not work, so I am patching the source directly in our FreeBSD package builds. The issue is somewhere around here:
https://github.com/kryptco/kr/blob/master/kr/kr_unix.go#L15-L21
Somehow the PREFIX is being lost before this point, so regardless of the build environment the ssh config is always populated with
when you run
kr sshconfig
I expect if the PREFIX=/usr/local that these point to /usr/local/lib and /usr/local/bin