Forum: Ruby-core [ruby-trunk - Bug #7308][Open] Infinite recursion on circular 'using'

Posted by charliesome (Charlie Somerville) (Guest)
on 2012-11-08 11:15
(Received via mailing list)
Issue #7308 has been reported by charliesome (Charlie Somerville).

----------------------------------------
Bug #7308: Infinite recursion on circular 'using'
https://bugs.ruby-lang.org/issues/7308

Author: charliesome (Charlie Somerville)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 2.0.0-preview1


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.
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-08 14:57
(Received via mailing list)
Issue #7308 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to shugo (Shugo Maeda)
Target version set to 2.0.0


----------------------------------------
Bug #7308: Infinite recursion on circular 'using'
https://bugs.ruby-lang.org/issues/7308#change-32633

Author: charliesome (Charlie Somerville)
Status: Assigned
Priority: Normal
Assignee: shugo (Shugo Maeda)
Category:
Target version: 2.0.0
ruby -v: 2.0.0-preview1


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.
Posted by charliesome (Charlie Somerville) (Guest)
on 2012-11-09 11:38
(Received via mailing list)
Issue #7308 has been updated by charliesome (Charlie Somerville).

File prevent-circular-using.patch added

I've attached a patch that does a simple DFS to make sure no circular 
using relationship is created.
----------------------------------------
Bug #7308: Infinite recursion on circular 'using'
https://bugs.ruby-lang.org/issues/7308#change-32705

Author: charliesome (Charlie Somerville)
Status: Assigned
Priority: Normal
Assignee: shugo (Shugo Maeda)
Category:
Target version: 2.0.0
ruby -v: 2.0.0-preview1


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.
Posted by shugo (Shugo Maeda) (Guest)
on 2012-11-13 10:08
(Received via mailing list)
Issue #7308 has been updated by shugo (Shugo Maeda).


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.

----------------------------------------
Bug #7308: Infinite recursion on circular 'using'
https://bugs.ruby-lang.org/issues/7308#change-32845

Author: charliesome (Charlie Somerville)
Status: Closed
Priority: Normal
Assignee: shugo (Shugo Maeda)
Category:
Target version: 2.0.0
ruby -v: 2.0.0-preview1


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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.