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

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



On Aug 11, 11:05am, Peter Stephenson wrote:
} Subject: Re: [bug] shwordsplit not working on $@ when $# > 1
}
} On Wed, 10 Aug 2016 10:28:36 -0700
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > torch% print -l ${(@s.:.)x}
} > a:b
} > c d
} > ef
} 
} I think it should only cause a visible effect in double quotes as that's
} its real point --- though I wouldn't be surprised if there were already
} exceptions.  It's hard to see how it could be interpreted to mean ignore
} the (s.:.), even if there are double quotes.

I think this is fixed by workers/39019, but I did not add any tests that
use double-quoting.  Should there be some?
 
} To be clear: it is not a conflict that SHWORDSPLIT behaviour and
} (s...) behaviour differ from one another, e.g. with respect to forced
} [joining], only if expressions involving the same modifications to
} ${(@)x} and $@ differ when the contents of the arrays and the contexts
} are the same.

Agreed, but I'm still not sure the test suite covers that ...

} > 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}
} > a:b
} > c d
} > ef
} 
} Hmm... I would guess that what's happened is without an IFS forced
} joining with a default separator fails, and because it didn't get joined
} we refuse to split it

To clarify, the above edge case was introduced by the (never-committed)
patch in 39009, and should have been avoided by the patch in 39019.

} I would think the most logical answer here is it should have been joined
} with no separator and then split, but I doubt this has ever been thought
} about before.

This is still broken after 39019 (sigh) because IFS= plus shwordsplit
implies that joining should not happen in other circumstances, and we
only split after joining, so that unintentionally bleeds into this.  I
thought I'd got it worked out and that the tests I added covered it,
but trying this specific example again still fails.  Back to prodding
at it, I guess.



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