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

Re: [BUG] SHWORDSPLIT: unset IFS: $* and $@ don't split



On Feb 19,  6:45am, Martijn Dekker wrote:
} Subject: [BUG] SHWORDSPLIT: unset IFS: $* and $@ don't split
}
} In SHWORDSPLIT mode, if IFS is unset (meaning we expect default field
} splitting),  unquoted $* and $@ (including in substitutions like
} ${1+$@}) or ${var-$*} do not perform the expected default field
} splitting after generating fields from the positional parameters.

This one turns out to be more tractible.

diff --git a/Src/subst.c b/Src/subst.c
index 670f3f0..1c2397c 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3476,7 +3476,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 		val = sepjoin(aval, sep, 1);
 		isarr = 0;
 		ms_flags = 0;
-	    } else if (force_split && (spsep || nojoin == 2)) {
+	    } else if (force_split &&
+		       (spsep || nojoin == 2 || (!ifs && isarr < 0))) {
 		/* Hack to simulate splitting individual elements:
 		 * forced joining as previously determined, or
 		 * join on what we later use to forcibly split



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