From 7ad1a2b2cc57b5f4bcb59186a9a8abcbed9f4f76 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 11 Nov 2022 18:22:00 +0000 Subject: Fix regex substring capture variables for null matches (again). Bug 2933 Broken-by: 59d66fdc13f0 --- test/aux-var-src/0383.F | 4 ++-- test/log/0383 | 4 ++-- test/mail/0383.CALLER | 8 ++++---- test/scripts/0000-Basic/0002 | 2 ++ test/stdout/0002 | 2 ++ 5 files changed, 12 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/aux-var-src/0383.F b/test/aux-var-src/0383.F index be69ca2c2..59dd0666a 100644 --- a/test/aux-var-src/0383.F +++ b/test/aux-var-src/0383.F @@ -3,7 +3,7 @@ if error_message then finish endif if foranyaddress $h_to: ($thisaddress matches "^(alice)") then - pipe "DIR/aux-fixed/showenv \"${if match_address {$thisaddress}{alice@test.ex}{$value}}\" $1" + pipe "DIR/aux-fixed/showenv \"${if match_address {$thisaddress}{alice@test.ex}{$value}}\" \"${if inlist {$1}{alice} {$value}}\"" finish endif @@ -13,6 +13,6 @@ if foranyaddress $h_to: ($thisaddress matches "^(marny)") then endif if $h_to: matches "^(j..)" then - pipe "DIR/aux-fixed/showenv $1" + pipe "DIR/aux-fixed/showenv \"${if inlist {$1}{jab} {$value}}\"" endif diff --git a/test/log/0383 b/test/log/0383 index 7018dd54e..0909b177f 100644 --- a/test/log/0383 +++ b/test/log/0383 @@ -1,6 +1,6 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss for alice 1999-03-02 09:44:33 10HmaX-0005vi-00 original recipients ignored (system filter) -1999-03-02 09:44:33 10HmaX-0005vi-00 ** |TESTSUITE/aux-fixed/showenv "${if match_address {$thisaddress}{alice@test.ex}{$value}}" $1 T=t1: return message generated +1999-03-02 09:44:33 10HmaX-0005vi-00 ** |TESTSUITE/aux-fixed/showenv "${if match_address {$thisaddress}{alice@test.ex}{$value}}" "${if inlist {$1}{alice} {$value}}" T=t1: return message generated 1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> R=10HmaX-0005vi-00 U=EXIMUSER P=local S=sss for CALLER@test.ex 1999-03-02 09:44:33 10HmaY-0005vi-00 => CALLER R=r1 T=t2 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed @@ -14,7 +14,7 @@ 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed 1999-03-02 09:44:33 10HmbB-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss for jabberwocky 1999-03-02 09:44:33 10HmbB-0005vi-00 original recipients ignored (system filter) -1999-03-02 09:44:33 10HmbB-0005vi-00 ** |TESTSUITE/aux-fixed/showenv $1 T=t1: return message generated +1999-03-02 09:44:33 10HmbB-0005vi-00 ** |TESTSUITE/aux-fixed/showenv "${if inlist {$1}{jab} {$value}}" T=t1: return message generated 1999-03-02 09:44:33 10HmbC-0005vi-00 <= <> R=10HmbB-0005vi-00 U=EXIMUSER P=local S=sss for CALLER@test.ex 1999-03-02 09:44:33 10HmbC-0005vi-00 => CALLER R=r1 T=t2 1999-03-02 09:44:33 10HmbC-0005vi-00 Completed diff --git a/test/mail/0383.CALLER b/test/mail/0383.CALLER index fb2f4f25c..67bb42f41 100644 --- a/test/mail/0383.CALLER +++ b/test/mail/0383.CALLER @@ -22,12 +22,12 @@ This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: - pipe to |TESTSUITE/aux-fixed/showenv "${if match_address {$thisaddress}{alice@test.ex}{$value}}" $1 + pipe to |TESTSUITE/aux-fixed/showenv "${if match_address {$thisaddress}{alice@test.ex}{$value}}" "${if inlist {$1}{alice} {$value}}" generated by system-filter The following text was generated during the delivery attempt: ------- pipe to |TESTSUITE/aux-fixed/showenv "${if match_address {$thisaddress}{alice@test.ex}{$value}}" $1 +------ pipe to |TESTSUITE/aux-fixed/showenv "${if match_address {$thisaddress}{alice@test.ex}{$value}}" "${if inlist {$1}{alice} {$value}}" generated by system-filter ------ Test pipe script @@ -175,12 +175,12 @@ This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: - pipe to |TESTSUITE/aux-fixed/showenv $1 + pipe to |TESTSUITE/aux-fixed/showenv "${if inlist {$1}{jab} {$value}}" generated by system-filter The following text was generated during the delivery attempt: ------- pipe to |TESTSUITE/aux-fixed/showenv $1 +------ pipe to |TESTSUITE/aux-fixed/showenv "${if inlist {$1}{jab} {$value}}" generated by system-filter ------ Test pipe script diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002 index 898f3b6bc..1efcb2adc 100644 --- a/test/scripts/0000-Basic/0002 +++ b/test/scripts/0000-Basic/0002 @@ -467,6 +467,8 @@ match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail} match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail} match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail} match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail} +# check for empty capture group +match: ${if match{abc}{\N^(\S+)\s*(\S.+)*$\N}{<$2>}{}} match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}} match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}} diff --git a/test/stdout/0002 b/test/stdout/0002 index 9232089f6..835d00528 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -443,6 +443,8 @@ newline tab\134backslash ~tilde\177DEL\200\201. > match: cdab > Failed: "if" failed and "fail" requested > match: cd[xyz]ab +> # check for empty capture group +> match: <> > > match_domain: yes > match_domain: no -- cgit v1.2.3