#1476 PR merged: Do not 'simply return' when 'set-eu' is set.

Labels: bug, fixed / solved / done

jsmeix opened issue at 2017-09-08 09:02:

When 'set-e' is set one cannot 'simply return' from a script.
When 'set-e' is set one must always call

apply_bash_flags_and_options_commands "$DEFAULT_BASH_FLAGS_AND_OPTIONS_COMMANDS"

before returnig into other code where 'set-e' is not set.
Otherwise there happen arbitrary unexpected failures elsewhere
because "the rest of the ReaR code" is not at all ready to
run correctly when 'set -e' is set, see also
https://github.com/rear/rear/issues/700

jsmeix commented at 2017-09-08 09:15:

I checked all current scripts and now all look o.k.:

# for f in $( find usr/sbin/rear usr/share/rear/ | xargs grep -l 'set -e -u' ) ; do echo $f ; egrep 'set -e -u|return' $f ; echo ======================================= ; done

usr/share/rear/backup/ZYPPER/default/500_make_backup.sh
return 0
set -e -u -o pipefail
=======================================
usr/share/rear/prep/NETFS/default/070_set_backup_archive.sh
    return
        return
        return
    return
set -e -u -o pipefail
=======================================
usr/share/rear/prep/BLOCKCLONE/default/070_set_backup_archive.sh
    return
        return
        return
    return
set -e -u -o pipefail
=======================================
usr/share/rear/prep/ZYPPER/default/400_prep_zypper.sh
set -e -u -o pipefail
=======================================
usr/share/rear/restore/ZYPPER/default/400_restore_backup.sh
set -e -u -o pipefail
=======================================
usr/share/rear/restore/ZYPPER/default/940_generate_fstab.sh
set -e -u -o pipefail
=======================================
usr/share/rear/restore/ZYPPER/default/950_grub2_mkconfig.sh
set -e -u -o pipefail
=======================================
usr/share/rear/restore/ZYPPER/default/970_set_root_password.sh
set -e -u -o pipefail
=======================================
usr/share/rear/restore/ZYPPER/default/980_initial_network_setup.sh
test "${ZYPPER_NETWORK_SETUP_COMMANDS[*]:-}" || return
set -e -u -o pipefail
=======================================
usr/share/rear/verify/NETFS/default/070_set_backup_archive.sh
    return
        return
        return
    return
set -e -u -o pipefail
=======================================
usr/share/rear/verify/BLOCKCLONE/default/070_set_backup_archive.sh
    return
        return
        return
    return
set -e -u -o pipefail
=======================================

i.e. no longer a 'return' after 'set -e' so that I merge it now.


[Export of Github issue for rear/rear.]