Re: [exim] Undocumented surprise in ${run ...} processing

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: Chris Siebenmann
CC: exim-users
Subject: Re: [exim] Undocumented surprise in ${run ...} processing
On Wed, Jul 2, 2014 at 1:07 PM, Chris Siebenmann <cks@???> wrote:
> Until now I didn't know that quoting things in ${run ...} did anything;
> that isn't documented either from what I can see. My assumption had been


I didn't find any documentation either.

> that Exim first split the unexpanded ${run} command and arguments on
> whitespace, creating:
>
>         argv[0] = /bin/cat
>         argv[1] = $local_part
>         argv[2] = /etc/passwd

>
> and then expanded each in place. If an argument wound up empty after
> expansion, it would be preserved (as empty). This was based on the
> documentation wording that 'the command and its arguments are first
> expanded *separately*' (emphasis mine).


Yeah, that definitely implies that it would retain position. There
must be a check of each argument to see what is the string length and
just discard it if 0.

> What is and should be ${run}'s quoting and quote-stripping
> behavior? There are real questions here if the answers are not
> officially documented. For example, if $local_part includes a " and you
> wrote:
>
>         ${run {/bin/echo "$local_part"}}

>
> what happens? Suppose you have a $local_part value that is:
>         alocal"part

>
> Are only the outside 'literal' quotes stripped, resulting in:
>
>         argv[1] = alocal"part

>
> or do you wind up with something like:
>
>         argv[1] = alocalpart"


Tested and that totally changes the parsing:

14:06:47  3375 expanding: /bin/cat "alocal"part" /etc/passwd
14:06:47  3375    result: /bin/cat "alocal"part" /etc/passwd
14:06:47  3375 direct command:
14:06:47  3375   argv[0] = /bin/cat
14:06:47  3375   argv[1] = alocal
14:06:47  3375   argv[2] = part"
14:06:47  3375   argv[3] = /etc/passwd
14:06:47  3375 expanding: ${run {/bin/cat "alocal"part" /etc/passwd}}


> Or you could even get an error.


Worse, it silently does nothing (the cat /etc/passwd failed because
quoting was off).

> It's my strong opinion that all of this should at least be
> documented. I can work out what the answers are on any specific Exim


I agree. I'll see if I can come up with some verbage tomorrow that
will help to clarify this. If you have a suggestion of which section
you think should do this, that would be great.

Now that I'm back from vacation, I was planning on cutting another RC.
There have been few changes since the last RC. If this last RC has no
problem reports from people, it could become the final. Then we can
move on to bigger features.

...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine