On Sat, Sep 18, 2010 at 04:10:11PM +0200, Michael Schutte wrote:

> > /usr/lib/ruby/1.8/json/common.rb:232:in `to_json': source sequence is 
> > illegal/malformed (JSON::GeneratorError)
> >         from /usr/lib/ruby/1.8/json/common.rb:232:in `pretty_generate'
> >         from /usr/lib/ruby/1.8/ohai/system.rb:222:in `json_pretty_print'
> >         from /usr/lib/ruby/1.8/ohai/application.rb:104:in `run_application'
> >         from /usr/lib/ruby/1.8/ohai/application.rb:75:in `run'
> >         from /usr/bin/ohai:47
> 
> I notice you are using an 8-bit charset; perhaps there is some non-UTF-8
> data that might upset the JSON library.  May I ask you the problem is
> still present when you run “LANG=C LC_ALL=C ohai”?
> 
> I guess the results of “ohai -ldebug” could also be useful to diagnose
> the issue.

Good catch, it is indeed the case.

you can reproduce this bug by editing /etc/passwd, adding some accented
letter to some user's full name, :set fileencoding=latin1 and save.

Then ohai will indeed fail like that. It will also fail with LANG=C
LC_ALL=C.

$ LANG=C LC_ALL=C ohai
/usr/lib/ruby/1.8/json/common.rb:232:in `to_json': source sequence is 
illegal/malformed (JSON::GeneratorError)
        from /usr/lib/ruby/1.8/json/common.rb:232:in `pretty_generate'
        from /usr/lib/ruby/1.8/ohai/system.rb:222:in `json_pretty_print'
        from /usr/lib/ruby/1.8/ohai/application.rb:104:in `run_application'
        from /usr/lib/ruby/1.8/ohai/application.rb:75:in `run'
        from /usr/bin/ohai:47


Ciao,

Enrico

-- 
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <enr...@enricozini.org>

Attachment: signature.asc
Description: Digital signature

Reply via email to