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

C.UTF-8 locale is debian specific #856

Closed
cocreature opened this issue Aug 26, 2015 · 5 comments
Closed

C.UTF-8 locale is debian specific #856

cocreature opened this issue Aug 26, 2015 · 5 comments

Comments

@cocreature
Copy link
Contributor

@cocreature cocreature commented Aug 26, 2015

Since 9787aed stack tries to set LC_ALL to C.UTF-8. This is a bad idea, since that locale is Debian (and transitively Ubuntu) specific. There is an upstream glibc bug to support this, but it's not yet fixed.

On distros that do not support this (at least Arch and Fedora) it actually makes the problem far worse than it was before, since now even if your locales are all fine and utf8 trying to set them breaks this, so we're back to the commitBuffer: invalid argument (invalid character) problem.

This means that if people upgrade their stack version, they can't even downgrade and built an old version since the build reproducibly fails.

Pinging @borsboom

@borsboom
Copy link
Contributor

@borsboom borsboom commented Aug 26, 2015

Argh, sounds like I need to make this more intelligent. Maybe something like:

  1. If the locale already uses the UTF-8 charmap, just leave it alone.
  2. Otherwise, use locale to determine if the current locale but with the UTF-8 charmap exists, and if so, use that.
  3. Otherwise, check for existence of C.UTF-8, and if so, use it.
  4. If all else fails, print a warning and leave the locale alone.

How does that sound?

(looking forward to GHC_CHARENC)

@cocreature
Copy link
Contributor Author

@cocreature cocreature commented Aug 26, 2015

Sounds reasonable. Kinda annoying to have to add such a workaround, but there doesn't seem to be an easy way around it.

@borsboom borsboom closed this in 478ca71 Aug 27, 2015
@borsboom
Copy link
Contributor

@borsboom borsboom commented Aug 27, 2015

@cocreature I've pushed more intelligent logic to master. Turns out trying to do anything cross-platform with locales is tricky (there's no standard for locale names), but I'm hoping this does the right thing for the majority of cases and fails gracefully (with a warning).

@borsboom
Copy link
Contributor

@borsboom borsboom commented Aug 27, 2015

(I tested this on OS X, Debian 7, and CentOS 6.6)

@cocreature
Copy link
Contributor Author

@cocreature cocreature commented Aug 27, 2015

Thanks, works on Arch too.

jcfr added a commit to dockbuild/dockbuild that referenced this issue Mar 29, 2018
C.UTF-8 is not supported on all systems. For sake of consistency, we
set en_US.UTF-8 in all images.

References:
* https://sourceware.org/bugzilla/show_bug.cgi?id=17318#c4
* commercialhaskell/stack#856

Warnings addressed by this commit are like the following:

svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is C.UTF-8
svn: warning: please check that your locale name is correct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants