From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id OgEkOKip01+HOAAA0tVLHw (envelope-from ) for ; Fri, 11 Dec 2020 17:17:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2DRgM6ip01/DcwAAbx9fmQ (envelope-from ) for ; Fri, 11 Dec 2020 17:17:28 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A1CEE9402A9 for ; Fri, 11 Dec 2020 17:17:28 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6DA0F28532; Fri, 11 Dec 2020 12:17:20 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 652002852F for ; Fri, 11 Dec 2020 12:17:18 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id ADCF65FC36; Fri, 11 Dec 2020 12:17:16 -0500 (EST) Received: (nullmailer pid 2781041 invoked by uid 1000); Fri, 11 Dec 2020 17:17:14 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH] test/T360-symbol-hiding: use readelf in place of nm Date: Fri, 11 Dec 2020 13:17:06 -0400 Message-Id: <20201211171706.2780993-1-david@tethera.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Message-ID-Hash: 2FURFZK4JHUPSHWVBRI5DMTSUM5PHMYK X-Message-ID-Hash: 2FURFZK4JHUPSHWVBRI5DMTSUM5PHMYK X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 0.40 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: A1CEE9402A9 X-Spam-Score: 0.40 X-Migadu-Scanner: scn1.migadu.com X-TUID: VCDpoH2ace9W It turns out that using nm -P isn't as portable as hoped. In particular on architectures using ELF v1 (e.g. ppc64), the desired symbols end up in the data section instead of text. The test is currently only functional on ELF based architectures, so I think it's legit to depend on readelf instead of nm. The switch to readelf has the advantage that we can explicitely ask for all of the symbols with global visibility, rather than grepping for notmuch. That seems a more robust approach since it will catch any strangely named global symbols. --- test/T360-symbol-hiding.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index b34f1e54..4e5007da 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -26,7 +26,8 @@ test_begin_subtest 'checking output' test_expect_equal "$result" "$output" test_begin_subtest 'comparing existing to exported symbols' -nm -P $NOTMUCH_BUILDDIR/lib/libnotmuch.so | awk '$2 == "T" && $1 ~ "^notmuch" {print $1}' | sort | uniq > ACTUAL +readelf -Ws $NOTMUCH_BUILDDIR/lib/libnotmuch.so | \ + awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $8}' | sort | uniq > ACTUAL sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort | uniq > EXPORTED test_expect_equal_file EXPORTED ACTUAL -- 2.29.2