Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6336

Quoted string "undef" treated as value undef

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: PUP 4.5.0
    • Fix Version/s: PUP 4.5.1
    • Component/s: None
    • Labels:
    • Template:
    • Acceptance Criteria:
      Hide

      That notice 'undef' in puppet is noticed as a string when running on puppetserver (as well as on MRI)

      Show
      That notice 'undef' in puppet is noticed as a string when running on puppetserver (as well as on MRI)
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2016-06-01
    • Release Notes Summary:
      Hide
      A regression was found that caused 'undef' to be equal to a literal undef when running on JRuby. This in turn is caused in what appears to be a discrepancy in the implementations of String and Symbol in MRI vs. JRuby.

      Users writing Ruby code should be aware that String == Symbol is different than Symbol == String and that the safe way to make such comparisons until discrepancies are solved (or before Puppet 5.0.0) should compare symbols using {{:undef.equal?(x)}} rather than {{:undef == x}} (which will fail), and {{x == :undef}} (since that triggers a slower code path on JRuby).
      Show
      A regression was found that caused 'undef' to be equal to a literal undef when running on JRuby. This in turn is caused in what appears to be a discrepancy in the implementations of String and Symbol in MRI vs. JRuby. Users writing Ruby code should be aware that String == Symbol is different than Symbol == String and that the safe way to make such comparisons until discrepancies are solved (or before Puppet 5.0.0) should compare symbols using {{:undef.equal?(x)}} rather than {{:undef == x}} (which will fail), and {{x == :undef}} (since that triggers a slower code path on JRuby).

      Description

      Puppet is treating the quoted string "undef" as value undef, which breaks (at least) the logrotate module: https://forge.puppet.com/yo61/logrotate

      Sample code:

        $var1 = undef
        $var2 = "undef"
        $var3 = 'undef'
        $var4 = "'undef'"
        $var5 = '"undef"'
        notify { "VAR1: ${var1} VAR2: ${var2} VAR3: ${var3} VAR4: ${var4} VAR5: ${var5}": }
      

      Outputs:

      Notice: VAR1:  VAR2:  VAR3:  VAR4: 'undef' VAR5: "undef"
      

      Discussion:
      https://groups.google.com/forum/#!topic/puppet-users/X-XrjM9oJYE
      https://github.com/yo61/puppet-logrotate/issues/26

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  durist Daniel Urist
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: