git: cda8b6d4f465 - main - llvm-{cheri,morello}: Fix wrapper script

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Tue, 25 Feb 2025 15:13:21 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cda8b6d4f4658bf4052330996e16d4ec27554787

commit cda8b6d4f4658bf4052330996e16d4ec27554787
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-02-25 15:10:58 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-02-25 15:10:58 +0000

    llvm-{cheri,morello}: Fix wrapper script
    
    grep -q exits when it's found a match so if it exits fast enough,
    llvm-readelf might get a SIGPIPE which it failes to handle.  Avoid this
    by using a redirect to /dev/null to silence grep instead of -q.
    
    Submitted by:   def
---
 devel/llvm-cheri/Makefile                  | 2 +-
 devel/llvm-cheri/files/wrapper-cheri.sh.in | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/devel/llvm-cheri/Makefile b/devel/llvm-cheri/Makefile
index 22aa8a1b0bc0..cb9c0f7ac35f 100644
--- a/devel/llvm-cheri/Makefile
+++ b/devel/llvm-cheri/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 PORTVERSION=	${LLVM_MAJOR}.0.d${SNAPDATE}
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	devel lang
 PKGNAMESUFFIX=	${LLVM_SUFFIX}
 
diff --git a/devel/llvm-cheri/files/wrapper-cheri.sh.in b/devel/llvm-cheri/files/wrapper-cheri.sh.in
index 46f5244c3c06..1ca26fcacf4d 100644
--- a/devel/llvm-cheri/files/wrapper-cheri.sh.in
+++ b/devel/llvm-cheri/files/wrapper-cheri.sh.in
@@ -147,7 +147,7 @@ arch_objdump_flags=
 if [ $CHERIBSD_VERSION -gt 0 ]; then
 	case "$_TARGET" in
 	aarch64-*-freebsd*)
-		if run_tool llvm-readelf -h ${_SYSROOT}/lib/libc.so.7 | grep -q "Flags:.*purecap"; then
+		if run_tool llvm-readelf -h ${_SYSROOT}/lib/libc.so.7 | grep "Flags:.*purecap" >/dev/null; then
 			tls_flags=
 			vararg_flags=
 			if [ "$CHERIBSD_VERSION" -le 20220314 ]; then
@@ -176,7 +176,7 @@ if [ $CHERIBSD_VERSION -gt 0 ]; then
 		fi
 		;;
 	riscv64-*-freebsd*)
-		if run_tool llvm-readelf -h ${_SYSROOT}/lib/libc.so.7 | grep -q "Flags:.*cheriabi"; then
+		if run_tool llvm-readelf -h ${_SYSROOT}/lib/libc.so.7 | grep "Flags:.*cheriabi" >/dev/null; then
 			mabi=l64pc128d
 		else
 			mabi=lp64d