From: akr@... Date: 2014-08-06T13:09:33+00:00 Subject: [ruby-core:64231] [ruby-trunk - Bug #10093] [Feedback] SecureRandom.uuid is unstable Issue #10093 has been updated by Akira Tanaka. Status changed from Open to Feedback I see. "g" is not a valid character for UUID. However I couldn't reproduce the problem. I run following script but no problem happened in several days. ``` % ruby -v -rsecurerandom -e ' STDOUT.sync = true while true uuid = SecureRandom.uuid if /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/ !~ uuid p uuid end end' ruby 2.2.0dev (2014-06-11 trunk 46400) [x86_64-linux] ``` Can anyone reproduce the problem? Anyway, the method uses String#% as follows. ``` "%08x-%04x-%04x-%04x-%04x%08x" % ary ``` So "g" should not be produced unless String#% has a problem. ---------------------------------------- Bug #10093: SecureRandom.uuid is unstable https://bugs.ruby-lang.org/issues/10093#change-48223 * Author: Man Vuong * Status: Feedback * Priority: Normal * Assignee: * Category: lib * Target version: current: 2.2.0 * ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- SecureRandom.uuid sometimes generates some value like this: e7be09bb-e939-43db-9c20-dfad9c27fd3g And it's not a valid UUID. This problem occurred randomly for me, I don't know how to reproduce :( -- https://bugs.ruby-lang.org/