<div dir="ltr">Interesting!  I'd say it *could* matter, but probably only in odd circumstances.<div><br></div><div>It also introduces yet another shell attack; something like the following locks</div><div>up bash pretty hard, with no response to control-C or control-Z or other</div><div>control characters:</div><div><br></div><div>   <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">echo {a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}{a,b,c}</span></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px"><br></span></div><div><br></div>







</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 22, 2017 at 3:03 PM, Douglas McKenna <span dir="ltr"><<a href="mailto:doug@mathemaesthetics.com" target="_blank">doug@mathemaesthetics.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">All -<br>
<br>
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().<br>
<br>
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.<br>
<br>
In the shell that my MacOS terminal app runs (bash, I think), if I issue the command<br>
  echo a{b,c}de{f,g}hi<br>
the result is<br>
  abdefhi abdeghi acdefhi acdeghi<br>
<br>
Whereas, the list of expanded strings returned by brace_expand() for the same input string is<br>
 [0]: "abdefhi"<br>
 [1]: "acdefhi"<br>
 [2]: "abdeghi"<br>
 [3]: "acdeghi"<br>
<br>
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:<br>
<br>
<<a href="https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html" rel="noreferrer" target="_blank">https://www.gnu.org/software/<wbr>bash/manual/html_node/Brace-<wbr>Expansion.html</a>><br>
<br>
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.<br>
<br>
Or am I missing something?<br>
<br>
TIA,<br>
<br>
Doug McKenna<br>
Mathemaesthetics, Inc.<br>
<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>--  <a href="http://cube20.org/" target="_blank">http://cube20.org/</a>  --  <a href="http://golly.sf.net/" target="_blank">http://golly.sf.net/</a>  --</div></div></div></div></div>
</div>