zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: [PATCH] zipping two empty arrays should not result in empty string
Date: Sun, 1 Jan 2017 12:27:09 -0800	[thread overview]
Message-ID: <170101122709.ZM20782@torch.brasslantern.com> (raw)
In-Reply-To: <170101122451.ZM20755@torch.brasslantern.com>

On Jan 1, 12:24pm, Bart Schaefer wrote:
}
} The zip operation is stepping on the internal state that records the
} semantics of (@)-inside-double-quotes, so it always behaves as if
} you did "${a[*]:^b}" instead.

Don't change isarr unless creating one from a scalar.

diff --git a/Src/subst.c b/Src/subst.c
index 64b4400..737a0a9 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3066,7 +3066,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 		if (sval)
 		    zip = hmkarray(sval);
 	    }
-	    if (!isarr) aval = mkarray(val);
+	    if (!isarr) {
+		aval = mkarray(val);
+		isarr = 1;
+	    }
 	    if (zip) {
 		char **out;
 		int alen, ziplen, outlen, i = 0;
@@ -3089,7 +3092,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 		    out[i*2] = NULL;
 		    aval = out;
 		    copied = 1;
-		    isarr = 1;
 		}
 	    } else {
 		if (unset(UNSET)) {


      reply	other threads:[~2017-01-01 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01  3:49 Should zipping two empty arrays result in empty string? Eric Cook
2017-01-01  5:18 ` Kannan Varadhan
2017-01-01  8:50   ` Eric Cook
2017-01-01  9:17     ` Eric Cook
2017-01-01 20:24 ` Bart Schaefer
2017-01-01 20:27   ` Bart Schaefer [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=170101122709.ZM20782@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).