Re: [BUG] dash doesn't report syntax error when it should on stray "fi"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux