Jira (PUP-8709) Iterable[T] with recursive type T results in endless recursion

1 view
Skip to first unread message

Henrik Lindberg (JIRA)

unread,
May 10, 2018, 9:00:03 AM5/10/18
to puppe...@googlegroups.com
Henrik Lindberg created an issue
 
Puppet / Bug PUP-8709
Iterable[T] with recursive type T results in endless recursion
Issue Type: Bug Bug
Assignee: Thomas Hallgren
Components: Type System
Created: 2018/05/10 5:59 AM
Fix Versions: PUP 5.5.z
Labels: Language typesystem
Priority: Major Major
Reporter: Henrik Lindberg

The following puppet snippet results in endless recursion

type StringData = Variant[String, Numeric, Iterable[StringData], Hash[StringData, StringData]]
notice([1,2,3] =~ Iterable[StringData])

It should have noticed true

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 10, 2018, 9:27:02 AM5/10/18
to puppe...@googlegroups.com
Henrik Lindberg commented on Bug PUP-8709
 
Re: Iterable[T] with recursive type T results in endless recursion

Also, a disptacher like this:

  dispatch :on_iterable do
    param 'Iterable[Variant[String, Numeric]]', :arg
  end

Does not match if called with something like [1, 'hello']

Josh Cooper (Jira)

unread,
Oct 23, 2020, 7:57:03 PM10/23/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Fix Version/s: PUP 5.5.z
Fix Version/s: PUP 6.y
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

David McTavish (Jira)

unread,
Dec 6, 2021, 3:17:02 PM12/6/21
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Priority: Major Normal
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

David McTavish (Jira)

unread,
Jan 12, 2022, 7:57:02 PM1/12/22
to puppe...@googlegroups.com
David McTavish updated an issue
Change By: David McTavish
Labels: Language final_triage typesystem
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Josh Cooper (Jira)

unread,
Jan 12, 2022, 11:31:02 PM1/12/22
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-8709
 
Re: Iterable[T] with recursive type T results in endless recursion

How often to users define their own data types with Iterable? I can definitely imagine:

type Something = Variant[String, Numeric, Hash[Something, Something]]

Endless recursion does seem bad though. It sounds like a support escalation waiting to happen. Using puppet#9b4e3473fb3fe439aef1c6875d7520c5a2d74058 the stack trace is:

...continues upward...
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3380:in `block in assignable?'  # starts repeating
/home/josh/work/puppet/lib/puppet/pops/types/recursion_guard.rb:54:in `with_this'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3380:in `assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:1448:in `_assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:146:in `assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3030:in `block in _assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3030:in `any?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3030:in `_assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:146:in `assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3017:in `assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3565:in `_assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:146:in `assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3380:in `block in assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/recursion_guard.rb:46:in `with_this'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:3380:in `assignable?'
/home/josh/work/puppet/lib/puppet/pops/types/types.rb:1415:in `instance?'
/home/josh/work/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb:609:in `eval_MatchExpression'

It seems the recursion guard is not working.

Josh Cooper (Jira)

unread,
Jan 12, 2022, 11:59:03 PM1/12/22
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-8709

It seems there was an earlier issue PUP-6108. The recursion guard was added to fix that, but it doesn't prevent recursion in this case (with Iterable)

Josh Cooper (Jira)

unread,
Jan 13, 2022, 12:03:02 AM1/13/22
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Feb 22, 2022, 2:48:02 PM2/22/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Labels: Language final_triage typesystem
Reply all
Reply to author
Forward
0 new messages