From: Stefano Lattarini <stefano.lattarini@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Chet Ramey <chet.ramey@case.edu>, dash@vger.kernel.org
Subject: Re: [BUG] dash doesn't report syntax error when it should on stray "fi"
Date: Mon, 23 Apr 2012 21:53:21 +0200 [thread overview]
Message-ID: <4F95B331.7070707@gmail.com> (raw)
In-Reply-To: <20120423194453.GA13576@burratino>
Hi Jonathan, Chet.
On 04/23/2012 09:44 PM, Jonathan Nieder wrote:
> Chet Ramey wrote:
>
>> What are `conforming scripts'? Scripts without syntax errors?
>
> I meant "conforming POSIX applications".
>
> A patch for this might even be welcome if it makes dash bigger, if
> that's what you're wondering.
>
I have no patch, but a little more information that might help anyone who
volunteers to write one:
$ nl=$'\n'
$ dash -c ":$nl fi" && echo NOERR
dash: Syntax error: "fi" unexpected
$ dash -c ":;$nl fi" && echo NOERR
dash: Syntax error: "fi" unexpected
$ dash -c ":&$nl fi" && echo NOERR
dash: Syntax error: "fi" unexpected
$ dash -c ": && fi" && echo NOERR
dash: Syntax error: "fi" unexpected
The problem seems to only be present when a stray "fi" comes after a
'&' or ';' -- see:
$ dash -c ":; fi" && echo NOERR
NOERR
dash -c ":& fi" && echo NOERR
NOERR
The same goes for other loops/conditionals terminators:
$ dash -c ":; done" && echo NOERR
NOERR
$ dash -c ":; esac" && echo NOERR
NOERR
$ dash -c ":& elif" && echo NOERR
NOERR
HTH,
Stefano
prev parent reply other threads:[~2012-04-23 19:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 16:53 [BUG] dash doesn't report syntax error when it should on stray "fi" Stefano Lattarini
2012-04-23 17:03 ` Jonathan Nieder
2012-04-23 17:09 ` Stefano Lattarini
2012-04-23 19:27 ` Chet Ramey
2012-04-23 19:44 ` Jonathan Nieder
2012-04-23 19:48 ` Chet Ramey
2012-04-23 19:54 ` Jonathan Nieder
2012-04-24 22:47 ` Jilles Tjoelker
2012-04-23 19:53 ` Stefano Lattarini [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=4F95B331.7070707@gmail.com \
--to=stefano.lattarini@gmail.com \
--cc=chet.ramey@case.edu \
--cc=dash@vger.kernel.org \
--cc=jrnieder@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.