[DRE-maint] Bug#596351: ohai fails with: to_json: source sequence is illegal/malformed

Enrico Zini enrico at enricozini.org
Sat Nov 13 19:03:01 UTC 2010


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 <enrico at enricozini.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20101113/6f72d310/attachment.pgp>


More information about the Pkg-ruby-extras-maintainers mailing list