[exim-dev] [Bug 782] New: reduce expands <string3> with null…

Góra strony
Delete this message
Reply to this message
Autor: Jeremy Harris
Data:  
Dla: exim-dev
Nowe tematy: [exim-dev] [Bug 782] reduce expands <string3> with null $item
Temat: [exim-dev] [Bug 782] New: reduce expands <string3> with null $item
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=782
           Summary: reduce expands <string3> with null $item
           Product: Exim
           Version: N/A
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: low
         Component: String expansion
        AssignedTo: nigel@???
        ReportedBy: jgh146exb@???
                CC: exim-dev@???



Exim version 4.67

The ${reduce expansion item seems to, contrary documentation,
expand <string3> around the time of setting the initial $value
from <string2> . It then discards the result; normally fine
unless <string3> objects to the null value of $item involved.

Workaround: wrap the objecting expansion involving $item
in a ${if.


Example:

# exim -be -d+expand
Exim version 4.67 uid=0 gid=0 pid=14870 D=fbb95dfd
Berkeley DB: Berkeley DB 4.5.20: (March 30, 2007)
Support for: crypteq iconv() Perl OpenSSL Content_Scanning
Lookups: lsearch wildlsearch nwildlsearch iplsearch dnsdb ldap ldapdn ldapm
pgsql sqlite
Authenticators: cram_md5 plaintext spa
Routers: accept dnslookup ipliteral manualroute redirect
Transports: appendfile/maildir autoreply pipe smtp
Fixed never_users: 0
Size of off_t: 8
changed uid/gid: -C, -D, -be or -bf forces real uid
uid=0 gid=0 pid=14870
auxiliary group list: 0 1 2 3 4 6 10
seeking password data for user "root": cache not available
getpwnam() succeeded uid=0 gid=0
seeking password data for user "nobody": cache not available
getpwnam() succeeded uid=1000 gid=100
seeking password data for user "nobody": using cached result
getpwnam() succeeded uid=1000 gid=100
configuration file is /usr/local/exim/etc/exim.conf
log selectors = 000035fc 00273001
Starting Perl interpreter
trusted user
admin user
seeking password data for user "pcmsuser": using cached result
getpwnam() succeeded uid=1000 gid=100
seeking password data for user "pcmsuser": using cached result
getpwnam() succeeded uid=1000 gid=100
originator: uid=0 gid=0 login=root name=root
sender address = root@???
> ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}

expanding: <, 1,2,3
result: <, 1,2,3
expanding: 0
result: 0
expanding: $value+$item
result: +
skipping: result is not used
expanding: ${eval:$value+$item}
result:
skipping: result is not used
reduce: $item = "1"
expanding: $value+$item
result: 0+1
expanding: ${eval:$value+$item}
result: 1
reduce: $item = "2"
expanding: $value+$item
result: 1+2
expanding: ${eval:$value+$item}
result: 3
reduce: $item = "3"
expanding: $value+$item
result: 3+3
expanding: ${eval:$value+$item}
result: 6
expanding: ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
result: 6
6
>


> ${reduce {baz} {} {$value $item=${extract {$item}{\Nbaz="foo"\N}}}}

expanding: baz
result: baz
expanding:
result:
expanding: $item
result:
skipping: result is not used
failed to expand: $value $item=${extract {$item}{\Nbaz="foo"\N}}}}
error message: first argument of "extract" must not be empty
failed to expand: ${reduce {baz} {} {$value $item=${extract
{$item}{\Nbaz="foo"\N}}}}
error message: first argument of "extract" must not be empty inside "reduce"
item
Failed: first argument of "extract" must not be empty inside "reduce" item
>



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email