From: Jilles Tjoelker <jilles@stack.nl>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Eric Blake <eblake@redhat.com>,
"Taylan Ulrich B." <taylanbayirli@gmail.com>,
dash <dash@vger.kernel.org>
Subject: Re: 'continue' does not work in files sourced with dotcmd
Date: Sun, 10 Jul 2011 21:03:34 +0200 [thread overview]
Message-ID: <20110710190334.GA47384@stack.nl> (raw)
In-Reply-To: <20110709140730.GA6901@gondor.apana.org.au>
On Sat, Jul 09, 2011 at 10:07:30PM +0800, Herbert Xu wrote:
> On Sat, Jul 09, 2011 at 03:07:04PM +0200, Jilles Tjoelker wrote:
> > A fix for dash is below. The dash code is broken in a different way than
> > the FreeBSD sh code was, but the patched code is pretty much the same.
> > This makes the above test work and does not change the outcome of any
> > other tests in the FreeBSD sh testsuite.
> You're right. But I think your patch may introduce a problem
> with a return statement inside a dot script. That should not
> have an effect after exiting the script.
Interesting. Dash has been returning from the closest scope (function or
sourced script) for a while, but the SKIPFUNC/SKIPFILE distinction and
the comment in eval.c returncmd()
] /*
] * If called outside a function, do what ksh does;
] * skip the rest of the file.
] */
still gave me the impression that it behaved like older ash (also in
FreeBSD and NetBSD), trying to be bug-compatible with the Bourne shell
by having 'return' return from a function, if any, and only return from
a dot script if there is no function (because the Bourne shell gives an
error in that case).
It may be better to name the constant SKIPRETURN rather than SKIPFUNC.
> Anyway, the following patch based on your idea should fix the
> problem.
> commit 4f7e206782675b548565ca2bc82bc8c262a0f20e
> Author: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Sat Jul 9 22:05:22 2011 +0800
>
> [BUILTIN] Merge SKIPFUNC/SKIPFILE and only clear SKIPFUNC when leaving dotcmd
Yes, this works too.
--
Jilles Tjoelker
prev parent reply other threads:[~2011-07-10 19:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-26 18:23 'continue' does not work in files sourced with dotcmd Taylan Ulrich B.
2011-07-07 3:37 ` Herbert Xu
2011-07-07 13:26 ` Eric Blake
2011-07-07 14:46 ` Herbert Xu
2011-07-07 15:18 ` Eric Blake
2011-07-08 8:09 ` Herbert Xu
2011-07-09 13:07 ` Jilles Tjoelker
2011-07-09 14:07 ` Herbert Xu
2011-07-10 19:03 ` Jilles Tjoelker [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=20110710190334.GA47384@stack.nl \
--to=jilles@stack.nl \
--cc=dash@vger.kernel.org \
--cc=eblake@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=taylanbayirli@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.