[rear-devel] [rear/rear] 03927e: Error function must not immediately return to its ...

Johannes Meixner noreply at github.com
Thu Mar 21 11:13:17 CET 2019


  Branch: refs/heads/master
  Home:   https://github.com/rear/rear
  Commit: 03927edab99e78253bcb59fb1d640efbec780ab1
      https://github.com/rear/rear/commit/03927edab99e78253bcb59fb1d640efbec780ab1
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-18 (Mon, 18 Mar 2019)

  Changed paths:
    M usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Error function must not immediately return to its caller so sleep one second before return


  Commit: cfd440158f7fd56fbc94835d2111f2d81176eb95
      https://github.com/rear/rear/commit/cfd440158f7fd56fbc94835d2111f2d81176eb95
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-18 (Mon, 18 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  In Error function exit our own subshell if we are in a subshell to mitigate issue 2089 (not yet a final solution)


  Commit: d9a02ad1397331a2fbf24515311e3c30271e43e5
      https://github.com/rear/rear/commit/d9a02ad1397331a2fbf24515311e3c30271e43e5
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-18 (Mon, 18 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  In Error function terminate descendants PIDs from childs to grandchilds to hopefully fix issue 2089 (not yet fully tested)


  Commit: 0df5a3be87c5ea65f68a748c257e691ab7e55daf
      https://github.com/rear/rear/commit/0df5a3be87c5ea65f68a748c257e691ab7e55daf
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-18 (Mon, 18 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Better and fixed comments


  Commit: 1c0bcc843915570c158ae416876e374395acc9ca
      https://github.com/rear/rear/commit/1c0bcc843915570c158ae416876e374395acc9ca
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-19 (Tue, 19 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Adjusted the two terminate_descendants_* functions and DoExitTasks to make things work cleanly in case of Error from a deep nested subshell


  Commit: 908446a7910413aa608d8445636d69e082c6173c
      https://github.com/rear/rear/commit/908446a7910413aa608d8445636d69e082c6173c
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-19 (Tue, 19 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Do not terminate the current process that runs the Error function


  Commit: 992c64bb764e0d4bc138aa6924ddd39189ce8578
      https://github.com/rear/rear/commit/992c64bb764e0d4bc138aa6924ddd39189ce8578
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-20 (Wed, 20 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Determine the current PID for bash 3.x so that it works even from within a nested subshell


  Commit: 0fc3d9fd59a510df7c3330dd4cf7ddc360143e44
      https://github.com/rear/rear/commit/0fc3d9fd59a510df7c3330dd4cf7ddc360143e44
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2019-03-21 (Thu, 21 Mar 2019)

  Changed paths:
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Use mktemp to create the temporary file safely


  Commit: aedaca25471c1493c9984ccbeca48583262f6901
      https://github.com/rear/rear/commit/aedaca25471c1493c9984ccbeca48583262f6901
  Author: Johannes Meixner <jsmeix at suse.com>
  Date:   2019-03-21 (Thu, 21 Mar 2019)

  Changed paths:
    M usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
    M usr/share/rear/lib/_input-output-functions.sh

  Log Message:
  -----------
  Merge pull request #2088 from jsmeix/Error_function_must_not_return_to_its_caller_but_wait_until_killed

Ensure that the Error function results a direct and complete exit
of the whole running 'rear' program:
Before when the Error function was called from a (possibly nested) subshell
it did not exit the whole running 'rear' program because Error sends SIGUSR1
to MASTER_PID (which is the usr/sbin/rear main script) that has a trap for it
to error out but when MASTER_PID is waiting for the subshell where Error
was called and MASTER_PID receives a signal for which a trap has been set
the trap will not be executed until the subshell completes
(see the section about 'SIGNALS' in "man bash").
Therefore when Error was called in a subshell all subsequent code
in that subshell after the Error call had also been executed, see
https://github.com/rear/rear/issues/2087#issuecomment-473868951
and https://github.com/rear/rear/issues/2089 therein in particular
https://github.com/rear/rear/issues/2089#issuecomment-473929605 and
https://github.com/rear/rear/issues/2089#issuecomment-474260332
Now the Error function terminates all descendant processes of MASTER_PID
except MASTER_PID and the current process that runs the Error function
and when Error was called from a subshell it finally exits its own subshell
so that when the Error function finished only MASTER_PID is still running
and finally MASTER_PID exits (as usual via the DoExitTasks function).


Compare: https://github.com/rear/rear/compare/fd346724605a...aedaca25471c


More information about the rear-devel mailing list