#1485 Issue closed: Error function is returning exit code 0

Labels: support / question, fixed / solved / done

didacog opened issue at 2017-09-12 14:29:

Relax-and-Recover (ReaR) Issue Template

Fill in the following items before submitting a new issue
(quick response is not guaranteed with free support):

  • rear version (/usr/sbin/rear -V): 2.2
  • OS version (cat /etc/rear/os.conf or lsb_release -a): any
  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):
  • Are you using legacy BIOS or UEFI boot? any
  • Brief description of the issue:
    Seems that since some changes in _input-output-functions.sh the Error function is returning exit code 0 and DRLM remote mkbackup execution cannot detect the error in the rear execution.
    When a backup fails DRLM cannot detect the error (previously >0) and hangs.
  • Work-around, if any: NOT yet

didacog commented at 2017-09-13 07:55:

I'm on this and could be an issue with some rare OS environment settings.
Please do not take this issue yet, I will update it with my results.

Thanks!

jsmeix commented at 2017-09-13 08:37:

@didacog FYI:
any return code of the Error function should be meaningless
for the exit code of the usr/sbin/rear program because the
Error function terminates the usr/sbin/rear program by
sending SIGUSR1 for which a trap exists that kills
the usr/sbin/rear program (via the default SIGTERM)
so that the exit code of the usr/sbin/rear program
is in this case always 143 which is 128+15
and 15 is the value of SIGTERM (see "man 7 signal").

You can verify this e.g. by adding to
usr/share/rear/init/default/030_update_recovery_system.sh
a very first line like

Error "testerror"

(I misuse 030_update_recovery_system.sh for such tests
because that is an 'init' script that is always and early run)
and then I get

# usr/sbin/rear -d -D mkrescue
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master/var/log/rear/rear-e205.log
ERROR: testerror
Aborting due to an error, check /root/rear.master/var/log/rear/rear-e205.log for details
Terminated

# echo $?
143

When I change the Error function to this

    ...
    kill -USR1 $MASTER_PID
    exit 99
}

it still terminates with exit-code 143.
See also
https://github.com/rear/rear/issues/1134
therein

... the already used bash exit codes:
...
128+n Fatal error signal "n"
e.g.  kill -9 $PPID of script   
      $? returns 137 (128 + 9)
...

jsmeix commented at 2017-09-19 14:47:

@didacog
because "no news is good news" I just assume that with
https://github.com/rear/rear/issues/1485#issuecomment-329098522
the issue is sufficiently answered so that I can close it.
If not you can of course reopen it.

didacog commented at 2017-09-20 08:15:

@jsmeix
Sorry for the late response and for not updating on the issue, I was figuring out what happened with this issue and solving some critical issues in a customer.
Somehow our testing environment VMs got corrupted and all VMs started to malfunction with strange environment issues during tests.
We've re-deployed a new environment for testing and all seems is working fine now.

Thanks for updating and closing this issue.

Regards,
Didac

jsmeix commented at 2017-09-20 10:17:

@didacog
many thanks for the information what the actual cause was.
It helps (at least me) a lot to have an explicit confirmation
when there was no (possibly obscure) issue in ReaR.


[Export of Github issue for rear/rear.]