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

brew.sh: handle Linux systems with no 'locale' #8324

Merged
merged 4 commits into from
Aug 17, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ case "$HOMEBREW_SYSTEM" in
esac

# Force UTF-8 to avoid encoding issues for users with broken locale settings.
if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]
if ! command -v locale >/dev/null
then
export LC_ALL=C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct behaviour on macOS, unfortunately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what circumstances does command -v locale fail on macOS? I believe that situation is impossible with SIP enabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hence I'd like to avoid the check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rewrite this part using if [[ -n "$HOMEBREW_MACOS" ]]; then ... else ... {complex logic}; fi -- would that work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, go for it. I'm still of the belief that checking for locale is pointless where we're correctly handling the case when it doesn't exist anyway if we hide the errors.

elif [[ "$(locale charmap)" != "UTF-8" ]]
then
if [[ -n "$HOMEBREW_MACOS" ]]
then
Expand Down