Bug#733110: wordnet: Please migrate to Ruby 2.0/1.9

Antonio Terceiro terceiro at debian.org
Tue Jan 28 19:55:02 UTC 2014


Control: tags -1 + patch

On Tue, Jan 28, 2014 at 07:39:56PM +0100, David Suárez wrote:
> El Martes, 28 de enero de 2014 14:35:37 Andreas Tille escribió:
> > Hi,
> > 
> > Dmitry E. Oboukhov has injected some Ruby 1.8 code into the wordnet
> > packaging.  I personally do not speak Ruby and thus can not fix the
> > problem in an other way than simply droping the goldendict-wordnet
> > binary package (its data package is created in this way).
> > 
> > Since Dmitry has not (yet) respondet to this bug report I would like
> > to ask the Ruby team to find a patch for the problem in the build
> > system that fixes the following:
> > 
> > 
> > WARNING: sentidx.vrb format error: ["pet%2:35:00::"]
> > debian/wn-for-goldendict.rb:300:in `initialize': undefined method `times'
> > for "\x01":String (NoMethodError) from debian/wn-for-goldendict.rb:158:in
> > `new'
> >         from debian/wn-for-goldendict.rb:158:in `get_data'
> >         from debian/wn-for-goldendict.rb:648:in `block (2 levels) in <main>'
> > from debian/wn-for-goldendict.rb:647:in `each'
> >         from debian/wn-for-goldendict.rb:647:in `block in <main>'
> >         from debian/wn-for-goldendict.rb:644:in `foreach'
> >         from debian/wn-for-goldendict.rb:644:in `<main>'
> > 
> > 
> > If I do not get any help I need to go the unfortunate route to kick
> > goldendict support again.
> 
> The code it's trying to convert an hexadecimal string to an integer.
> 
> line 296      -> @w_cnt = [data[3]].pack('H2')[0]
> changes to -> @w_cnt = data[3].hex

I don't think so ... he wants to replace pack(**)[0] with
pack(**).bytes.first

$ irb1.8
>> ['1'].pack('H2')[0]
=> 16
>> '1'.hex
=> 1
>> ['1'].pack('H2').bytes.first
=> 16

$ irb1.9.1
>> ['1'].pack('H2')[0]
=> "\x10" # <-- indexing the output of pack() in Ruby 1.9+ has a different semantics
>> '1'.hex
=> 1      # <-- not what you want
>> ['1'].pack('H2').bytes.first
=> 16     # <-- you want this

Try the attached patch. Please check the output files though.

-- 
Antonio Terceiro <terceiro at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wordnet.patch
Type: text/x-diff
Size: 2584 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20140128/208b9491/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20140128/208b9491/attachment.sig>


More information about the debian-science-maintainers mailing list