On Tue, 1 Sep 2015 00:18:12 +0200 Francesco Poli wrote:
> Hello all,
> while testing some odd locale configurations with the package
> I maintain (apt-listbugs), I stumbled upon an awkward crash.
> I am seeking the help of some knowledgeable Ruby expert, to understand
> what's going on.
>
> The crash may be reproduced with apt-listbugs version 0.1.14 or later
> (which uses the ruby-unicode library to correctly compute the width of
> UTF-8 strings).
>
> $ locale
> LANG=en_US.UTF-8
> LANGUAGE=
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> $ apt-listbugs -v
> 0.1.17
>
> So far so good, everything works as expected.
> But, if I try the following odd locale configuration (Italian language
> with 'C' locale settings), I get a crash:
>
> $ LANGUAGE='it_IT:it' LC_ALL='C' locale
> LANG=en_US.UTF-8
> LANGUAGE=it_IT:it
> LC_CTYPE="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_COLLATE="C"
> LC_MONETARY="C"
> LC_MESSAGES="C"
> LC_PAPER="C"
> LC_NAME="C"
> LC_ADDRESS="C"
> LC_TELEPHONE="C"
> LC_MEASUREMENT="C"
> LC_IDENTIFICATION="C"
> LC_ALL=C
> $ LANGUAGE='it_IT:it' LC_ALL='C' apt-listbugs -v
> /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:390:in `width': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
> from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:390:in `<class:SimpleViewer>'
> from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:387:in `<class:Viewer>'
> from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:381:in `<top (required)>'
> from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
> from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
> from /usr/bin/apt-listbugs:349:in `<main>'
>
>
> The failing statements are:
>
> DeprecatedWarning = _("********** on_hold IS DEPRECATED. USE p INSTEAD to use pin **********")
> DeprecatedWarningHeader = "*" * Unicode.width(DeprecatedWarning)
>
> If I understand correctly, what seems to happen is that:
>
> • the DeprecatedWarning string is assigned the Italian translation of
> the English message
>
> • the English message is ASCII, while the Italian translation
> includes some non-ASCII UTF-8 characters
>
> • ruby-gettext returns a non-UTF-8 string, since LC_CTYPE is 'C' (?)
>
> • ruby-unicode fails to compute the width of this string, since it
> unsuccessfully attempts to convert it to UTF-8 (?)
>
>
> Now, my question is: which package should be blamed for the crash?
>
> Should I change the way I use ruby-unicode in apt-listbugs?
> Or should I report a bug against package ruby-unicode? Or against
> package ruby-gettext or ruby-locale?
>
> Could some Ruby expert shed some light on this issue, please?
> Thanks for your time!
>
>
> P.S.: I am not subscribed to debian-ruby, hence please Cc me on replies.
Any idea?
Sorry to bother you again, but I would like to file a bug report
against the correct package, rather than against the first that comes
to my mind...
Thanks for any help you may provide.
--
http://www.inventati.org/frx/
There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
GnuPG key fpr == CA01 1147 9CD2 EFDF FB82 3925 3E1C 27E1 1F69 BFFE
Attachment:
pgpK6edVEyld2.pgp
Description: PGP signature