dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald van Dijk <harald@gigawatt.nl>
To: Jilles Tjoelker <jilles@stack.nl>, Martijn Dekker <martijn@inlv.org>
Cc: dash@vger.kernel.org
Subject: Re: dash tested against ash testsuite: 17 failures
Date: Tue, 11 Oct 2016 00:30:04 +0200	[thread overview]
Message-ID: <d86f0a53-b1e7-827f-15bf-adc8c52986ea@gigawatt.nl> (raw)
In-Reply-To: <20161010215116.GA78485@stack.nl>

On 10-10-16 23:51, Jilles Tjoelker wrote:
> On Sat, Oct 08, 2016 at 09:42:12PM +0200, Martijn Dekker wrote:
>> Op 01-10-16 om 19:17 schreef Denys Vlasenko:
>>> ash-vars/var_unbackslash.tests
>
>> ITYM ash-vars/var_unbackslash1.tests
>
>>>     echo Forty two:$\
>>>     (\
>>>     (\
>>>     42\
>>>     )\
>>>     )
>>>     dash says: Syntax error: Missing '))'
>
>> Yes, but it's not clear to me that it shouldn't.
>
>> Hmm... maybe this is indeed a bug:
>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_01
>> "A <backslash> that is not quoted shall preserve the literal value of
>> the following character, with the exception of a <newline>. If a
>> <newline> follows the <backslash>, the shell shall interpret this as
>> line continuation. The <backslash> and <newline> shall be removed before
>> splitting the input into tokens. Since the escaped <newline> is removed
>> entirely from the input and is not replaced by any white space, it
>> cannot serve as a token separator."
>
>> So, unless I'm misreading this, it looks like backslashes need to be
>> parsed before *any* other kind of lexical analysis.
>
> Yes, for <backslash><newline> sequences that are not quoted.
>
> For example, <single-quote><backslash><newline><single-quote> contains
> two characters between the quotes, not zero.

Ah, right, I missed that exception. Note that it only applies to 
single-quoted strings. In double-quoted strings, backslash-newline 
should be removed just as when unquoted.

Cheers,
Harald van Dijk

      reply	other threads:[~2016-10-10 22:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-01 17:17 dash tested against ash testsuite: 17 failures Denys Vlasenko
2016-10-08 19:42 ` Martijn Dekker
2016-10-10 20:20   ` Harald van Dijk
2016-10-12 17:24     ` Harald van Dijk
2016-10-10 21:51   ` Jilles Tjoelker
2016-10-10 22:30     ` Harald van Dijk [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=d86f0a53-b1e7-827f-15bf-adc8c52986ea@gigawatt.nl \
    --to=harald@gigawatt.nl \
    --cc=dash@vger.kernel.org \
    --cc=jilles@stack.nl \
    --cc=martijn@inlv.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).