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

Error: 'en_GB' cannot be parsed to a Locale #50724

Closed
6 tasks done
rikbrown opened this issue Aug 12, 2018 · 1 comment
Closed
6 tasks done

Error: 'en_GB' cannot be parsed to a Locale #50724

rikbrown opened this issue Aug 12, 2018 · 1 comment

Comments

@rikbrown
Copy link

General troubleshooting steps

Description of issue

When I run brew cask install <app>, where <app> is a valid or invalid Cask name (but not an already installed Cask, which just prints the already installed method), I get a Error: 'en_GB' cannot be parsed to a Locale error message followed by a stack trace. Regular brew installs (non-cask) seem unaffected.

My region's preferred language is set to English (U.K.).

Naively, it seems like locale.rb is expecting a locale formatted like en-GB, but it is actually en_GB. I'm happy to submit a PR to fix this.

Command that failed

brew cask install lastpass

(though any valid or invalid, not yet installed, cask name triggers the failure).

Output of command with --force --verbose --debug

⋊> ~ brew cask install lastpass --force --verbose --debug                                                                                                                                                           11:38:30
Error: 'en_GB' cannot be parsed to a Locale
Follow the instructions here:
  https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/locale.rb:15:in `parse'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl.rb:141:in `map'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl.rb:141:in `language_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/dsl.rb:115:in `language'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/torbrowser.rb:84:in `block in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:40:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:40:in `initialize'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:32:in `new'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:32:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:76:in `cask'
/usr/local/Homebrew/Library/Homebrew/compat/hbc/cask_loader.rb:15:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:122:in `cask'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/torbrowser.rb:1:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:59:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:59:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:21:in `block in each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:19:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:19:in `each'
/usr/local/Homebrew/Library/Homebrew/searchable.rb:27:in `select'
/usr/local/Homebrew/Library/Homebrew/searchable.rb:27:in `search_string'
/usr/local/Homebrew/Library/Homebrew/searchable.rb:7:in `search'
/usr/local/Homebrew/Library/Homebrew/extend/os/mac/search.rb:29:in `search_casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:55:in `suggestion_message'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:50:in `rescue in casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:45:in `casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:14:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:33:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:91:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:157:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:122:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:87:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:145:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:122:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:87:in `<main>'

Note: while the failure is coming from torbrowser.rb, this just appears to be during loading everything. Manually removing this Cask just triggers the error on another Cask.

Output of brew cask doctor

==> Homebrew-Cask Version
Homebrew-Cask 1.7.1-220-g46f531b
Homebrew/homebrew-cask (git revision 1c325; last commit 2018-08-12)
==> macOS
10.13.6
==> SIP
Enabled
==> Java
10.0.1
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Cached Downloads
~/Library/Caches/Homebrew/Cask (7 files, 664.7MB)
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask (4023 casks)
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-fonts (1164 casks)
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-drivers (152 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/site_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/site_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/site_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/site_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/vendor_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/vendor_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/vendor_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
==> Environment Variables
LC_ALL="en_US.UTF-8"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/usr/local/bin/fish"

Output of brew tap

⋊> ~ brew tap                                                                                                                                                                                                       11:39:14
homebrew/bundle
homebrew/cask
homebrew/cask-drivers
homebrew/cask-fonts
homebrew/core
@rikbrown
Copy link
Author

Ok, after writing that up I discovered the issue. I had manually configured by Preferred languages using the following command: defaults write -g AppleLanguages -array "en_GB" "en_US". Other applications and macOS accepted this (appearing correctly in Language & Region), but after resetting this by reordering the list using the Language & Region preference pane, I see that macOS writes it using en-GB (dashes not underscores).

Confusingly, other defaults values (like AppleLocale) use underscores.

It looks like formally - is correct (but Java used _). Nice and consistent. We can close this as standard system locale setup will work with the existing code.

rikbrown added a commit to rikbrown/mac-configuration that referenced this issue Aug 12, 2018
@lock lock bot locked and limited conversation to collaborators Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant