Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1...1..0 keeps Rakudo on 100% CPU usage #1783

Closed
p6rt opened this issue May 24, 2010 · 8 comments
Closed

1...1..0 keeps Rakudo on 100% CPU usage #1783

p6rt opened this issue May 24, 2010 · 8 comments

Comments

@p6rt
Copy link

p6rt commented May 24, 2010

Migrated from rt.perl.org#75316 (status was 'resolved')

Searchable as RT75316$

@p6rt
Copy link
Author

p6rt commented May 24, 2010

From @bbkr

[18​:32] <bbkr> rakudo​: say 1...1..0 # this one kills Rakudo, should it be
check for valid type on right side of ... operator?
[18​:32] <p6eval> rakudo a4d326​: ( no output )
[18​:32] <colomon> bbkr​: it should work
[18​:32] <colomon> it's a ... bug
[18​:34] <colomon> bbkr​: actually, what error does it get?
[18​:34] <colomon> (and looking at it again, it shouldn't work, exactly.)
[18​:34] <colomon> (oh, I see, no output)
[18​:35] <bbkr> no error, looks like infinite loop
[18​:35] <colomon> rakudo​: say 1..0
[18​:35] <p6eval> rakudo a4d326​: OUTPUT«â�¤Â»
[18​:35] <colomon> rakudo​: say 1...()
[18​:35] <p6eval> rakudo a4d326​: ( no output )
[18​:35] <colomon> yeah, okay, that won't ever do anything useful.
[18​:36] --> isBEKaml has joined this channel (~keml@​122.174.115.64).
[18​:36] <isBEKaml> hello, #perl6!
[18​:36] <colomon> o/
[18​:37] <-- proller has left this server (Ping timeout​: 260 seconds).
[18​:37] <bbkr> colomon​: so is it bug or not (despite code being pointless)?
[18​:37] <colomon> btw, I don't see any obvious way to type \ on my phone,
which means if I irc from it one hand will get worn out.
[18​:38] <colomon> bbkr​: definite bug, I'd say.

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @bbkr

$ perl6 -e 'say 1...()'
$ echo $?
0

Works on kiev build, need some tests.

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @bbkr

tests added in t/spec/S03-operators/series.t

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

@bbkr - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 29, 2010
@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S03-operators/series.t

commit d185f82791a7301e389dc8c6df9754c8a937f808
Author​: bbkr <bbkr@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Jun 29 12​:23​:22 2010 +0000

  t[t/spec] tests for RT #​75316 1...1..0 keeps Rakudo on 100% CPU usage
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31500 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-operators/series.t b/t/spec/S03-operators/series.t
index 8b18c8e..df19d2c 100644
--- a/t/spec/S03-operators/series.t
+++ b/t/spec/S03-operators/series.t
@@ -143,6 +143,10 @@ is (1, -1, 1 ... -2), Nil, 'empty alternating series (2)';
 # RT #75698
 ok ?(one((-5 ... ^5).flat) == 0), '-5 ... ^5 produces just one zero';
 
+# RT #75316
+isa_ok (1...()), Failure,
+    'empty list on right side of series operator does not cause infinite loop';
+
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Sep 23, 2014

From @usev6

The test for this ticket (which now resides in S03-sequence/basic.t) was fudged for rakudo (todo 'mysterious').

AFAIU the code { 1 ... () } now throws an exception (just like shifting one element from an empty list does). Therefore I changed the test (and unfudged it)​:

throws_like { 1 ... () },
  X​::AdHoc,
  'RT# 75698​: empty list on right side of sequence operator does not cause infinite loop (but throws exception)',
  message => 'Element shifted from empty list';

The pull request for roast is here​: Raku/roast#46

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 23, 2014

From @usev6

The test for this ticket (which now resides in S03-sequence/basic.t) was fudged for rakudo (todo 'mysterious').

AFAIU the code { 1 ... () } now throws an exception (just like shifting one element from an empty list does). Therefore I changed the test (and unfudged it)​:

throws_like { 1 ... () },
  X​::AdHoc,
  'RT# 75698​: empty list on right side of sequence operator does not cause infinite loop (but throws exception)',
  message => 'Element shifted from empty list';

The pull request for roast is here​: Raku/roast#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant