On 3/7/18 7:18 AM, Herbert Xu wrote:
On Wed, Mar 07, 2018 at 01:36:08AM +0100, Harald van Dijk wrote:

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 << '\'
\

I expect this to print nothing, and it does.

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.

This was wrong in the original patch, but I'm not seeing it in the updated patch that you replied to. When parsing a heredoc where part of delimiter is quoted, syntax==SQSYNTAX. Since the calls to pgetc_eatbnl() are conditional on syntax!=SQSYNTAX, there shouldn't be a problem. It would be a different story if the delimiter could be an unquoted backslash, but thankfully that is not possible.

Thanks,
--
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