Closed prurigro closed 8 years ago
I will fix it. It should be quite trivial.
Thanks for taking a look!
@prurigro can you try: https://github.com/Kubuxu/cjdns/tree/fix/js-random
Build completed successfully, type ./cjdroute to begin setup.
-- works like a charm, nicely done! Any idea if that fix will maintain the integrity of the values generated by 5.x and below? Edit: Actually, I misread what you did, your solution seems legit
This has been merged into https://github.com/cjdelisle/cjdns/tree/crashey and will eventually trickle down into this repo so I see no reason to keep this issue open any longer. Thanks again @Kubuxu!
Improvements in the node 6.0.0+
Math.random()
functionality have changed the values it generates, causing larger hex values to be produced as seen in the following screenshot:This causes (at least) this function to produce values too large for the
unsigned long
its used to populate in memory/Allocator.c, which results in a build failure with the following output:To make sure this wasn't a difference in the hex conversion functionality
toString(16)
, I plugged a value generated by theMath.random()
function in v6.0.0 into a variable in v5.11.0 and thetoString(16)
operation resulted in the same value as v6.0.0 generated.I asked in
#Node.js
on freenode and a mod said this change in behaviour is an improvement and not a bug, and won't be returning to how it was done in < 6.0.0. Unfortunately, this means that there are now two sets of possible behavioural styles to consider, and I'm not sure whether it would be best to find a meet-in-the-middle solution that would handle both or simply find a new source for random values (what are opinions on/dev/random
these days?).