Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] zipping two empty arrays should not result in empty string



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



Messages sorted by: Reverse Date, Date, Thread, Author