[tex-k] Brace expansion question
doug at mathemaesthetics.com
Mon Oct 23 00:03:12 CEST 2017
The kpathsea library performs various shell-style expansions. One of them is brace expansion, typically accomplished first before other types of expansion (like tilde and environment variables). This is accomplished recursively with several routines in the library's "expand.c" source file, in particular a routine called … brace_expand().
To understand how this works, I was trying some test cases and comparing them against the results I get from the shell on my MacOS computer, and after several successes I found a discrepancy.
In the shell that my MacOS terminal app runs (bash, I think), if I issue the command
the result is
abdefhi abdeghi acdefhi acdeghi
Whereas, the list of expanded strings returned by brace_expand() for the same input string is
It's the same set of expansion strings, but in a different order. In one case expansion appears distributed left-to-right, and in the other, right-to-left. This web page for bash says expansion should proceed left to right:
Does this represent an incompatibility worthy of understanding/fixing? Does it matter that kpathsea is doing things differently? Presumably, kpathsea can't change, because this could affect the order of path resolutions of various kinds.
Or am I missing something?
More information about the tex-k