#1748 PR merged: Run exit tasks code with default bash flags and options (issues #700 and #1747)

Labels: bug, fixed / solved / done

jsmeix opened issue at 2018-03-07 10:26:

set -e -u -o pipefail
echo "$DOESNOTEXIST"

which lets that script abort.
Without the fix it looks during "rear recover"

RESCUE d57:~ # rear -D recover
...
Confirm or edit the disk mapping
1) Confirm disk mapping and continue 'rear recover'
2) Edit disk mapping (/var/lib/rear/layout/disk_mappings)
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm disk mapping and continue 'rear recover''
User confirmed disk mapping
Exiting rear recover (PID 851) and its descendant processes
RESCUE d57:~ #

With the fix it looks during "rear recover"

RESCUE d57:~ # rear -D recover
...
Confirm or edit the disk mapping
1) Confirm disk mapping and continue 'rear recover'
2) Edit disk mapping (/var/lib/rear/layout/disk_mappings)
3) Use Relax-and-Recover shell and return back to here
4) Abort 'rear recover'
(default '1' timeout 300 seconds)

UserInput: No real user input (empty or only spaces) - using default input
UserInput: Valid choice number result 'Confirm disk mapping and continue 'rear recover''
User confirmed disk mapping
Exiting rear recover (PID 871) and its descendant processes
Running exit tasks
rear recover failed, check /var/log/rear/rear-d57.log for details
RESCUE d57:~ #
  • Brief description of the changes in this pull request:
    In the DoExitTasks() function first of all restore the ReaR default bash flags and options
    because otherwise in case of a bash error exit when e.g. "set -e -u -o pipefail" was set
    all the exit tasks related code would also run with "set -e -u -o pipefail" still set
    which may abort exit tasks related code anywhere with a "sudden death" bash error exit
    where in particular no longer the EXIT_FAIL_MESSAGE would be shown
    so that for the user ReaR would "just somehow silently abort" in this case.

[Export of Github issue for rear/rear.]