Mailing List Archive

another transport filter question
Consider a case like this:

some_transport:
transport_filter = /usr/local/bin/frobnicate_thing ${thing}


What happens when ${thing} expands to the empty string? Is it passed
as an empty argument to the program, does the program just not get any
args?

--
Ian

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: another transport filter question [ In reply to ]
On 1/4/24 05:35, itz--- via Exim-users wrote:
> Consider a case like this:
>
> some_transport:
> transport_filter = /usr/local/bin/frobnicate_thing ${thing}
>
>
> What happens when ${thing} expands to the empty string? Is it passed
> as an empty argument to the program, does the program just not get any
> args?
>

The documentation does answer this question.

"Exim breaks it up into arguments and then expands each argument separately"
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: another transport filter question [ In reply to ]
On Thu, Jan 04, 2024 at 11:41:47AM +0000, Jeremy Harris via Exim-users wrote:

> > some_transport:
> > transport_filter = /usr/local/bin/frobnicate_thing ${thing}

> > What happens when ${thing} expands to the empty string? Is it
> > passed as an empty argument to the program, does the program just
> > not get any args?

> The documentation does answer this question.

> "Exim breaks it up into arguments and then expands each argument separately"

I was very aware of this bit. Hard to use transport filters at all
without knowing this.

Conceivably, if exim detects that an arg is empty, it could just
remove it from the list of args. But by the terseness of your reply,
it looks like it doesn't. No worries, I'll cope as always.

--
Ian

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: another transport filter question [ In reply to ]
On Thu, Jan 04, 2024 at 11:02:30AM -0800, Ian Z via Exim-users wrote:
> Conceivably, if exim detects that an arg is empty, it could just
> remove it from the list of args.

Why? Args are positional, and empty string is a valid arg, isn't it?

Bourne shells remove empty expressions during evaluation of arguments
(historically, and not all shells by default), but they first expand
variables, then split string by whitespace separators, more precisely,
split by contents of IFS. And on the last step, quotes are removed,
so the only method to pass empty string in shell is to use '' or "".
--
Eugene Berdnikov

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/