diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | Misc/globtests | 15 | ||||
-rw-r--r-- | Src/pattern.c | 2 | ||||
-rw-r--r-- | Test/D02glob.ztst | 15 |
4 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index a39c9accc..2fb3e2ad2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-30 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 24708: Misc/globtests, Src/pattern.c, Test/D02glob.ztst: + (#c) extended globbing flag didn't backtrack properly on + failure of the remaining pattern after the repeated pattern. + 2008-03-28 Peter Stephenson <p.w.stephenson@ntlworld.com> * 24777: Src/Zle/complist.c: bug clearing a list when diff --git a/Misc/globtests b/Misc/globtests index 65fdbdca2..482c962c3 100755 --- a/Misc/globtests +++ b/Misc/globtests @@ -192,5 +192,20 @@ t ZX Z(|)(#c1)X t froofroo (fro(#c2))(#c2) f froofroofroo (fro(#c2))(#c2) f froofro (fro(#c2))(#c2) +t ax ?(#c1,2)x +t ax ?(#c1,)x +t ax ?(#c0,1)x +f ax ?(#c0,0)x +f ax ?(#c2,)x +t aa a(#c1,2)a +t aa a(#c1,)a +t aa a(#c0,1)a +f aa a(#c0,0)a +f aa a(#c2,)a +t test.zsh *.?(#c1)sh +t test.bash *.?(#c2)sh +t test.bash *.?(#c1,2)sh +t test.bash *.?(#c1,)sh +t test.zsh *.?(#c1,)sh EOT print "$failed tests failed." diff --git a/Src/pattern.c b/Src/pattern.c index c9a93cd0e..244f40054 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -2969,9 +2969,11 @@ patmatch(Upat prog) scan[P_CT_PTR].p = (unsigned char *)patinput; if (max < 0 || cur < max) { + char *patinput_thistime = patinput; scan[P_CT_CURRENT].l = cur + 1; if (patmatch(scan + P_CT_OPERAND)) return 1; + patinput = patinput_thistime; } if (cur < min) return 0; diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst index 59fc92d1c..d5f654a71 100644 --- a/Test/D02glob.ztst +++ b/Test/D02glob.ztst @@ -187,6 +187,21 @@ >0: [[ froofroo = (fro(#c2))(#c2) ]] >1: [[ froofroofroo = (fro(#c2))(#c2) ]] >1: [[ froofro = (fro(#c2))(#c2) ]] +>0: [[ ax = ?(#c1,2)x ]] +>0: [[ ax = ?(#c1,)x ]] +>0: [[ ax = ?(#c0,1)x ]] +>1: [[ ax = ?(#c0,0)x ]] +>1: [[ ax = ?(#c2,)x ]] +>0: [[ aa = a(#c1,2)a ]] +>0: [[ aa = a(#c1,)a ]] +>0: [[ aa = a(#c0,1)a ]] +>1: [[ aa = a(#c0,0)a ]] +>1: [[ aa = a(#c2,)a ]] +>0: [[ test.zsh = *.?(#c1)sh ]] +>0: [[ test.bash = *.?(#c2)sh ]] +>0: [[ test.bash = *.?(#c1,2)sh ]] +>0: [[ test.bash = *.?(#c1,)sh ]] +>0: [[ test.zsh = *.?(#c1,)sh ]] >0 tests failed. globtest globtests.ksh |