The brew.sh script appears to ignore the locale information (en_GB.UTF-8 in this case), and impose
en_US.UTF-8, which doesn't exist on my machines.
brew update and retried your prior step?|> brew update
/home/users/russel/.linuxbrew/Homebrew/Library/Homebrew/brew.sh: line 4: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
Already up-to-date.
brew config and brew doctor and included their output with your issue?|> brew config
/home/users/russel/.linuxbrew/Homebrew/Library/Homebrew/brew.sh: line 4: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
HOMEBREW_VERSION: 1.4.3
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: c85a991d105d19b55216f85e5f82b1eae2766e3b
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 4a99b6f085952d2fede3e282f27d4e75b51244bf
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /home/users/russel/.linuxbrew
HOMEBREW_REPOSITORY: /home/users/russel/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /home/users/russel/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/users/russel/.cache/Homebrew
HOMEBREW_CELLAR: /home/users/russel/.linuxbrew/Cellar
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
HOMEBREW_PREFIX: /home/users/russel/.linuxbrew
HOMEBREW_REPOSITORY: /home/users/russel/.linuxbrew/Homebrew
HOMEBREW_VISUAL: emacsclient --create-frame --alternate-editor emacs
CPU: octa-core 64-bit penryn
Homebrew Ruby: 2.3.6 => /usr/bin/ruby2.3
Clang: 4.0 build
Git: 2.15.1 => /usr/bin/git
Curl: 7.57.0 => /home/users/russel/.linuxbrew/opt/curl/bin/curl
Perl: /usr/bin/perl
Python: /home/users/russel/.linuxbrew/opt/python/libexec/bin/python => /home/users/russel/.linuxbrew/Cellar/python/2.7.14_3/bin/python2.7
Ruby: /usr/bin/ruby => /usr/bin/ruby2.3
Java: openjdk version "9.0.1.3"
Kernel: Linux 4.14.0-3-amd64 x86_64 GNU/Linux
OS: Debian GNU/Linux unstable (sid) (sid)
Host glibc: 2.26
/usr/bin/gcc: 7.2.0
glibc: N/A
gcc: N/A
xorg: N/A
|> locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8
I saw that there is some discussion about this in the mac repository: https://github.com/Homebrew/brew/pull/3666
Does this patch help?
It looks the identical problem, certainly. I am not sure the right procedure to test the change, is there some blurb somewhere explaining what to do for this?
It seems that even though locale charmap returns UTF-8 the bash expression [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]] returns true, which is very weird.
It seems that even though locale charmap returns UTF-8 the bash expression [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]] returns true, which is very weird.
This is the issue someone will need to figure out before we can accept an upstream fix for this.
@MikeMcQuaid I suspect it is because locale charmap returns "UTF-8\n" which is not equal to "UTF-8".
Hi, Russell. ENV_FILTERING resets the language first to C and then to en_US.UTF-8. The workaround for now is to set the environment variable
export HOMEBREW_NO_ENV_FILTERING=1
@MikeMcQuaid ENV_FILTERING is resetting the language first to C with a default charmap of US-ASCII in bin/brew and then setting it to en_US.UTF-8 in Library/Homebrew/brew.sh. Are you interested in a patch to protect the environment variables LANG and LC_* from being cleared by ENV_FILTERING?
Are you interested in a patch to protect the environment variables LANG and LC_* from being cleared by ENV_FILTERING?
Let's add the minimal required to fix this bug i.e. either LANG or LC_ALL.
@russel Please report…
env | egrep 'LANG|LC_'
@sjackman
|> env | egrep 'LANG|LC_'
LC_ALL=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_PAPER=en_GB.UTF-8
LC_MONETARY=en_GB.UTF-8
LANG=en_GB.UTF-8
GDM_LANG=en_GB.utf8
LC_NAME=en_GB.UTF-8
LC_COLLATE=en_GB.UTF-8
LC_CTYPE=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_NUMERIC=en_GB.UTF-8
LC_MESSAGES=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_TELEPHONE=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
@ralic Same for you: can we see env | egrep 'LANG|LC_'
For me:
❯❯❯ env | egrep 'LANG|LC_'
LANG=en_CA.UTF-8
Thinking about this more: I maybe LANG or LC_* should not be whitelisted but instead the en_US.UTF-8 should not be set if it does not exist.
When en_US.UTF-8 does not exist, clearing the environment results in setting the locale to C, which has a character map of US-ASCII rather than UTF-8. Are you okay with that?
❯❯❯ env -i locale charmap
US-ASCII
❯❯❯ env -i locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
The user has a locale, surely that is what they want to be used?
@russel The same argument goes for most of the environment variables we don't whitelist in Homebrew. As Homebrew is primarily a binary package manager now: these will never be used and it's better the build-from-source process matches the build-a-binary process as much as possible to reduce the number of weird bugs that occur otherwise.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I just discovered Linuxbrew and installed it on my server.
But I have the same problem:
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.sh: Zeile 4: Warnung: setlocale: LC_ALL: Kann die Locale nicht ändern (en_US.UTF-8): Datei oder Verzeichnis nicht gefunden
```$ brew config
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.sh: Zeile 4: Warnung: setlocale: LC_ALL: Kann die Locale nicht ändern (en_US.UTF-8): Datei oder Verzeichnis nicht gefunden
HOMEBREW_VERSION: 1.5.3
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: 69ecf7d034c2848cb525bf9fdae03efda64ef95b
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: a5040d432d8b96772b20ac960d11412f764c649d
Core tap last commit: 5 hours ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/owncloud/.cache/Homebrew
HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_NO_ENV_FILTERING: 1
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.3.3 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: N/A
Git: 2.16.2 => /home/linuxbrew/.linuxbrew/bin/git
Curl: 7.58.0 => /home/linuxbrew/.linuxbrew/opt/curl/bin/curl
Perl: /usr/bin/perl
Python: /home/linuxbrew/.linuxbrew/opt/python/libexec/bin/python => /home/linuxbrew/.linuxbrew/Cellar/python/2.7.14_5/bin/python2.7
Ruby: N/A
Java: N/A
Kernel: Linux 3.16.0-042stab127.2 x86_64 GNU/Linux
OS: Debian GNU/Linux 8.9 (jessie) (jessie)
Host glibc: 2.19
/usr/bin/gcc: 4.9.2
glibc: 2.23
gcc: 5.5.0_1
xorg: N/A
```$ env | egrep 'LANG|LC_'
LC_ALL=de_DE.utf8
LANG=de_DE.utf8
LANGUAGE=de_DE.utf8
I also set export HOMEBREW_NO_ENV_FILTERING=1 but this does not suppress the warning.
Please enclose copy-and-paste blocks in triple back ticks.
See https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code
As a workaround for now, you can install the locale en_US.UTF-8 to silence the warning. Otherwise simply ignore the warning.
For me this is not code but a quote of the output of my console. But as you prefer code I have changed my previous answer.
Installing en_US.UTF-8 has removed the warning. This is all I wanted. Thanks
For people that are lazy, here is how you can do this on debian:
https://people.debian.org/~schultmc/locales.html
I prefered the "hard" way and added en_US.UTF-8 UTF-8 to the end of the /etc/locale.gen
Thanks for the workaround, Tim!
sudo apt-get install locales && sudo localedef -i en_US -f UTF-8 en_US.UTF-8
or
sudo apt-get install debconf && sudo dpkg-reconfigure locales
or
sudo sh -c 'echo en_US.UTF-8 UTF-8 >>/etc/locale.gen' && sudo /usr/sbin/locale-gen
This solution would be still limited to Debian Linux only. I believe changes listed in following pull reqeust would still be better to make sense in Cent-OS, or others.
https://github.com/Homebrew/brew/pull/3666/files
This work around should work on any distribution of Linux that uses glibc.
sudo sh -c 'echo en_US.UTF-8 UTF-8 >>/etc/locale.gen' && sudo /usr/sbin/locale-gen
This work-around also remove the feature that Linux provided to display shell or console message in the user's locale. Take the error message of file not found shown in bash as an example :
bash: /home/monday/work/gcloud/google-cloud-sdk/path.bash.inc: 沒有此一檔案或目錄
bash: /home/monday/work/gcloud/google-cloud-sdk/path.bash.inc: No such file or directory
In a word, it actually forces the user to make a locale change.
Homebrew/brew (of which Linuxbrew/brew is a fork) decided that they prefer to set the locale to en_US.UTF-8.
See https://github.com/Linuxbrew/brew/issues/568#issuecomment-357544504
and https://github.com/Linuxbrew/brew/issues/568#issuecomment-359166923
Linuxbrew is a fork of Homebrew whose purpose is to make the Brew package manager work on Linux. We try not to change its behaviour where it's not strictly necessary to make it work on Linux. If you can reproduce your issue on macOS, you can raise the issue upstream with Homebrew/brew, if you like.
Most helpful comment
Thanks for the workaround, Tim!
or
or
See https://people.debian.org/~schultmc/locales.html