On Wed, Mar 07, 2018 at 01:36:08AM +0100, Harald van Dijk wrote:
> Oh, indeed, thanks.
> There's another problem: when there is no following command (as in the above
> example), things break. A shorter reproducer that has failed for years is
>   $ dash -c 'alias x=
>   x'
>   dash: 2: Syntax error: end of file unexpected
> This breaks because the part where list() checks for NL/EOF, checkkwd==0, so
> aliases aren't expanded. Immediately after that, checkkwd is set and the
> next call to readtoken() would return TEOF, but by that point, dash has
> already committed to parsing a command.
> Since this is actually a long-standing problem, not something introduced by
> the patch, I think it's okay to ignore for now. Do you agree?


> >I'm fine with the concept.  However, your patch also breaks here-
> >document parsing when the delimiter is a single backslash.
> >
> >     cat << "\"
> >     \
> >
> >If you can fix these two problems it should be good to go.
> As Martijn Dekker wrote, this should work when the backslash is escaped or
> single-quoted, and in my testing does. But what you have is a nice start of
> another corner case:

I made mistake with the quotes but it's a real problem:

cat << '\'

The issue is that your pgetc_eatbnl executes before we check for the
end of here-documents.  It has to be moved after it.  IOW I think
you should leave the pgetc's before CHECKEND as is, which also means
keeping some of the CBACK processing as is.

Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to