From 7d9ead9a469792959c90ec1df091e2e10b9fc11d Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 4 Jan 2008 14:45:39 +0000 Subject: 24356: regex =~ test wasnt handled by gettext() --- ChangeLog | 6 ++++++ Src/text.c | 3 ++- Test/C02cond.ztst | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 907f9fe79..902ff8275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-04 Peter Stephenson + + * 25356: Src/text.c, Test/C02cond.ztst: "=~" wasn't handled by + the code that retrieves a printed representation. + Non-interactively this caused a crash. + 2008-01-04 Clint Adams * 24349: Functions/Misc/run-help: add comment about HELPDIR to diff --git a/Src/text.c b/Src/text.c index 595ebc346..593c25776 100644 --- a/Src/text.c +++ b/Src/text.c @@ -732,7 +732,8 @@ gettext2(Estate state) taddstr(" "); taddstr(ecgetstr(state, EC_NODUP, NULL)); if (ctype == COND_STREQ || - ctype == COND_STRNEQ) + ctype == COND_STRNEQ || + ctype == COND_REGEX) state->pc++; } else { /* Unary test: `-f foo' etc. */ diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst index 2d0991785..0057e3a10 100644 --- a/Test/C02cond.ztst +++ b/Test/C02cond.ztst @@ -211,6 +211,18 @@ F:Failures in these cases do not indicate a problem in the shell. 0:-nt shouldn't abort on non-existent files >status = 1 +# core dumps on failure + if zmodload -i zsh/regex 2>/dev/null; then + echo >regex_test.sh 'if [[ $# = 1 ]]; then + if [[ $1 =~ /?[^/]+:[0-9]+:$ ]]; then + : + fi + fi + exit 0' + $ZTST_testdir/../Src/zsh -f ./regex_test.sh + fi +0:regex tests shouldn't crash + %clean # This works around a bug in rm -f in some versions of Cygwin chmod 644 unmodish -- cgit 1.4.1