git: c9f9dc96d908 - stable/13 - installworld: improve portability of ldd use

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 12 Aug 2022 15:07:01 UTC
The branch stable/13 has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=c9f9dc96d9089d250f4aba9bab4d2acea9b7acf2

commit c9f9dc96d9089d250f4aba9bab4d2acea9b7acf2
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2022-07-01 07:33:16 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2022-08-12 15:06:26 +0000

    installworld: improve portability of ldd use
    
    b3b462229f97 added a case statement to ignore lines containing strings
    in square brackets such as "[vdso]" and "[preloaded]". On MacOS
    Monterey where /bin/sh may be zsh, this fails with:
    
    /bin/sh: -c: line 0: syntax error near unexpected token `;;'
    
    Invoke grep in the pipeline to remove such lines instead.
    
    Reviewed by:    emaste
    Sponsored by:   DARPA, AFRL
    Differential Revision:  https://reviews.freebsd.org/D35618
    
    (cherry picked from commit bda5d2a45c8dcc9bbeb71cddeef930ffa6a47f23)
---
 Makefile.inc1 | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index ab9510094049..3b63c6f85ffc 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1380,12 +1380,8 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 		fi; \
 	    done); \
 	if [ -z "${CROSSBUILD_HOST}" ] ; then \
-		libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
+		libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | grep -Ev '\[.*]' | \
 		    while read line; do \
-			case $$line in \
-			"["*"]") \
-				continue;; \
-			esac; \
 			set -- $$line; \
 			if [ "$$2 $$3" != "not found" ]; then \
 				echo $$2; \