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

Re: [bug] shwordsplit not working on $@ when $# > 1

On Aug 9,  9:40am, Peter Stephenson wrote:
} On Mon, 08 Aug 2016 18:21:24 -0700
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > I *think* we can untangle this as follows, but then again I thought
} > I had untangled in in workers/29313, too.  This relies on the idea
} > that if we already have an array when nojoin, then we're not going
} > to split it again, which seems dubious somehow if there is explicit
} > use of the (s:-:) flag.
} That was my first worry, looking at the change, but simple examples of
} this still work, so I can't see an obvious case where this isn't better
} than before.

It's better than before in that the two specific shwordsplit issues are
addressed.  However, I'm not sure that either of these cases is correct:

torch% x=(a:b "c d" ef)
torch% print -l ${(s.:.)x}
b c d ef
torch% print -l ${(@s.:.)x}
c d

The first one agrees with zsh-3.0.8, so I guess it's no more wrong than
it ever was.  The second one used to work exactly like the first one,
and is the one that worries me the most.  I can fix that by testing
(nojoin % 2) instead of (!nojoin) but that seems like piling a hack on
top of a hack.

Then there's this weird edge case, where an empty $IFS acts like you
have specified the (@) flag when shwordsplit is set:

torch% IFS=
torch% setopt shwordsplit
torch% print -l ${(s.:.)x}
c d

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