CustomerA customer noticed this after the move from facter 3 to facter 4, using the following code, i I have reproduced this locally:
{code:java} Facter.add("hello(there") do setcode do "greetings" end end {code}
Results in:
{code:java} $ facter -p Traceback (most recent call last): 31: from /opt/puppetlabs/puppet/bin/facter:10:in `<main>' 30: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/cli_launcher.rb:23:in `start' 29: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start' 28: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' 27: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' 26: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' 25: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/cli.rb:124:in `query' 24: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:454:in `to_user_output' 23: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:521:in `resolve_facts_for_user_query' 22: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact_manager.rb:24:in `resolve_facts' 21: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:7:in `resolve_facts' 20: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:19:in `external_facts' 19: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:19:in `each' 18: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:21:in `block in external_facts' 17: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:127:in `value' 16: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:177:in `searching' 15: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:137:in `block in value' 14: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:161:in `resolve_value' 13: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:134:in `core_value' 12: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact_manager.rb:67:in `resolve_core' 11: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact_manager.rb:83:in `core_fact' 10: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:31:in `parse' 9: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:31:in `each' 8: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:32:in `block in parse' 7: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:53:in `search_for_facts' 6: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:53:in `times' 5: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:55:in `block in search_for_facts' 4: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:68:in `get_facts_matching_tokens' 3: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:68:in `each' 2: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:71:in `block in get_facts_matching_tokens' 1: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:88:in `found_fact?' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/parsers/query_parser.rb:88:in `match': end pattern with unmatched parenthesis: /^hello(there($|\\.)/ (RegexpError) {code}
In Facter 3 this would return:
{code:java} hello(there => greetings {code}
~* Please see Zendesk Support tab for further comments and attachments.~
Previously, regex metacharacters were not escaped when parsing names; this manifested a little but differently for FACT-3178, but the fixe for that also fixed this issue.