Thanks Jay.
That foots with the repro I just did with a Ruby 2-liner. Only box affected is the Ubuntu 10.04.4 which claims to have the same ruby -v output but is clearly incorporating the code you referenced.
Interestingly 1.9.2 doesn't seem to have the problem. It sorts complete differently but consistently with identical hashes. I appreciate you identifying the cause.
-J Sent via iPhone
Is your email Premiere? On Nov 7, 2012, at 20:13, Jay Feldblum <
">
> wrote: Jason,
The key order in Ruby 1.8 depends on the hashes of the keys. But as of Ruby 1.8.7-p357, the algorithm for computing hashes was changed. The algorithm used to be constant, but now it is seeded with a new seed computed each time the Ruby VM starts up. See https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2011-4815 .
Cheers, Jay On Wed, Nov 7, 2012 at 10:39 PM, Jason J. W. Williams <
" target="_blank">
> wrote:
We're also seeing it in another template that's converting an array to a string:
mynetworks = <%= @my_networks.join(", ") %>
Again, we've never had this issue before with this code either. I'm curious why we're only seeing this problem now on a new node, and not when we were developing these cookbooks, or for the months they've been running.
-JOn Wed, Nov 7, 2012 at 7:25 PM, Jason J. W. Williams <
" target="_blank">
> wrote:
They may not preserve ordering when adding/removing items are involved, but absent anything changing in the hash, we haven't seen them change. These cookbooks have been running for months with no problem (and continuing with no problem on the other nodes).
-JOn Wed, Nov 7, 2012 at 7:20 PM, AJ Christensen <
" target="_blank">
> wrote:
Hashes don't preserve ordering in Ruby 1.8.7
I'd suggest installing and using Chef with the Omnibus Installers, this will give you a modern Ruby environment (1.9.3-p194 or similar)
Cheers,
AJ
|