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

[SOLVED] New issue since today #203

Closed
MrMic opened this issue Jul 24, 2018 · 31 comments
Closed

[SOLVED] New issue since today #203

MrMic opened this issue Jul 24, 2018 · 31 comments

Comments

@MrMic
Copy link

MrMic commented Jul 24, 2018

when i try ls, now i got this issue:

.rvm/gems/ruby-2.1.2/gems/colorls-1.1.1/lib/colorls/flags.rb:38:in setlocale': error calling setlocale(1, "") (RuntimeError) from /Users/mic/.rvm/gems/ruby-2.1.2/gems/colorls-1.1.1/lib/colorls/flags.rb:38:in process'
from /Users/mic/.rvm/gems/ruby-2.1.2/gems/colorls-1.1.1/exe/colorls:5:in <top (required)>' from /Users/mic/.rvm/gems/ruby-2.1.2/bin/colorls:23:in load'
from /Users/mic/.rvm/gems/ruby-2.1.2/bin/colorls:23:in <main>' from /Users/mic/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:24:in eval'
from /Users/mic/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:24:in `

'

I am on Mac osx 10.13.6
=> brew info ruby
=> ruby: stable 2.5.1 (bottled), devel 2.6.0-preview2, HEAD

Thanks for fixing the issue.

Rgds,

@MrMic
Copy link
Author

MrMic commented Jul 24, 2018

Seems to work with iTerm2 but not with HyperJS terminal.
https://hyper.is/

@avdv
Copy link
Collaborator

avdv commented Aug 5, 2018

Hi @MrMic, could you paste the output of running locale in HyperJS?

@MrMic
Copy link
Author

MrMic commented Aug 6, 2018

Hi @avdv,

The output is:
$ locale
LANG="fr.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Thanks for the follow-up and toubleshooting.

@avdv
Copy link
Collaborator

avdv commented Aug 6, 2018

Actually, that looks pretty normal.

Since you use rvm, do you have the same version of Ruby in iTerm2 and Hyper? (run ruby --version and which colorls)

Did you try re-installing colorls, or re-installing clocale?

@avdv
Copy link
Collaborator

avdv commented Aug 6, 2018

Oh, and what does ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_CTYPE, "")' give in both iTerm and Hyper?

@MrMic
Copy link
Author

MrMic commented Aug 6, 2018

In Iterm2:
ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_CTYPE, "s")'
-e:1:in setlocale': error calling setlocale(2, "s") (RuntimeError) from -e:1:in

'

In Hyper:
ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_CTYPE, "s")'
-e:1:in setlocale': error calling setlocale(2, "s") (RuntimeError) from -e:1:in

'

  • Seems that your commands has something wrong ...

@avdv
Copy link
Collaborator

avdv commented Aug 7, 2018

Yes, my bad. I did correct the error in the command already in the comment above, but maybe you copied it from the email? It should read:

ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_CTYPE, "")'

@MrMic
Copy link
Author

MrMic commented Aug 7, 2018

No output in Iterm2 and HyperJS.

@avdv
Copy link
Collaborator

avdv commented Aug 7, 2018

That's good news! But doesn't explain the error you get with colorls at all... 😲

Oh, 🤦‍♂️, that was the wrong constant. Could you retry with LC_COLLATE please:

ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'

@MrMic
Copy link
Author

MrMic commented Aug 7, 2018

In Iterm2 => Nothing
In Hyper =>
ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
-e:1:in setlocale': error calling setlocale(1, "") (RuntimeError) from -e:1:in

'

@avdv
Copy link
Collaborator

avdv commented Aug 7, 2018

Weird. Do you have the exact same ruby interpreter at hand in iTerm2 and Hyper?

I have not much experience with rvm...

Why do you use such an old ruby version, 2.1.2 is no longer supported, even 2.2 support has ended?

@MrMic
Copy link
Author

MrMic commented Aug 7, 2018

I just install the latest ruby with rvm:
ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin17]

And the results of your command line is:

  • With Iterm2:
    ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
    /Users/mic/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- clocale (LoadError) from /Users/mic/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'

  • With Hyper:
    ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
    /Users/mic/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- clocale (LoadError) from /Users/mic/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'

@avdv
Copy link
Collaborator

avdv commented Aug 7, 2018

The latest Ruby should be 2.5.1, actually. What rvm command did you run?

However, since you freshly installed another Ruby version, you don't have the clocale gem installed yet. You need to run gem install clocale to do that before you can use it.

@MrMic
Copy link
Author

MrMic commented Aug 7, 2018

I have used:
rvm install ruby --latest

And installed clocale (gem) , the same way you mentioned.
Results:

  • With Iterm2: No output
  • With Hyper:
    ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
    -e:1:in setlocale': error calling setlocale(1, "") (RuntimeError) from -e:1:in '

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

According to https://askubuntu.com/questions/330072/how-to-find-and-install-latest-ruby-version-using-rvm#comment1051298_505276 rvm install ruby --latest seems not always to install the latest version. I don't know what it's supposed to do, but maybe try rvm install 2.5 -- that should get you version 2.5.1. You could also try upgrading rvm itself.

Does ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "C")' also result in an error in Hyper?

@MrMic
Copy link
Author

MrMic commented Aug 8, 2018

OK, now installed and switched to ruby 2.5.1
To be sure, I have also reinstalled clocale and colorls, just in case ...
No output for Iterm2 and Hyper, for the command:

  • ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "C")'

  • For the command: ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
    -> Iterm2: no output
    -> Hyper:
    ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
    Traceback (most recent call last):
    1: from -e:1:in <main>' -e:1:in setlocale': error calling setlocale(1, "") (RuntimeError)

I have also try ls (which is an alias for colorls ) :

  • Iterm2: Still OK
  • Hyper:
    6: from /Users/mic/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in <main>' 5: from /Users/mic/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in eval'
    4: from /Users/mic/.rvm/gems/ruby-2.5.1/bin/colorls:23:in <main>' 3: from /Users/mic/.rvm/gems/ruby-2.5.1/bin/colorls:23:in load'
    2: from /Users/mic/.rvm/gems/ruby-2.5.1/gems/colorls-1.1.1/exe/colorls:5:in <top (required)>' 1: from /Users/mic/.rvm/gems/ruby-2.5.1/gems/colorls-1.1.1/lib/colorls/flags.rb:38:in process'
    /Users/mic/.rvm/gems/ruby-2.5.1/gems/colorls-1.1.1/lib/colorls/flags.rb:38:in `setlocale': error calling setlocale(1, "") (RuntimeError)

