Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1467892 > unrolled thread
| Started by | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| First post | 2016-08-22 20:40 +0200 |
| Last post | 2016-08-22 20:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v05 01/72] headers_install.sh: enhance error handling Mikko Rapeli <mikko.rapeli@iki.fi> - 2016-08-22 20:40 +0200
| From | Mikko Rapeli <mikko.rapeli@iki.fi> |
|---|---|
| Date | 2016-08-22 20:40 +0200 |
| Subject | [PATCH v05 01/72] headers_install.sh: enhance error handling |
| Message-ID | <s92iC-1rh-3@gated-at.bofh.it> |
Exit with error if using undefined variables or if any sub command fails with error return value. unidef needs special handling since but this can be done without the trap. Enables examining intermediate files if some commands failed. Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi> --- scripts/headers_install.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index fdebd66..fe22807 100755 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -e +set -u if [ $# -lt 2 ] then @@ -26,7 +28,6 @@ shift # Iterate through files listed on command line FILE= -trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT for i in "$@" do FILE="$(basename "$i")" @@ -37,10 +38,13 @@ do -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ - "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1 + "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || \ + ( rm -f "$OUTDIR/$FILE.sed" ; exit 1 ) scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ - > "$OUTDIR/$FILE" - [ $? -gt 1 ] && exit 1 + > "$OUTDIR/$FILE" || \ + ( if [ $? -gt 1 ]; then \ + rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed" ; \ + exit 1 ; \ + fi ) rm -f "$OUTDIR/$FILE.sed" done -trap - EXIT -- 2.8.1
Back to top | Article view | linux.kernel
csiph-web