Issue #1828 has been updated by masterzen.

Category changed from unknown to language
Status changed from Unreviewed to Ready for Testing
Assigned to changed from masterzen to jamtur01
% Done changed from 0 to 100
Complexity changed from Unknown to Trivial
Keywords set to if language bug integer conversion

tstoop wrote:
> 
> According to masterzen, the string gets converted to a float, which leads to 
> an invalid float which compares 0 to 0.

Actually, only the first 0 was converted to integer (and the rest ignored by 
ruby conversion routine), because the various regexs that checks for hex, octal 
or integer were not strict enough and buggy.

Fix & tests available in tickets/0.24.x/1828 in my github repository 
(masterzen/puppet):
http://github.com/masterzen/puppet/tree/tickets/0.24.x/1828

----------------------------------------
Bug #1828: Comparison of strings containing versions
http://projects.reductivelabs.com/issues/show/1828

Author: tstoop
Status: Ready for Testing
Priority: Normal
Assigned to: jamtur01
Category: language
Target version: 
Complexity: Trivial
Affected version: 0.24.6
Keywords: if language bug integer conversion


As discussed on IRC:

<pre>class puppet-version-test {
        if $puppetversion > "0.24.5" {
                notify { "newer than 0.24.5.": 
                        message => "We're newer than 0.24.5.",
                }
        }
        if $puppetversion == "0.24.5" {
                notify { "0.24.5":
                        message => "We're 0.24.5.",
                }
        }
        if $puppetversion > "0.24.6" {
                notify { "newer than 0.24.6.": 
                        message => "We're newer than 0.24.6.",
                }
        }
        if $puppetversion == "0.24.6" {
                notify { "0.24.6":
                        message => "We're 0.24.6.",
                }
        }
        if $puppetversion > "0.24.7" {
                notify { "newer than 0.24.7.": 
                        message => "We're newer than 0.24.7.",
                }
        }
        if $puppetversion == "0.24.7" {
                notify { "0.24.7":
                        message => "We're 0.24.7.",
                }
        }
        if $puppetversion > "0.24.8" {
                notify { "newer than 0.24.8.": 
                        message => "We're newer than 0.24.8.",
                }
        }
        if $puppetversion == "0.24.8" {
                notify { "0.24.8":
                        message => "We're 0.24.8.",
                }
        }
        notify { "puppetversion":
                message => $puppetversion,
        }
}</pre>

Which gives this output:

<pre>otice: We're 0.24.8.
notice: //Node[default]/puppet-version-test/Notify[0.24.8]/message: defined 
'message' as 'We're 0.24.8.'
notice: We're 0.24.7.
notice: //Node[default]/puppet-version-test/Notify[0.24.7]/message: defined 
'message' as 'We're 0.24.7.'
notice: We're 0.24.6.
notice: //Node[default]/puppet-version-test/Notify[0.24.6]/message: defined 
'message' as 'We're 0.24.6.'
notice: We're 0.24.5.
notice: //Node[default]/puppet-version-test/Notify[0.24.5]/message: defined 
'message' as 'We're 0.24.5.'
notice: 0.24.7
notice: //Node[default]/puppet-version-test/Notify[puppetversion]/message: 
defined 'message' as '0.24.7'</pre>

According to masterzen, the string gets converted to a float, which leads to an 
invalid float which compares 0 to 0.


----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to