zsh-workers
 help / color / mirror / code / Atom feed
* strange behavior in zsh 5.3.1
@ 2017-07-13 15:06 ` Francesco Giordano
  2017-07-13 15:26   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Giordano @ 2017-07-13 15:06 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 8099 bytes --]

>
> echo {1..10}{1..
> 11}{1.. 10}{1.. 1/}{1.. 1.}{1.. 1-}{1.. 1,}{1.. 1+}{1.. 1*}{1.. 1)}{1..
> 1(}{1.. 1'}{1.. 1&}{1.. 1%}{1.. 1$}1}��L� 1$}0}��L� 1$}/}��L� 1$}.}��L�
> 1$}-}��L� 1$},}��L� 1$}+}��L� 1$}*}��L� 1$})}��L� 1$}(}��L� 1$}'}��L�
> 1$}&}��L� 1$}%}��L� 1$}$}��L� 1$}#}��L� 1$}"}��L� 1$}!}��L� 1$} }��L�
> 1$}^_}��L� 1$}^^}��L� 1$}^]}��L� 1$}^\}��L� 1$}^[}��L� 1$}^Z}��L�
> 1$}^Y}��L� 1$}^X}��L� 1$}^W}��L� 1$}^V}��L� 1$}^U}��L� 1$}^T}��L�
> 1$}^S}��L� 1$}^R}��L� 1$}^Q}��L� 1$}^P}��L� 1$}^O}��L� 1$}^N}��L�
> 1$}^M}��L� 1$}^L}��L� 1$}^K}��L� 1$}
> }��L� 1$}       }��L� 1$}^H}��L� 1$}^G}��L� 1$}^F}��L� 1$}^E}��L�
> 1$}^D}��L� 1$}^C}��L� 1$}^B}��L� 1$}^A}��L� 1$}^@}��L� 1#}{1.. 1"}{1..
> 1!}{1.. 1 }{1.. 1^_}{1.. 1^^}{1.. 1^]}{1.. 1^\}{1.. 1^[}{1.. 1^Z}{1..
> 1^Y}{1.. 1^X}{1.. 1^W}{1.. 1^V}{1.. 1^U}{1.. 1^T}{1.. 1^S}{1.. 1^R}{1..
> 1^Q}{1.. 1^P}{1.. 1^O}{1.. 1^N}{1.. 1^M}{1.. 1^L}{1.. 1^K}{1.. 1
> }{1.. 1 }{1.. 1^H}{1.. 1^G}{1.. 1^F}{1.. 1^E}{1.. 1^D}{1.. 1^C}{1..
> 1^B}{1.. 1^A}{1.. 1^@}{1.. 21}{1.. 20}{1.. 2/}{1.. 2.}{1.. 2-}{1.. 2,}{1..
> 2+}{1.. 2*}{1.. 2)}{1.. 2(}{1.. 2'}{1.. 2&}{1.. 2%}{1.. 2$}{1.. 2#}{1..
> 2"}{1.. 2!}{1.. 2 }{1.. 2^_}{1.. 2^^}{1.. 2^]}{1.. 2^\}{1.. 2^[}{1..
> 2^Z}{1.. 2^Y}{1.. 2^X}{1.. 2^W}{1.. 2^V}{1.. 2^U}{1.. 2^T}{1.. 2^S}{1..
> 2^R}{1.. 2^Q}{1.. 2^P}{1.. 2^O}{1.. 2^N}{1.. 2^M}{1.. 2^L}{1.. 2^K}{1.. 2
> }{1.. 2 }{1.. 2^H}{1.. 2^G}{1.. 2^F}{1.. 2^E}{1.. 2^D}{1.. 2^C}{1..
> 2^B}{1.. 2^A}{1.. 2^@}{1.. 31}{1.. 30}{1.. 3/}{1.. 3.}{1.. 3-}{1.. 3,}{1..
> 3+}{1.. 3*}{1.. 3)}{1.. 3(}{1.. 3'}{1.. 3&}{1.. 3%}{1.. 3$}1}'�L� 3$}0}�L�
> 3$}/}�L� 3$}.}�L� 3$}-}�L� 3$},}�L� 3$}+}�L� 3$}*}�L� 3$})}�L� 3$}(}�L�
> 3$}'}�L� 3$}&}�L� 3$}%}�L� 3$}$}�L� 3$}#}�L� 3$}"}�L� 3$}!}�L� 3$} }�L�
> 3$}^_}�L� 3$}^^}�L� 3$}^]}�L� 3$}^\}�L� 3$}^[}�L� 3$}^Z}�L� 3$}^Y}�L�
> 3$}^X}�L� 3$}^W}�L� 3$}^V}�L� 3$}^U}�L� 3$}^T}�L� 3$}^S}�L� 3$}^R}�L�
> 3$}^Q}�L� 3$}^P}�L� 3$}^O}�L� 3$}^N}�L� 3$}^M}�L� 3$}^L}�L� 3$}^K}�L� 3$}
> }�L� 3$}        }�L� 3$}^H}�L� 3$}^G}�L� 3$}^F}�L� 3$}^E}�L� 3$}^D}�L�
> 3$}^C}�L� 3$}^B}�L� 3$}^A}�L� 3$}^@}�L� 3#}{1.. 3"}{1.. 3!}{1.. 3 }{1..
> 3^_}{1.. 3^^}{1.. 3^]}{1.. 3^\}{1.. 3^[}{1.. 3^Z}{1.. 3^Y}{1.. 3^X}{1..
> 3^W}{1.. 3^V}{1.. 3^U}{1.. 3^T}{1.. 3^S}{1.. 3^R}{1.. 3^Q}{1.. 3^P}{1..
> 3^O}{1.. 3^N}{1.. 3^M}{1.. 3^L}{1.. 3^K}{1.. 3
> }{1.. 3 }{1.. 3^H}{1.. 3^G}{1.. 3^F}{1.. 3^E}{1.. 3^D}{1.. 3^C}{1..
> 3^B}{1.. 3^A}{1.. 3^@}{1.. 41}{1.. 40}{1.. 4/}{1.. 4.}{1.. 4-}{1.. 4,}{1..
> 4+}{1.. 4*}{1.. 4)}{1.. 4(}{1.. 4'}{1.. 4&}{1.. 4%}{1.. 4$}{1.. 4#}{1..
> 4"}{1.. 4!}{1.. 4 }{1.. 4^_}{1.. 4^^}{1.. 4^]}{1.. 4^\}{1.. 4^[}{1..
> 4^Z}{1.. 4^Y}{1.. 4^X}{1.. 4^W}{1.. 4^V}{1.. 4^U}{1.. 4^T}{1.. 4^S}{1..
> 4^R}{1.. 4^Q}{1.. 4^P}{1.. 4^O}{1.. 4^N}{1.. 4^M}{1.. 4^L}{1.. 4^K}{1.. 4
> }{1.. 4 }{1.. 4^H}{1.. 4^G}{1.. 4^F}{1.. 4^E}{1.. 4^D}{1.. 4^C}{1..
> 4^B}{1.. 4^A}{1.. 4^@}{1.. 51}{1.. 50}{1.. 5/}{1.. 5.}1}��L� 5.}0}��L�
> 5.}/}��L� 5.}.}��L� 5.}-}��L� 5.},}��L� 5.}+}��L� 5.}*}��L� 5.})}��L�
> 5.}(}��L� 5.}'}��L� 5.}&}��L� 5.}%}��L� 5.}$}��L� 5.}#}��L� 5.}"}��L�
> 5.}!}��L� 5.} }��L� 5.}^_}��L� 5.}^^}��L� 5.}^]}��L� 5.}^\}��L� 5.}^[}��L�
> 5.}^Z}��L� 5.}^Y}��L� 5.}^X}��L� 5.}^W}��L� 5.}^V}��L� 5.}^U}��L�
> 5.}^T}��L� 5.}^S}��L� 5.}^R}��L� 5.}^Q}��L� 5.}^P}��L� 5.}^O}��L�
> 5.}^N}��L� 5.}^M}��L� 5.}^L}��L� 5.}^K}��L� 5.}
> }��L� 5.}       }��L� 5.}^H}��L� 5.}^G}��L� 5.}^F}��L� 5.}^E}��L�
> 5.}^D}��L� 5.}^C}��L� 5.}^B}��L� 5.}^A}��L� 5.}^@}��L� 5-}{1.. 5,}{1..
> 5+}{1.. 5*}{1.. 5)}{1.. 5(}{1.. 5'}{1.. 5&}{1.. 5%}{1.. 5$}{1.. 5#}{1..
> 5"}{1.. 5!}{1.. 5 }{1.. 5^_}{1.. 5^^}{1.. 5^]}{1.. 5^\}{1.. 5^[}{1..
> 5^Z}{1.. 5^Y}{1.. 5^X}{1.. 5^W}{1.. 5^V}{1.. 5^U}{1.. 5^T}{1.. 5^S}{1..
> 5^R}{1.. 5^Q}{1.. 5^P}{1.. 5^O}{1.. 5^N}{1.. 5^M}{1.. 5^L}{1.. 5^K}{1.. 5
> }{1.. 5 }{1.. 5^H}{1.. 5^G}{1.. 5^F}{1.. 5^E}{1.. 5^D}{1.. 5^C}{1..
> 5^B}{1.. 5^A}{1.. 5^@}{1.. 61}{1.. 60}{1.. 6/}{1.. 6.}{1.. 6-}{1.. 6,}{1..
> 6+}{1.. 6*}{1.. 6)}{1.. 6(}{1.. 6'}{1.. 6&}{1.. 6%}{1.. 6$}{1.. 6#}{1..
> 6"}{1.. 6!}{1.. 6 }{1.. 6^_}{1.. 6^^}{1.. 6^]}{1.. 6^\}{1.. 6^[}{1..
> 6^Z}{1.. 6^Y}{1.. 6^X}{1.. 6^W}{1.. 6^V}{1.. 6^U}{1.. 6^T}{1.. 6^S}{1..
> 6^R}{1.. 6^Q}{1.. 6^P}{1.. 6^O}{1.. 6^N}{1.. 6^M}{1.. 6^L}{1.. 6^K}{1.. 6
> }{1.. 6 }{1.. 6^H}{1.. 6^G}{1.. 6^F}{1.. 6^E}{1.. 6^D}{1.. 6^C}{1..
> 6^B}{1.. 6^A}{1.. 6^@}{1.. 71}{1.. 70}{1.. 7/}{1.. 7.}1}�L� 7.}0}�L�
> 7.}/}�L� 7.}.}�L� 7.}-}�L� 7.},}�L� 7.}+}�L� 7.}*}�L� 7.})}�L� 7.}(}�L�
> 7.}'}�L� 7.}&}�L� 7.}%}�L� 7.}$}�L� 7.}#}�L� 7.}"}�L� 7.}!}�L� 7.} }�L�
> 7.}^_}�L� 7.}^^}�L� 7.}^]}�L� 7.}^\}�L� 7.}^[}�L� 7.}^Z}�L� 7.}^Y}�L�
> 7.}^X}�L� 7.}^W}�L� 7.}^V}�L� 7.}^U}�L� 7.}^T}�L� 7.}^S}�L� 7.}^R}�L�
> 7.}^Q}�L� 7.}^P}�L� 7.}^O}�L� 7.}^N}�L� 7.}^M}�L� 7.}^L}�L� 7.}^K}�L� 7.}
> }�L� 7.}        }�L� 7.}^H}�L� 7.}^G}�L� 7.}^F}�L� 7.}^E}�L� 7.}^D}�L�
> 7.}^C}�L� 7.}^B}�L� 7.}^A}�L� 7.}^@}�L� 7-}{1.. 7,}{1.. 7+}{1.. 7*}{1..
> 7)}{1.. 7(}{1.. 7'}{1.. 7&}{1.. 7%}{1.. 7$}{1.. 7#}{1.. 7"}{1.. 7!}{1.. 7
> }{1.. 7^_}{1.. 7^^}{1.. 7^]}{1.. 7^\}{1.. 7^[}{1.. 7^Z}{1.. 7^Y}{1..
> 7^X}{1.. 7^W}{1.. 7^V}{1.. 7^U}{1.. 7^T}{1.. 7^S}{1.. 7^R}{1.. 7^Q}{1..
> 7^P}{1.. 7^O}{1.. 7^N}{1.. 7^M}{1.. 7^L}{1.. 7^K}{1.. 7
> }{1.. 7 }{1.. 7^H}{1.. 7^G}{1.. 7^F}{1.. 7^E}{1.. 7^D}{1.. 7^C}{1..
> 7^B}{1.. 7^A}{1.. 7^@}{1.. 81}{1.. 80}{1.. 8/}{1.. 8.}{1.. 8-}{1.. 8,}{1..
> 8+}{1.. 8*}{1.. 8)}{1.. 8(}{1.. 8'}{1.. 8&}{1.. 8%}{1.. 8$}{1.. 8#}{1..
> 8"}{1.. 8!}{1.. 8 }{1.. 8^_}{1.. 8^^}{1.. 8^]}{1.. 8^\}{1.. 8^[}{1..
> 8^Z}{1.. 8^Y}{1.. 8^X}{1.. 8^W}{1.. 8^V}{1.. 8^U}{1.. 8^T}{1.. 8^S}{1..
> 8^R}{1.. 8^Q}{1.. 8^P}{1.. 8^O}{1.. 8^N}{1.. 8^M}{1.. 8^L}{1.. 8^K}{1.. 8
> }{1.. 8 }{1.. 8^H}{1.. 8^G}{1.. 8^F}{1.. 8^E}{1.. 8^D}{1.. 8^C}{1..
> 8^B}{1.. 8^A}{1.. 8^@}{1.. 91}{1.. 90}{1.. 9/}{1.. 9.}1}.�L� 9.}0}.�L�
> 9.}/}.�L� 9.}.}.�L� 9.}-}.�L� 9.},}.�L� 9.}+}.�L� 9.}*}.�L� 9.})}.�L�
> 9.}(}.�L� 9.}'}.�L� 9.}&}.�L� 9.}%}.�L� 9.}$}.�L� 9.}#}.�L� 9.}"}.�L�
> 9.}!}.�L� 9.} }.�L� 9.}^_}.�L� 9.}^^}.�L� 9.}^]}.�L� 9.}^\}.�L� 9.}^[}.�L�
> 9.}^Z}.�L� 9.}^Y}.�L� 9.}^X}.�L� 9.}^W}.�L� 9.}^V}.�L� 9.}^U}.�L�
> 9.}^T}.�L� 9.}^S}.�L� 9.}^R}.�L� 9.}^Q}.�L� 9.}^P}.�L� 9.}^O}.�L�
> 9.}^N}.�L� 9.}^M}.�L� 9.}^L}.�L� 9.}^K}.�L� 9.}
> }.�L� 9.}       }.�L� 9.}^H}.�L� 9.}^G}.�L� 9.}^F}.�L� 9.}^E}.�L�
> 9.}^D}.�L� 9.}^C}.�L� 9.}^B}.�L� 9.}^A}.�L� 9.}^@}.�L� 9-}{1.. 9,}{1..
> 9+}{1.. 9*}{1.. 9)}{1.. 9(}{1.. 9'}{1.. 9&}{1.. 9%}{1.. 9$}{1.. 9#}{1..
> 9"}{1.. 9!}{1.. 9 }{1.. 9^_}{1.. 9^^}{1.. 9^]}{1.. 9^\}{1.. 9^[}{1..
> 9^Z}{1.. 9^Y}{1.. 9^X}{1.. 9^W}{1.. 9^V}{1.. 9^U}{1.. 9^T}{1.. 9^S}{1..
> 9^R}{1.. 9^Q}{1.. 9^P}{1.. 9^O}{1.. 9^N}{1.. 9^M}{1.. 9^L}{1.. 9^K}{1.. 9
> }{1.. 9 }{1.. 9^H}{1.. 9^G}{1.. 9^F}{1.. 9^E}{1.. 9^D}{1.. 9^C}{1..
> 9^B}{1.. 9^A}{1.. 9^@}{1.. 10{1..
>

No idea why it has this behavior, it yould print numbers1 to 10 followe by
{1..'

> echo {1..10}{1..
> 1{1.. 2{1.. 3{1.. 4{1.. 5{1.. 6{1.. 7{1.. 8{1.. 9{1.. 10{1..
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: strange behavior in zsh 5.3.1
  2017-07-13 15:06 ` strange behavior in zsh 5.3.1 Francesco Giordano
