dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zdenek Kaspar <zkaspar82@gmail.com>
To: Harald van Dijk <harald@gigawatt.nl>, dash@vger.kernel.org
Subject: Re: dash 0.5.9: break and continue bug
Date: Wed, 24 Aug 2016 00:24:19 +0200	[thread overview]
Message-ID: <8b03873e-32d7-d450-9dfb-d9d6e4ac4632@gmail.com> (raw)
In-Reply-To: <377a8f04-2ecb-0171-7fb4-5baeacefab26@gigawatt.nl>

On 08/23/2016 10:41 PM, Harald van Dijk wrote:
> On 23/08/16 22:23, Zdenek Kaspar wrote:
>> Hi, I've noticed 0.5.9 does ignore break and continue statements, here
>> is simple reproducer:
>>
>>
>> one() {
>>     echo "  one"
>>     break
>> }
>>
>> two() {
>>     echo "  two"
>> }
>>
>> for i in 1 2
>> do
>>     echo "loop $i:"
>>     one
>>     two
>> done
>>
>>
>> dash-0.5.9:
>> $ dash dash-break-test
>> loop 1:
>>   one
>>   two
>> loop 2:
>>   one
>>   two
>>
>> dash-0.5.8-4.fc24.x86_64:
>> $ dash dash-break-test
>> loop 1:
>>   one
> 
> break and continue now need to appear in the loop directly, they cannot
> be wrapped in a function any more. Although this is a visible change in
> behaviour, it is intentional:
>   <https://www.mail-archive.com/dash%40vger.kernel.org/msg00929.html>
> 
> The standard is a bit unclear on how break and continue are meant to
> behave in these situations, as it refers to the "enclosing loop" without
> defining what counts and doesn't count as the enclosing loop, but the
> next version of the standard will make it clear that your script is not
> required to behave the way you expect:
>   <http://austingroupbugs.net/view.php?id=842>
> 
> That said, shells are still allowed to treat your script the way you
> expect.
> 
>> HTH, Z.

Kinda sucks it does not abort execution completely and write some error
message then, because this can do some damage...

Anyway, thanks Harald for pointing me to changed SPEC where this (new)
behaviour is explained.

THX, Z.

      reply	other threads:[~2016-08-23 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 20:23 dash 0.5.9: break and continue bug Zdenek Kaspar
2016-08-23 20:41 ` Harald van Dijk
2016-08-23 22:24   ` Zdenek Kaspar [this message]

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=8b03873e-32d7-d450-9dfb-d9d6e4ac4632@gmail.com \
    --to=zkaspar82@gmail.com \
    --cc=dash@vger.kernel.org \
    --cc=harald@gigawatt.nl \
    /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).