Package: maildrop Version: 2.7.1-3 Severity: normal Tags: upstream Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate *** * What led up to the situation? * What exactly did you do (or not do) that was effective (or ineffective)? * What was the outcome of this action? the mailfilter manpage states that subpatterns are not processed in foreach statements (both in "Pattern Match Results" and in the documentation if "foreach"). The documentation of "getaddr" has a nice example making use of this: ====================================================================== ADDRLIST="" foreach /^(To|Cc): .*/ { foreach (getaddr $MATCH) =~ /.+/ { ADDRLIST="$ADDRLIST $MATCH" } } ====================================================================== However, expanding that example to a complete test case reveals that the body of foreach is indeed called twice for each matches header; once with MATCH set to the complete header, and once with MATCH set to the text matched by the subpattern. ====================================================================== #!/bin/sh MAILFILTER= trap 'rm -f "$MAILFILTER"' 0 MAILFILTER=$(mktemp) cat >"$MAILFILTER" <<\EOF foreach /^(To|Cc): .*/ { echo "outer match=$MATCH" foreach (getaddr $MATCH) =~ /.+/ { echo "inner match=$MATCH" } } to "/dev/null" EOF maildrop "$MAILFILTER" <<EOF To: o...@to.org, t...@to.org Cc: o...@cc.org, t...@cc.org EOF ====================================================================== This will result in the following output: ====================================================================== outer match=To: o...@to.org, t...@to.org inner match=o...@to.org inner match=t...@to.org outer match=To inner match=To outer match=Cc: o...@cc.org, t...@cc.org inner match=o...@cc.org inner match=t...@cc.org outer match=Cc inner match=Cc ====================================================================== * What outcome did you expect instead? Based on the documentation, I'd expect the body of the outer foreach to be called only once for each matched header, with MATCH set to the complete header. I'd also expect MATCH1 to be unmodified inside the outer foreach body. However, a slight modification of the of the above script reveals that MATCH1 is set to "Cc" the first time the outer foreach body is executed (but not on subsequent executions). Regards, Jö. -- System Information: Debian Release: 8.0 APT prefers stable APT policy: (990, 'stable'), (1, 'proposed-updates'), (1, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) Versions of packages maildrop depends on: ii courier-authlib 0.66.1-1+b1 ii libc6 2.19-18 ii libgcc1 1:4.9.2-10 ii libgdbm3 1.8.3-13.1 ii libpcre3 2:8.35-3.3 ii libstdc++6 4.9.2-10 Versions of packages maildrop recommends: ii exim4 4.84-8 ii exim4-daemon-light [mail-transport-agent] 4.84-8 maildrop suggests no packages. -- no debconf information -- Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics, University of Münster, Orleans-Ring 10, D-48149 Münster Tel: +49 251 83 35146 Fax: +49 251 83 32729 In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- Douglas Adams
signature.asc
Description: Digital signature