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

Fix #10698 by forcing the use C as a locale. #10714

Closed
wants to merge 1 commit into from

Conversation

mscherer
Copy link
Contributor

This might have side effect on command line UI who will be in
english, and this might cause issue to people, but I think
that's a lesser problem that having silent breakage and corruption
of filename.

I did minimal testing with the code ( IE, verify it doesn't break regular ansible ), and i am gonna do more test, but want to push the code to be discussed as a start.

This might have side effect on command line UI who will be in
english, and this might cause issue to people, but I think
that's a lesser problem that having silent breakage and corruption
of filename.
@bcoca
Copy link
Member

bcoca commented Apr 14, 2015

we already do this, you can even configure it from ansible.cfg with module_locale setting

@abadger
Copy link
Contributor

abadger commented Apr 15, 2015

To solve #10698 we'd have to allow setting it in inventory, not in ansible.cfg. #10698 is about the controller and managed node having different locales which causes mangled filenames. Forcing a common locale seems to be a way to work around that. There might be other problems though -- we hardcode utf8 in a lot of places....

@ringerc
Copy link
Contributor

ringerc commented Apr 15, 2015

This would be a major BC break - anyone who's been using a utf-8 LC_CTYPE will see different, mangled filenames and file contents after this change. So it'd fix #10698 and break lots more systems than it fixed.

I don't think it's safe to do this hard-coded and by default. If you did, it'd be a little better to use C.UTF-8 because UTF-8 locales are more common, but you'd still break lots of systems that aren't using UTF-8.

I'd be better for Ansible to clear all the LC_ env vars and LANG before invoking ssh, so it doesn't have them in its environment to copy them to the remote end. It would thus use the remote end's default locale. This would be a safer change to make the default, because it'd only change anything in situations where the Ansible management box's locale already differs from the remote's locale. Can you do that by setting None as the value of:

LANG
LC_ALL
LC_CTYPE
LC_NUMERIC
LC_TIME
LC_COLLATE
LC_MONETARY
LC_MESSAGES
LC_PAPER
LC_NAME
LC_ADDRESS
LC_TELEPHONE
LC_MEASUREMENT
LC_IDENTIFICATION

?

I'd be better if OpenSSH offered -o NoSendEnv ... but it doesn't, unfortunately, per the docs linked in the original report.

A config option to set ansible_locale (or whatever) to override the locale used would be handy, but it'd have to be available on a per-host basis, because you might be managing some hosts that're using UTF-8 encodings, some that're using ISO-8859-1, and some with other single byte encodings. This is common when you have a fleet of modern Linux machines plus some other UNIXes. The ability to set a default locale in ansible.cfg would make sense too, though.

@bcoca
Copy link
Member

bcoca commented Apr 15, 2015

so I'm going to close this and I suggest we discuss this in ansible-devel, we already have a 'default' in ansible.cfg, I'm open to adding a per-host but I think we need to explore this carefully as it can create many more issues.

@bcoca bcoca closed this Apr 15, 2015
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants