mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 07:51:59 -09:00
The trap was initially introduced inc5fa9308ea(core/br2-external: properly report unexpected errors), in 2017, to catch all unexpected errors, back when a single file was generated, and errors emitted to stderr. Since commitd027cd75d0(core: generate all br2-external files in one go), in 2019 the single output file 'ofile' is no longer created, as multiple output files were then introduced, while messages for *expected errors* were redirected to a Makefile variable assignment emitted on stdout, at which point the script just exits (in error); expected failures only occur in do_validate(). Unexpected errors can only occur on failure to create, or write to, output files, either '.br2-external.mk' in do_validate() or do_mk(), or any of the kconfig fragments in do_kconfig(). Cause for failure to create those can only be a no-space-left-on-device condition, as they are created in a directory that was just created by the script earlier in main(), and thus has the necessary mode; failure to create that directory is now caught explicitly. A trap on ERR is not called when the shell exits explicitly with a call to 'exit', thus, only failures to create or write to output file would be caught. In that case, we are better off not trying to write to those files anyway: failure to create the file would already be reported by the shell on stderr, while disk-full would not allow to store the output anyway... In any case, the script exits in error, which is going to be caught by the caller, which will terminate. So, drop the trap altogether. As a side effect, that squelches a shellcheck error. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Romain Naour <romain.naour@smile.fr> (cherry picked from commit244e4283a9) Signed-off-by: Thomas Perale <thomas.perale@mind.be>