zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [bug] sh: tilde expansion after field splitting
Date: Wed, 4 Oct 2017 22:24:50 -0700	[thread overview]
Message-ID: <171004222450.ZM7062@torch.brasslantern.com> (raw)
In-Reply-To: <06fb6a91-6766-bbd7-9543-cbafe704ee59@inlv.org>

On Oct 5, 12:20am, Martijn Dekker wrote:
}
} POSIX says tilde expansion should be done before parameter expansion [...]
} zsh did this correctly up to version 5.0.8; as of 5.1, it appears to do
} tilde expansion *after* field splitting, and only from the second field on.

This is a change in the effects of SH_FILE_EXPANSION when an array is
synthesized by word splitting.

Traced this to here:

diff --git a/Src/subst.c b/Src/subst.c
index 81d34d2..021d234 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3834,8 +3834,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
                y = dupstring(nulstring);
            insertlinknode(l, n, (void *) y), incnode(n);
        }
-       if (eval)
-           n = on;
+       /* This used to omit restoring of *str and instead test
+        *   if (eval)
+        *       n = on;
+        * but that causes strange behavior of history modifiers when
+        * applied across all values of an array.  What is magic about
+        * eval here that *str seemed not to need restoring?
+        */
+       *str = getdata(n = on);
     } else {
        /*
         * Scalar value.  Handle last minute transformations

Apparently the answer to the question in that comment has something to
do with shfileexpansion.  Anyone have additional clues?


  reply	other threads:[~2017-10-05  5:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 22:20 Martijn Dekker
2017-10-05  5:24 ` Bart Schaefer [this message]
2017-10-08  7:53 ` Bart Schaefer
2017-10-08 19:20   ` Peter Stephenson
2017-10-08 20:45     ` Bart Schaefer
2017-10-09  8:44       ` Peter Stephenson
2017-10-13  9:43   ` Martijn Dekker
2017-10-13 12:55     ` Peter Stephenson
2017-10-13 15:36       ` Bart Schaefer

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=171004222450.ZM7062@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).