Re: [Exim] Re: Re: Re: pipe transport

Pàgina inicial
Delete this message
Reply to this message
Autor: Torsten Curdt
Data:  
A: Derrick 'dman' Hudson, exim-users
Assumpte: Re: [Exim] Re: Re: Re: pipe transport
>| I was assuming that the whole exim child dies and I will have no
>| return code at all!?
>
>The child on the receiving end of the pipe dies, and apparently the
>exim process gets back a return code that indicates the child died
>with SEGV (which is how it can log it and handle it rather gracefully).
>
>| so I thought you mean a wrapper to catch the signal and return a
>| specific code then...
>
>That's what I meant, but as I was creating that wrapper (the one-liner
>I posted, just replace the echo's with exit) I noticed that the shell
>did have an exit code from the bad C program. Knowing that, the
>solution can be simplified to simply telling exim to treat that code
>as a temporary failure. Try it and find out! (that's what the C
>program is for -- it allows you to control when it crashes and when it
>doesn't for testing)


Hi, Derrick this is what I tried:

# crash ; echo $?         -> 0
# crash -segv ; echo $?   -> 139


So I've setup two directors and transports:

test_ok_delivery:
driver = pipe
command = "/tmp/crash"
temp_errors = 139
ignore_status = false
return_output
log_output
prefix =
suffix =
user = cyrus
group = mail
home_directory = /tmp

test_crash_delivery:
driver = pipe
command = "/tmp/crash -segv"
temp_errors = 139
ignore_status = false
return_output
log_output
prefix =
suffix =
user = cyrus
group = mail
home_directory = /tmp

...


test_ok_director:
local_parts = "test-ok"
driver = smartuser
transport = test_ok_delivery

test_crash_director:
local_parts = "test-crash"
driver = smartuser
transport = test_crash_delivery


Then I tried them out:

# ( echo "To: test-ok" ; echo ; echo "body" ) | exim -t -d9
# ( echo "To: test-crash" ; echo ; echo "body" ) | exim -t -d9

The first works just fine (as exspected) but the second one gives a "mail
delivery failed":

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  test-crash@???
    Child process of test_crash_delivery transport
    (running command"/tmp/crash -segv") was terminated by
    signal 11 (Segmentation fault)


The following text was generated during the delivery attempt:

------ test-crash@??? ------

null 0

^--- watch this!

At least me for it looks like it's not that easy because the child that dies
with a segfault seems to return 0 instead of 139:((
Or did I get something wrong here?
--
Torsten