Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 267326 - dev-lang/ruby-1.8.7: securerandom with UTF-8 produces output incompatible to 1.9
Summary: dev-lang/ruby-1.8.7: securerandom with UTF-8 produces output incompatible to 1.9
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-24 12:27 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2012-04-30 07:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2009-04-24 12:27:39 UTC
% irb18 -KU
irb(main):001:0> require 'securerandom'
=> true
irb(main):003:0> SecureRandom.random_bytes(32).split("").size
=> 22

Without UTF-8 strings, or with Ruby 1.9, the problem is not there and it always returns 32. This actually causes uuidtools to break.
Comment 1 Hans de Graaff gentoo-dev 2009-06-13 10:56:48 UTC
This is not yet fixed in ruby 1.8.7_p173
Comment 2 Hans de Graaff gentoo-dev 2010-12-31 13:18:33 UTC
Looking at this again I wonder if this isn't a bug in uuidtools: perhaps it should check for the $KCODE stuff and change its code accordingly. After all you've requested all string to be UTF-8 with the -K option.

In any case 1.8.7_p302 and ree18 1.8.7.2010.02-r1 both still have this behaviour. jruby runs out of heap space.
Comment 3 Hans de Graaff gentoo-dev 2012-04-30 07:08:51 UTC
Thinking about this a bit more it seems to be that this is by design due to ruby 1.8's lack of proper support for UTF-8.