@ 2017-07-13 15:26   ` Peter Stephenson
  2017-07-13 16:08     ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2017-07-13 15:26 UTC (permalink / raw)
  To: Francesco Giordano, zsh-workers

On Thu, 13 Jul 2017 17:06:34 +0200
Francesco Giordano <nhoyadx@gmail.com> wrote:
> > echo {1..10}{1..

Definitely a bug in brace handling, which the shell even picks up in
debug mode...

 glob.c:2248: BUG: unmatched brace in xpandbraces()

I'm guessing the existing pair of braces make it cavalier about
interpreting the last one.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: strange behavior in zsh 5.3.1
  2017-07-13 15:26   ` Peter Stephenson
@ 2017-07-13 16:08     ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2017-07-13 16:08 UTC (permalink / raw)
  To: Peter Stephenson, zsh-workers

On Thu, 13 Jul 2017 16:26:21 +0100
Peter Stephenson <p.stephenson@samsung.com> wrote:
> On Thu, 13 Jul 2017 17:06:34 +0200
> Francesco Giordano <nhoyadx@gmail.com> wrote:
> > > echo {1..10}{1..
> 
> Definitely a bug in brace handling, which the shell even picks up in
> debug mode...
> 
>  glob.c:2248: BUG: unmatched brace in xpandbraces()
> 
> I'm guessing the existing pair of braces make it cavalier about
> interpreting the last one.

It's slightly more complicated than that... the first expansion takes
place, then the second should find there isn't a pair of braces left.
However, we're not checking for the null at the end of the string
properly, and if we skip that we find a brace a bit later on in memory.

It's not supposed to do that.

pws

diff --git a/Src/glob.c b/Src/glob.c
index af5d082..c9ec97e 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2194,6 +2194,8 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
 	pnext[0] != '.' || pnext[1] != '.')
 	return 0;
     pnext += 2;
+    if (!*pnext)
+	return 0;
     if (itok(*pnext)) {
 	if (*pnext == Inbrace)
 	    return 0;
diff --git a/Test/D09brace.ztst b/Test/D09brace.ztst
index 3e667a8..580ed43 100644
--- a/Test/D09brace.ztst
+++ b/Test/D09brace.ztst
@@ -112,3 +112,7 @@
   print -r left{[..]}right
 0:{char..char} ranges with tokenized characters
 >left[right left\right left]right
+
+  print -r {1..10}{..
+0:Unmatched braces after matched braces are left alone.
+>1{.. 2{.. 3{.. 4{.. 5{.. 6{.. 7{.. 8{.. 9{.. 10{..


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-13 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170713150750epcas3p2abec52da71e68ecb3e6a48f349831ab4@epcas3p2.samsung.com>
2017-07-13 15:06 ` strange behavior in zsh 5.3.1 Francesco Giordano
2017-07-13 15:26   ` Peter Stephenson
2017-07-13 16:08     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).