Issue #12479 has been updated by Matthaus Litteken.

Target version changed from 2.7.13 to 2.7.14


----------------------------------------
Bug #12479: Regular expression matching against an undefined variable results 
in matching the string `undef`
https://projects.puppetlabs.com/issues/12479#change-60529

Author: Nicolas Simonds
Status: Merged - Pending Release
Priority: Normal
Assignee: 
Category: parser
Target version: 2.7.14
Affected Puppet version: 2.6.0
Keywords: 
Branch: https://github.com/puppetlabs/puppet/pull/470


Non-existent variables are stringify-ing under the hood as `"undef"`, which 
causes them to match regexes, despite behaving like nil or the empty string 
when otherwise asked.

A simple demonstration manifest:

<pre>
case $wtf { "undef": { notice("matched string undef") } }
case $wtf { /^undef$/: { notice("matched regexp undef") } }
case $wtf { "": { notice("matched empty string") } }
case $wtf { undef: { notice("matched bareword undef") } }
</pre>

Expected result:

All notices that the non-existent fact or variable doesn't match.

Actual result:

Various and sundry notices that it matched.  BAD PUPPET!  NO COOKIE!

All die of embarrassment.


-- 
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://projects.puppetlabs.com/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