[exim-dev] Re: [Bug 3037] Broken pipe in transport filter

Pàgina inicial
Delete this message
Reply to this message
Autor: Kirill Miazine
Data:  
A: exim-dev
Assumpte: [exim-dev] Re: [Bug 3037] Broken pipe in transport filter
• Exim Bugzilla via Exim-dev [2023-10-12 18:45]:
> https://bugs.exim.org/show_bug.cgi?id=3037
>
> --- Comment #4 from Zakaria <hi@???> ---
> Oh, more points, I think they could be helpful for anyone else who wants to
> find resolve to this issue.
>
> As Jeremy suggested, running cat in transport filter like the following:-
>
> transport_filter = /bin/bash -c '/bin/cat'
>
> renders no point for me of using transport filter since it doesn't modify nor
> offer me any ability to filter anything, and yet it works fine and the broken
> pipe issue doesn't happen but if I run it from inside bash script with certain
> or identical email content, it throws broken pipe error.
>
> Lastly, it seems EXIM takes limited segment from the cat or echo content or
> it's not just the first call to cat if it was outputted from bash script since
> I tested calling cat only once for concatenated content, and anyways ends with
> throwing broken pipe? other ways to mitigate this?
>
> Also, in case anyone wants to review my bash script, this is it's content, and
> not sure if I can run it from inside EXIM configuration file directly given I
> use several commands and all are being executed when ran from bash as I tested
> if it reaches exit 0.


the scripts seems to ignore the input which exim is sending to stdin,
no? could that be the cause for the error?

and even if the script starts handling stdin properly, the pipe
transport filter seems like a wrong approach for me, even it _might_
work: why not do a delivery using a normal pipe transport, and do
necessary transformations there, and then make that pipe transport call
exim again with -oMr option with some value and resend the modified
message this way? -oMr sents $received_protocol, which can be used to
know when input has been "filtered" already.

> #!/bin/sh
> 
> msgid=$1
> bpath=$(/usr/bin/find /var/spool/exim/input -name "*$msgid*-D")
> hpath=$(/usr/bin/find /var/spool/exim/input -name "*$msgid*-H")
> result=$(/usr/prependpng.sh "$bpath" "$hpath")
> if [[ $result != "isntchunked" ]]; then
>   END=$result
>   for ((i=1;i<=END;i++)); do
>    cat "${bpath}-modified${i}"
>    cat "${bpath}-modified${i}" >> /etc/exim/prependtest
>    rm -f "${bpath}-modified${i}"
>   done
> else
>   cat ${bpath}-modified
>   #cat "${bpath}-modified" > /etc/exim/prependtest
>   rm -f "${bpath}-modified"
> fi
> exit 0
> 
> 
> Looking forward, with thanks.
> 
> Zakaria.
> 


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