Skip to contentSkip to conversation

core/br2-external: properly report unexpected errors

PATCH New Yann E. MORIN 3 participants 3 messages Jan 28, 2017 – Mar 31, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 core/br2-external: properly report unexpected errors

Unextected error in the br2-external script are properly caught, but they are not reported properly, and we end up in either of two situations:

- the .br2-external.mk file is not generated, in which case make will try to find a rule to generate it (because the 'include' directive tries to generate missing files);

- the .br-external.mk file is generated but does not contain the error variable, and thus the build might not get interrupted.

We fix that by using a trap on the pseudo ERR signal, to emit the error variable on unexpected errors.

---
 support/scripts/br2-external | 3 +++
 1 file changed, 3 insertions(+)
support/scripts/br2-external +3 -0
index 26bcac8..7e81608 100755
@@ -40,6 +40,9 @@ main() {
 
     exec >"${ofile}"
 
+    # Trap any unexpected error to generate a meaningful error message
+    trap "error 'unexpected error while generating ${ofile}\n'" ERR
+
     do_validate ${@//:/ }
 
     do_${ofmt}
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 core/br2-external: properly report unexpected errors

Hello,

Quoted 11 lines · Yann E. MORIN

Unextected error in the br2-external script are properly caught, but they are not reported properly, and we end up in either of two situations:

- the .br2-external.mk file is not generated, in which case make will try to find a rule to generate it (because the 'include' directive tries to generate missing files);

- the .br-external.mk file is generated but does not contain the error variable, and thus the build might not get interrupted.

Quoted 7 lines

We fix that by using a trap on the pseudo ERR signal, to emit the error variable on unexpected errors.

---
 support/scripts/br2-external | 3 +++
 1 file changed, 3 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 core/br2-external: properly report unexpected errors

Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 18 lines · Yann E. MORIN

Unextected error in the br2-external script are properly caught, but they are not reported properly, and we end up in either of two situations:

- the .br2-external.mk file is not generated, in which case make will try to find a rule to generate it (because the 'include' directive tries to generate missing files);

- the .br-external.mk file is generated but does not contain the error variable, and thus the build might not get interrupted.

We fix that by using a trap on the pseudo ERR signal, to emit the error variable on unexpected errors.

---
support/scripts/br2-external | 3 +++

1 file changed, 3 insertions(+)

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard