rancher / k3os

Purpose-built OS for Kubernetes, fully managed by Kubernetes.
https://k3os.io
Apache License 2.0
3.5k stars 397 forks source link

k3s: quoted envvars passed to install.sh #713

Closed dweomer closed 2 years ago

dweomer commented 3 years ago

Partially addresses rancher/k3os#708

Signed-off-by: Jacob Blain Christen jacob@rancher.com

rgl commented 3 years ago

I don't think %q does what you think it does. This is doing Go escaping, not Shell escaping.

I'm also not sure why we need this. Go cmd.Command / Cmd.Env should handle this for us. If its not doing the correct thing, I would consider this a Go issue.

dweomer commented 3 years ago

I don't think %q does what you think it does. This is doing Go escaping, not Shell escaping.

I'm also not sure why we need this. Go cmd.Command / Cmd.Env should handle this for us. If its not doing the correct thing, I would consider this a Go issue.

Yep, appreciate the advice. This was an attempt to hack the k3s install.sh envvar capture as mentioned here in a comment on the issue that this is attempting to address, https://github.com/rancher/k3os/issues/708#issuecomment-854135597:

As mentioned in #590 we are relying on the k3s install.sh capture of k3s-related environment variables and that processing does not currently support whitespace nor shell-relevant special characters (such as !) in tokens. Until a fix lands with k3s the work-around will be to use dashes as separators instead of spaces.