This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] scripts/check-local-headers.sh: Verify there is input (don't hang).
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 10 Dec 2014 22:08:19 -0500
- Subject: [PATCH] scripts/check-local-headers.sh: Verify there is input (don't hang).
- Authentication-results: sourceware.org; auth=none
If you have a failed build, and run `make check` it could hang forever
in check-local-headers.sh because the awk script waits reading stdin
if the input shell glob expands to nothing (missing input).
We have three options, close stdin, more awk to detect missing input
or more shell. I chose the latter, but we could probably fix this with
`exec 0>&-` in the shell if anyone objects to using find/grep or more
awk.
Tested on x86_64 with a broken build directory.
OK to checkin?
2014-12-10 Carlos O'Donell <carlos@redhat.com>
* scripts/check-local-headers.sh: Verify there is input.
diff --git a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh
index 9bffed3..5404e4b 100755
--- a/scripts/check-local-headers.sh
+++ b/scripts/check-local-headers.sh
@@ -25,6 +25,13 @@ cd "$objpfx"
# OK if *.os is missing.
shopt -s nullglob
+# Don't hang in awk reading stdin if there is no input to the test.
+# The most likely cause of this failure is a build failure.
+if ! find . -regex '.*\.o[sS]*\.d' | grep -q '.*\.o[sS]*\.d'; then
+ echo "FAIL: No input files to read."
+ exit 1
+fi
+
# Search all dependency files for file names in the include directory.
# There are a few system headers we are known to use.
# These include Linux kernel headers (asm*, arch, and linux),