Bug #7308
closed
Infinite recursion on circular 'using'
Added by Anonymous about 12 years ago.
Updated about 12 years ago.
Description
This code causes infinite recursion:
module X; using X; end
Note that any circular 'using' will cause infinite recursion, not just a module using itself:
module A; end
module B; using A; end
module A; using B; end
This raises a SystemStackError on my OS X Lion machine, but it causes a segmentation fault on Ubuntu 10.04 i686 (running 2.6.32-38). I've attached a dump of an IRB session which finishes with a segfault.
Files
- Status changed from Open to Assigned
- Assignee set to shugo (Shugo Maeda)
- Target version set to 2.0.0
I've attached a patch that does a simple DFS to make sure no circular using relationship is created.
- % Done changed from 0 to 100
- Status changed from Assigned to Closed
This issue was solved with changeset r37646.
Charlie, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
charliesome (Charlie Somerville) wrote:
I've attached a patch that does a simple DFS to make sure no circular using relationship is created.
Thank you. I've changed it to raise an ArgumentError instead of TypeError for the consistency with the cyclic include detection.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0