Skip to content

Instantly share code, notes, and snippets.

@maiha
Created April 4, 2010 09:18
Show Gist options
  • Save maiha/355268 to your computer and use it in GitHub Desktop.
Save maiha/355268 to your computer and use it in GitHub Desktop.
% echo $PATH
/data/apps/maglev/bin:/home/maiha/bin:/usr/local/bin:/usr/bin:/bin
% echo $MAGLEV_HOME
/data/apps/maglev
% cd $MAGLEV_HOME
/data/apps/maglev% rake maglev:start
startstone[Info]: Starting Stone repository monitor "maglev".
startstone[Info]: GemStone server 'maglev' has been started.
/data/apps/maglev% maglev -v
maglev 0.7 (ruby 1.8.7) (2010-03-22 rev 23101-1134) [Linux x86_64]
/data/apps/maglev% maglev-ruby -e 'p RUBY_DESCRIPTION'
"ruby 1.8.7 (maglev patchlevel 249)"
/data/apps/maglev% maglev-irb
error , Expected nil to be a Boolean.,
during /data/apps/maglev/bin/maglev-irb
ERROR 2085, Expected nil to be a Boolean. (RuntimeError)
/data/apps/maglev% maglev-irb -f
error , Expected nil to be a Boolean.,
during /data/apps/maglev/bin/maglev-irb
ERROR 2085, Expected nil to be a Boolean. (RuntimeError)
/data/apps/maglev% uname -a
Linux mayuyu 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC 2010 x86_64 GNU/Linux
/data/apps/maglev% cat ~/.irbrc
cat: /home/maiha/.irbrc: No such file or directory
@maiha
Copy link
Author

maiha commented Apr 4, 2010

I found that our differences is LANG. It runs fine in "LANG=C".

    % LANG=C maglev-irb
    irb(main):001:0>

    % LANG=ja_JP.UTF-8 maglev-irb
    #<RuntimeError: Expected nil to be a Boolean.>
    /data/apps/maglev/lib/ruby/1.8/irb/locale.rb:44:in `String'

This error message is printed not on ver.23101 but on 23171, thanks.

The point is that string convertion magic is called from "lib/ruby/1.8/irb/locale.rb" only when LANG contains 'ja'. Then it needs Kconv library but it's not implemented yet. So I can start maglev-irb by one of the following.

  • call with LANG=C like above

  • fix irb/locale.rb to bypass the convertion (I prefer this because the magic is optional)

    % git diff
    --- a/lib/ruby/1.8/irb/locale.rb
    +++ b/lib/ruby/1.8/irb/locale.rb
    @@ -41,7 +41,8 @@ module IRB
           mes = super(mes)
           case @lang
           when /^ja/
    -       mes = Kconv::kconv(mes, lc2kconv(@lang))
    +       # mes = Kconv::kconv(mes, lc2kconv(@lang))
    +        mes
           else
            mes
           end
    

Well, I found that current maglev implementation lacks error handling about autoload on this issue. In short, it should check the const is defined correctly or not after autoload is processed. Let's image empty file 'foo.rb' like kconv.rb.

    % cat foo.rb
    # (empty file)

    # [matz-ruby]
    % ruby -e "autoload(:Foo,'foo'); Foo"
    -e:1: uninitialized constant Foo (NameError)

    # [maglev]
    % maglev-ruby -e "autoload(:Foo,'foo'); Foo"
    ERROR 2085, Expected nil to be a Boolean. (RuntimeError)

I believe that adding this specification makes maglev nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment