On 2014-01-11 2:22, Henrik Lindberg wrote:
Yet again someone was bit by the automatic String to Numeric conversion
that is in Puppet (and also in --parser future).
The particular thing this time was
https://tickets.puppetlabs.com/browse/PUP-3602 that caused certain md5
fingerprints to look like floating point values of value 0 (they all
started with "0e" but had different digits after the e, and since 0 * 10
^something is always 0 the two different md5 fingerprints were reported
to being equal.
This is not the only place where String to number conversion is a very
bad idea. Someone recently had problems with conversions in a case
where string comparison was wanted for version strings.
https://tickets.puppetlabs.com/browse/PUP-3333 has the details.
With --parser future it is at least consistent. In 3x different
operators used different rules. Now <, >, <=, >=, ==, and != all share
the same behavior; they convert a string to numeric if both sides of the
expression are numeric or can be converted to numeric.
The in operator has some additional rules (see the spec, but it uses
the same comparisons as for the regular operators).
We fixed PUP-3602 by not converting strings that are floating point 0
with exponential part and we also do not convert values that are
floating point infinite in Ruby (e.g. 4e999 and such). This is a crutch
though, and it is only a matter of time until someone stumbles over the
next SURPRISE !
The best cure is naturally to never do String to numeric conversion. And
we wonder what people feel about that. Should we go for this in Puppet
4.0.0 (and have a 3.7.4 release as the last of the 3x series where this
behavior is implemented when using --parser future).
So - "Boldly break all the (s)t(r)hings"?
Opened ticket PUP-3615 and we are going to make the change in 3.7.4 for
parser=future.
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
You received this message because you are subscribed to the Google Groups "Puppet
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/m3bgi7%24fef%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.