Just thought I'll share a “fun" story. Friend reported weird bug – OmniPITR reported that xlogs are sent to archive, but they actually weren't.
After some checking we found out that he was giving custom rsync-path (–rsync-path – path to rsync program) – and the path was broken.
In this case – OmniPITR was not reporting error, and quite happily was working under assumption that it works OK.
When I digged into the code, it just didn't make sense. For this to happen, the code would have to go past exec() call.
For those of you that don't know – exec replaces current process with another program, but keeping pid, env and open files. The thing is – there is no return from exec(). Once you do exec, the program that ran it is removed from memory, and new program is in its place.
It occurred to me to check the docs. And apparently if exec will fail, it returns, and continues with current program.
And this is bad due to multiple reasons – at least in my case.
Long story short – added checking of return code from exec(), and in case it failed, print error message, and exit in such a way that destructor will not be called.
Thanks go to Keith for the initial bug report, and RhodiumToad for suggestion to use POSIX::_exit(), and not kill(-9, $$);