From 16f1b5ca721fb899e038a7916fd20f464176e400 Mon Sep 17 00:00:00 2001 From: Gleb Fotengauer-Malinovskiy Date: Wed, 28 Jun 2017 20:39:54 +0300 Subject: [PATCH] maint: fix ioctls_sym.sh premature termination When the list of headers do not fit into the command line, xargs splits it into several lists and then passes them to grep. If no headers from a list match the grep pattern, grep exits with a non-zero status that causes xargs to exit with a non-zero status, too. * maint/ioctls_sym.sh: Use "find -exec +" instead of xargs, ignore its exit status. --- maint/ioctls_sym.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/maint/ioctls_sym.sh b/maint/ioctls_sym.sh index d9551b74..1d508507 100755 --- a/maint/ioctls_sym.sh +++ b/maint/ioctls_sym.sh @@ -75,9 +75,10 @@ tmpdir="$(mktemp -dt "$me.XXXXXX")" # list interesting files in $inc_dir. cd "$inc_dir" inc_dir="$(pwd -P)" -find . -type f -name '*.h' -print0 | - xargs -r0 grep -l "$r_value" -- > "$tmpdir"/headers1.list || - exit 0 +find . -type f -name '*.h' -exec grep -l "$r_value" -- '{}' + \ + > "$tmpdir"/headers1.list ||: +[ -s "$tmpdir"/headers1.list ] || exit 0 + cd - > /dev/null sed 's|^\./\(uapi/\)\?||' < "$tmpdir"/headers1.list > "$tmpdir"/headers.list LC_COLLATE=C sort -u -o "$tmpdir"/headers.list "$tmpdir"/headers.list