[PATCH 1/2] maint: fix ioctls_sym.sh premature termination
Gleb Fotengauer-Malinovskiy
glebfm at altlinux.org
Wed Jun 28 17:39:54 UTC 2017
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 code that causes
xargs to exit with a non-zero code, too.
* maint/ioctls_sym.sh: Use find's -exec instead of xargs;
Ignore it's exit code.
---
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 d9551b7..1d50850 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
--
glebfm
More information about the Strace-devel
mailing list