Building upon the discussion in db7b9568d6b7115d39086b3ea4311bedb99cb4c9, tweaked the error handling for our device template functions.
Errors in device_chroot_xxx device functions were caught previously because chroot would propagate any error up catch the trap. But device functions like write_device_xx wouldn't given the way Bash handles functions environments by default.
We now set the -o errtrace flag to explicitly force errors in functions to catch traps as well.
Also tried to have the errors be a little more informative to quickly track down where they arise. The stack trace is quite rudimentary - it isn't the best (even worse inside chroot), but it is something ;-)
Building upon the discussion in db7b9568d6b7115d39086b3ea4311bedb99cb4c9, tweaked the error handling for our device template functions. Errors in
device_chroot_xxx
device functions were caught previously becausechroot
would propagate any error up catch the trap. But device functions likewrite_device_xx
wouldn't given the way Bash handles functions environments by default. We now set the-o errtrace
flag to explicitly force errors in functions to catch traps as well.Also tried to have the errors be a little more informative to quickly track down where they arise. The stack trace is quite rudimentary - it isn't the best (even worse inside
chroot
), but it is something ;-)Some tests:
And inside chroot