Issue still not fixed ...

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

OK. That suggests there is indeed some difference in the environment which is causing that.

But according to your locale output above setlocale(LC_COLLATE, "") should actually have the same effect as setlocale(LC_COLLATE, "C") since LC_COLLATE is set to "C" on your machine. Maybe that does not work somehow?

Does ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "fr.UTF-8")' work in both terminals?

Does LC_COLLATE=C ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")' work in both terminals?

What does locale output in iTerm2? Any differences?

According to https://stackoverflow.com/a/30198089/4432837

[...] as of Mac OS X 10.10.3, collation is still broken for Spanish and most European languages.

10.10.5 still broken.. – bodman Dec 8 '15 at 8:01
10.12.6 still broken – François Jul 28 '17 at 14:29

I wonder whether it is now fixed..?!

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

What happens if you change the “Set locale variables automatically” setting in iTerm2? (in iTerm2 go to: Profiles -> Terminal, click the checkbox, restart iterm afterwards) Does it show the same behavior as Hyper?

@MrMic
Copy link
Author

MrMic commented Aug 8, 2018

  1. For: ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "fr.UTF-8")'
  • Iterm2 and Hyper:
    Traceback (most recent call last):
    1: from -e:1:in <main>' -e:1:in setlocale': error calling setlocale(1, "fr.UTF-8") (RuntimeError)
  1. For: LC_COLLATE=C ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'
  • Both terminal have no output.

@MrMic
Copy link
Author

MrMic commented Aug 8, 2018

The checkbox in Iterm2 was already checked !

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

The checkbox in Iterm2 was already checked !

OK, but I was asking you to change it. So, when you untick the box and restart iterm, does it show the same behaviour as Hyper? I would expect yes.

What is the output of locale in iTerm2 with the checkbox checked?

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

And what does locale -a | grep fr output? Is fr.UTF-8 listed?

@MrMic
Copy link
Author

MrMic commented Aug 8, 2018

ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "fr.UTF-8")'

  • Both terminal report error:
    Traceback (most recent call last):
    1: from -e:1:in <main>' -e:1:in setlocale': error calling setlocale(1, "fr.UTF-8") (RuntimeError)

LC_COLLATE=C ruby -r clocale -e 'CLocale.setlocale(CLocale::LC_COLLATE, "")'

  • Both terminal report no error.
  1. With checkbox no checked, locale report:
    LANG=
    LC_COLLATE="C"
    LC_CTYPE="en_US.UTF-8"
    LC_MESSAGES="C"
    LC_MONETARY="C"
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_ALL=

  2. With checkbox checked, locale report:
    LANG="fr_FR.UTF-8"
    LC_COLLATE="fr_FR.UTF-8"
    LC_CTYPE="en_US.UTF-8"
    LC_MESSAGES="fr_FR.UTF-8"
    LC_MONETARY="fr_FR.UTF-8"
    LC_NUMERIC="fr_FR.UTF-8"
    LC_TIME="fr_FR.UTF-8"
    LC_ALL=

** => Seems you are misspelling the locale ..., no ? **

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

** => Seems you are misspelling the locale ..., no ? **

I was just using what you gave me in your comment here: #203 (comment)

Try to set the locale in Hyper to fr_FR.UTF-8 like so:

export LANG=fr_FR.UTF-8

Does that work?

@MrMic
Copy link
Author

MrMic commented Aug 8, 2018

yes it works.
Now what I have to do for, permanent usage?

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

Now what I have to do for, permanent usage?

Depends on the Shell you're using. Is it bash? Add this statement to your ~/.bashrc.

@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

Maybe there's a setting in Hyper for this? Maybe it's a bug in Hyper that it does not correctly initialize the locale?

@MrMic
Copy link
Author

MrMic commented Aug 8, 2018

That why I asked! Because I use zsh and know how to export environment variables ...
But I thought it was an issue with Hyper!
In my other terminal, i do NOT need to export such things in
order to use colorls!

I will search docs, web ...
Thanks for all anyway.

Rgds,

@MrMic MrMic changed the title New issue since today [SOLVED] New issue since today Aug 8, 2018
@MrMic MrMic closed this as completed Aug 8, 2018
@avdv
Copy link
Collaborator

avdv commented Aug 8, 2018

To debug, look at the output of defaults read -g AppleLocale. Maybe that gives you a hint. Good luck!

@avdv
Copy link
Collaborator

avdv commented Aug 9, 2018

@MrMic FYI, here's a bug about your problem in Hyper: vercel/hyper#607

It should be fixed already in Hyper 2.1.0-canary.2 but see also here: vercel/hyper#3091

@MrMic
Copy link
Author

MrMic commented Aug 9, 2018

@avdv
There is an env variable in Hyper config file: I used it for
this purpose, now all seems OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants