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

[bug/question] LC_ALL set to C on executors when using raw driver #3036

Closed
nugend opened this issue Aug 16, 2017 · 10 comments
Closed

[bug/question] LC_ALL set to C on executors when using raw driver #3036

nugend opened this issue Aug 16, 2017 · 10 comments

Comments

@nugend
Copy link

nugend commented Aug 16, 2017

Not sure if this intentional or a golang thing or what. It's breaking a script that assumes stdout is UTF-8 encoded. I can work around it, but I don't really expect the executor to work this way without a reason.

Nomad version

Nomad v0.6.0

Operating system and Environment details

3.10.0-327.36.3.el7.x86_64

Issue

The nomad executor has the following environment variables set in addition to the ones set on the agent

LC_ALL=C
NOMAD_PLUGIN_MAGIC_COOKIE=e4327c2e01eabfd75a8a67adb114fb34a757d57eee7728d857a8cec6e91a7255
PLUGIN_MIN_PORT=14000
PLUGIN_MAX_PORT=14512

LC_ALL being set that way breaks a script I'm using which normally assumes UTF-8. I can override if necessary, just wondering if this is intentional or not.

Reproduction steps

Reproduced with the following nomad job:

job "lc-wat" {
  region = "integ"
  datacenters = ["dc1"]
  type = "batch"
  task "wtf" {
    driver = "raw_exec"
    config {
      command = "bash"
      args = ["-c","echo $LC_ALL"]
      }
    }
  }

Nomad Client logs (if appropriate)

Output is "C"

@dadgar
Copy link
Contributor

dadgar commented Aug 16, 2017

@nugend Is it an environment variable that you are starting Nomad with. The env-vars are passed through from the host. You can restrict that using either a white or black list: https://www.nomadproject.io/docs/agent/configuration/client.html#quot-env-blacklist-quot-

@nugend
Copy link
Author

nugend commented Aug 16, 2017

@dadgar Nope.

bash-4.2$ pgrep -f ".*nomad agent.*"
10844
bash-4.2$ ps -fp 10844
UID        PID  PPID  C STIME TTY          TIME CMD
REDACTED+ 10844 10839  5 Aug07 ?        10:41:45 nomad agent -data-dir /REDACTED/data/nomad -config /REDACTED/cfg/hosts/REDACTED/nomad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

@nugend
Copy link
Author

nugend commented Aug 16, 2017

I'm going to try using the blacklist now though. I'm definitely not setting that anywhere though.

@nugend
Copy link
Author

nugend commented Aug 16, 2017

Setting the blacklist does prevent the environment variable from propagating to the executor's subprocess, but the variable remains set on the executor itself.

@nugend
Copy link
Author

nugend commented Aug 16, 2017

@schmichael identified that this is being caused by

I'll file a report upstream.

@dadgar
Copy link
Contributor

dadgar commented Aug 16, 2017

@nugend If it prevents it from propagating to the actual task, isn't that enough?

@nugend
Copy link
Author

nugend commented Aug 16, 2017

@dadgar Well, sure. It's fine as a workaround as long as upstream gets it fixed. If they come back with a can't/won't, then I guess you should add it to the default blacklist (and you never have a problem with something in the agent/executor assuming a Unicode locale but getting a C one).

And also, I mean, there is the whole issue that this means that LC_ALL's value can't be correctly propagated in that case because the dependency is forcing it to "C". I don't have an issue with it being system default, but I try not to make assumptions about what other users need.

@nugend
Copy link
Author

nugend commented Aug 17, 2017

@schmichael Change was accepted upstream

@dadgar
Copy link
Contributor

dadgar commented Aug 21, 2017

Thanks for the report and helping out @nugend 👍

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants