Mk/Scripts/qa.sh: Turn off pipefail when piping to grep -q

The pipeline

   readelf -d "${dep_file}" | grep -q SONAME

can fail because grep -q closes the output early resulting sigpipe being
sent to readelf.  Other possible solutions are to turn off pipefail for
the file or remove the -q grep argument.

Credit to ashish@ for the detective work to discover the root cause of
this.

Differential Revision: https://reviews.freebsd.org/D31211

Reviewed by:	emaste
Approved by:	bapt (portmgr) mat (portmgr)
This commit is contained in:
Joseph Mingrone 2021-07-17 12:55:13 -03:00
parent 8e05a6e24d
commit 6ff48ecff7
No known key found for this signature in database
GPG key ID: 36A40C83B0D6EF9E

View file

@ -663,9 +663,13 @@ proxydeps() {
# Check that the .so we need has a SONAME
if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then
# When grep -q finds a match it will close the pipe immediately.
# This may cause the test to fail when pipefail is turned on.
set +o pipefail
if ! readelf -d "${dep_file}" | grep -q SONAME; then
err "${file} is linked to ${dep_file} which does not have a SONAME. ${dep_file_pkg} needs to be fixed."
fi
set -o pipefail
fi
# If we don't already depend on it, and we don't provide it