Jira (PUP-7843) The list of reserved type names known to the parser validator is incomplete

14 views
Skip to first unread message

Thomas Hallgren (JIRA)

unread,
Aug 15, 2017, 4:02:02 AM8/15/17
to puppe...@googlegroups.com
Thomas Hallgren created an issue
 
Puppet / Bug PUP-7843
The list of reserved type names known to the parser validator is incomplete
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2017/08/15 1:01 AM
Priority: Normal Normal
Reporter: Thomas Hallgren

The Checker4_0 class, used for validating the AST produced by the puppet parser, keeps a list named RESERVED_TYPE_NAMES. This list is incomplete. It lacks the following entries:

    'init' => true,
    'object' => true,
    'sensitive' => true,
    'semver' => true,
    'semverrange' => true,
    'string' => true,
    'timestamp' => true,
    'timespan' => true,
    'typeset' => true,

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Josh Cooper (Jira)

unread,
Sep 29, 2020, 3:35:04 PM9/29/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 7.0.0
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Sep 29, 2020, 3:35:04 PM9/29/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-7843
 
Re: The list of reserved type names known to the parser validator is incomplete

Adding them to reserved type names means they cannot be used as defined types (and I assume other places?). So currently, puppet will allow string but not array:

define string() {}
string { 'mystring': }
 
define array() {}
array { 'myarray': }

And puppet only complains about the array:

bx puppet parser validate reserved.pp
Error: Could not parse for environment production: The name: 'array' is already defined by Puppet and can not be used as the name of a 'define' expression. (file: /Users/josh/work/puppet/reserved.pp, line: 4, column: 1)

That said, what benefit is there to defining resource type names? Making this change could break manifests, and would need to be done on a major version boundary? Is there potential type confusion if we don't reserve these type names?

Josh Cooper (Jira)

unread,
Sep 29, 2020, 3:35:04 PM9/29/20
to puppe...@googlegroups.com

Henrik Lindberg (Jira)

unread,
Sep 30, 2020, 7:08:06 AM9/30/20
to puppe...@googlegroups.com

The issue is that for each define 'x' which is of type Resource['x'], there is also an alias 'X' to the defined Resource type. (the same for class 'x' which is a Class['x']). Thus any define or class in top scope has the potential to clash wrt. aliases vs. core data types.

Josh Cooper (Jira)

unread,
Oct 16, 2020, 1:28:03 PM10/16/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 28, 2020, 7:51:03 PM10/28/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Oct 28, 2020, 7:56:03 PM10/28/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Bug Fix
Release Notes Summary: A class or defined type in top scope can no longer be named 'init', 'object', 'sensitive', 'semver', 'semverrange', 'string', 'timestamp', 'timespan' or 'typeset' since those defined within core puppet. Those names can continue to be used in other scopes such as 'mymodule::object'.

Josh Cooper (Jira)

unread,
Oct 30, 2020, 2:17:03 PM10/30/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-7843
 
Re: The list of reserved type names known to the parser validator is incomplete

This passed puppet CI in 89d9333618. PEZ failures are unrelated, so resolving

Claire Cadman (Jira)

unread,
Nov 10, 2020, 5:40:02 AM11/10/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages