From 6ff48ecff7f5a179e16ee4aaf6e7affac69bb93e Mon Sep 17 00:00:00 2001 From: Joseph Mingrone Date: Sat, 17 Jul 2021 12:55:13 -0300 Subject: 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) --- Mk/Scripts/qa.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index 13548ddb38c7..9caf01581b47 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -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 -- cgit v1.2.3