9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Yury Chumak <sfynkx@gmail.com>
To: 9front@9front.org
Subject: [9front] Bug in rc
Date: Wed, 26 Apr 2023 21:20:49 +0300	[thread overview]
Message-ID: <CAOe=0ddPe5nk9VQkO-t+VXPDpf2+Si_s2-iH3VpBhDny7ieehg@mail.gmail.com> (raw)

Hello all..

Noticed that rc returns error 'stack overflow' if code consists
'switch' construction with big amount of 'case' blocks. Steps to
reproduce:

1.Generate test script by next code:
#!/bin/rc
echo '#!/bin/rc' >test.rc
echo 'switch($*){' >>test.rc
for(i in `{seq 1 250}){
    echo ' case ' $i>>test.rc
    echo '    echo number ' $i>>test.rc
}
echo ' case *' >>test.rc
echo '    echo number none'>>test.rc
echo '}'>>test.rc

2. Run result script:
% chmod +x test.rc
% test.rc
./test.rc:497: token 248: yacc stack overflow

The 'switch' construction works normaly with number 'case' block less than 247.
In comparison linux's bash has no limitation to number elements in
'case' block (at least 500k tested).


-- 
Sphynkx

             reply	other threads:[~2023-04-26 22:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 18:20 Yury Chumak [this message]
2023-04-27  0:44 ` ori
2023-04-27  2:05   ` Yury Chumak
2023-04-27  2:15   ` Anthony Martin
2023-04-27  3:09     ` Yury Chumak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOe=0ddPe5nk9VQkO-t+VXPDpf2+Si_s2-iH3VpBhDny7ieehg@mail.gmail.com' \
    --to=sfynkx@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).