mod_image_for_recovery: change return trap to EXIT
copy_stateful() sets a RETURN trap that deletes a folder. Then there
are 2 calls of safe_umount function on two different mountpoints.
In bash 4.3 the RETURN trap doesn’t get executed, when those
functions return, so the trap executes after copy_stateful exits.
In bash 4.4 the trap does get executed when each of them gets
executed. As a result, the second attempt to remove said folder
fails, and the script stops execution.
This CL changes trap type to EXIT and directly deletes the folder at
the end of the function to ensure that we still does clean up on
error and on successful execution, and do not delete the folder
TEST=ran script manually, `cros tryjob -g '2713386 2713867 2713564 2717166' arkham-release-tryjob`
Tested-by: Sergey Frolov <firstname.lastname@example.org>
Reviewed-by: Mike Frysinger <email@example.com>
Reviewed-by: Nicholas Verne <firstname.lastname@example.org>
Commit-Queue: Mike Frysinger <email@example.com>
2 files changed