zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: '<<-' here-documents oddity with line continuation
Date: Fri, 9 Feb 2018 15:27:15 +0000	[thread overview]
Message-ID: <20180209152715.GA14126@chaz.gmail.com> (raw)
In-Reply-To: <20180209092427.6eaeafc7@pwslap01u.europe.root.pri>

2018-02-09 09:24:27 +0000, Peter Stephenson:
> On Fri, 9 Feb 2018 08:01:41 +0100
> Martijn Dekker <martijn@inlv.org> wrote:
> > Meanwhile I would welcome opinions whether either or both of these
> > issues should be fixed unconditionally, or in emulation only -- and, if
> > the latter, what shell option to attach it to. POSIX_STRINGS maybe?
> 
> Thanks for the patch.
> 
> I think the question is whether existing users are more likely to be
> relying on this behaviour, or simply finding it confusing.  I'd actaully
> hazard the latter --- line continuation is more useful if it's doing
> something a bit more predictable --- so I'd be inclined just to include
> the patch.  But I expect there are arguments the other way.
[...]

I agree it makes sense of treating it as a minor compatibility
bug fix.

Note that there's also:

cat << EOF
foo
E\
OF

which zsh does differently from other shells (and that nobody
would ever do).

About order and token recognition to reply on Martijn's initial
report, note  that in:

echo "$(echo 'foo\
bar')"

Or

echo "$(cat << 'EOF'
foo\
bar
EOF
)"

The \<LF> is meant *not* to be treated as a line continuation.
bash fixed a bug recently for that (the latter used to output
"foobar", it's only fixed on the development branch).

So there has to be some level of tokenisation and parsing done
before line continuation is handled. It's not like in C where
it's done as one of the first steps of the pre-processing stage.


  reply	other threads:[~2018-02-09 15:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03 17:39 Martijn Dekker
2018-02-09  7:01 ` Martijn Dekker
2018-02-09  7:58   ` Martijn Dekker
2018-02-09  9:24   ` Peter Stephenson
2018-02-09 15:27     ` Stephane Chazelas [this message]
2018-02-09 16:07       ` Martijn Dekker
2018-02-09 18:19         ` Martijn Dekker
2018-02-12 10:07           ` Peter Stephenson

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=20180209152715.GA14126@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).