Jira (FACT-3199) facts with regular expression matching characters in the name of the fact cause facter 4 to crash

0 views
Skip to first unread message

Charmaine Pritchett (Jira)

unread,
May 3, 2023, 11:34:03 AM5/3/23
to puppe...@googlegroups.com
Patrick Grant created an issue
 
Facter / Bug FACT-3199
facts with regular expression matching characters in the name of the fact cause facter 4 to crash
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2023/05/03 8:33 AM
Priority: Normal Normal
Reporter: Patrick Grant

Customer noticed this after the move from facter 3 to facter 4, using the following code, i have reproduced this locally:

* Please see Zendesk Support tab for further comments and attachments.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Charmaine Pritchett (Jira)

unread,
May 3, 2023, 11:34:03 AM5/3/23
to puppe...@googlegroups.com

Patrick Grant (Jira)

unread,
May 3, 2023, 11:35:03 AM5/3/23
to puppe...@googlegroups.com

Patrick Grant (Jira)

unread,
May 3, 2023, 11:37:03 AM5/3/23
to puppe...@googlegroups.com
Patrick Grant updated an issue
Customer A 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.~

Josh Cooper (Jira)

unread,
May 8, 2023, 10:03:02 PM5/8/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 8, 2023, 10:04:03 PM5/8/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 8, 2023, 10:04:03 PM5/8/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 9, 2023, 3:50:02 PM5/9/23
to puppe...@googlegroups.com

Aria Li (Jira)

unread,
May 9, 2023, 4:18:03 PM5/9/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 18, 2023, 2:53:01 PM5/18/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Story Points: 2
This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Atlassian logo

Josh Cooper (Jira)

unread,
May 18, 2023, 3:44:02 PM5/18/23
to puppe...@googlegroups.com

Tony Vu (Jira)

unread,
May 24, 2023, 4:59:02 PM5/24/23
to puppe...@googlegroups.com

Tony Vu (Jira)

unread,
Jun 13, 2023, 2:54:03 PM6/13/23
to puppe...@googlegroups.com
Tony Vu updated an issue
Change By: Tony Vu
Release Notes: Bug Fix
Release Notes Summary: 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.

Parker Leach (Jira)

unread,
Jun 14, 2023, 1:03:02 PM6/14/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages