From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KHokAggQ1V9fQAAA0tVLHw (envelope-from ) for ; Sat, 12 Dec 2020 18:46:32 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id QK+GOQcQ1V+PFQAAB5/wlQ (envelope-from ) for ; Sat, 12 Dec 2020 18:46:31 +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 6044D940366 for ; Sat, 12 Dec 2020 18:46:31 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 251C028539; Sat, 12 Dec 2020 13:46:22 -0500 (EST) Received: from lahtoruutu.iki.fi (unknown [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 986031F9D8 for ; Sat, 12 Dec 2020 13:46:19 -0500 (EST) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 632F41B00196; Sat, 12 Dec 2020 20:46:04 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1607798764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p71kPg1BFydGM70DgJKR44VoQSgzDv7IRBasNqEiT0U=; b=pi7cReWIHBkCu+921ART8dnICWA3m7FBtbmai6umLvBjzXJ0oZLQmgY67VGc9qoQi78Dzn ba0Hsooz0Q2o8owdKVetKdU5e5KDVmsq37wgmTBbkWSJ0U/nDXyMQXmhuSoyRuWDx2A19m S66AAZCLQLv1bd2tWI/n1oy9q97vUewi/ohOGyjyNlf4EZsFFW99UV7n61l++LJZ9HmS/V MFgXbkMF2FualOFnvHKP+x+Mr6ZttcOEzrfmLC0khdSfDiEq1F/W+EXCCQYn1suYdNSP8/ YXufn+rio5cFmUgy03NeYZp6Ks4C6NCcftLOOALZnb03AkrsTwK7RO3DFM62Rg== From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Cc: David Bremner Subject: Re: [PATCH] test/T360-symbol-hiding: use readelf in place of nm In-Reply-To: <20201211171706.2780993-1-david@tethera.net> References: <20201211171706.2780993-1-david@tethera.net> User-Agent: Notmuch/0.31.2+29~gf517255 (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1607798764; a=rsa-sha256; cv=none; b=wOWCTFB7qIcb4qd79T0xmUWcYYij7oYCoNfSJe06qQt0u4ZMkcz8IYIxjT8MLPzQWioC7Q 4yalMUXQNC9hAlaOh2oqBiV0F4YYHQTVdapE8m+kLYr8LGbnQYChgMW/Wn6ZZFMNcIHfUV 1NmnCdeDIjY8hMkP0jr6xBeWl+wLIsT9ypV/ISCKkA+VJRBkLigoLnd7Ctzk52dXidB2Qw 4k/+gKOqbUH2AeDkfA/fqf7drIzSrPL8n6cCHC8nSNkjrEsZT8m8wRezd5GvyfWI+WLZAE HZIDkybZwjgWDrGsSXByoFGoO7GBi6dc8yMkKBvIs7WWH8NpBh/YA0Pn/3JogA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1607798764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p71kPg1BFydGM70DgJKR44VoQSgzDv7IRBasNqEiT0U=; b=CW+g9eoda6XXEX/P5QnO9DicOS2mqXxmsSaZs9eZBBCS88CU8HJihYDwhmTP0+90/tNwuT rdYDaiGyqBG+chmJTNIZY6xWZwKbaLx0/ZHnk8jS2XgmC5nsbHBfreZAis23J6ojzb//9c NkGAV8D59umup3LpFboyXYnT4iWXrMwDChBHVhRdnCKgPx2VNrroWai0/VE2VixZuru5wV SSYjOJ5yGyAZssLFExiJEAh3ofP8xuiKHSgAKv8YJl2nuwh6aoHh0C/t4Ctx4VubsSBiU9 2HME37RyVEgrTLYkCxQ3MGsHbPR4xKQqkhdpN/jJPbT4WjnYJi6Uua5cAjtmOA== Message-ID-Hash: RHVYYPX4H5L5TYSRVWP7IVK7NNCEI4QB X-Message-ID-Hash: RHVYYPX4H5L5TYSRVWP7IVK7NNCEI4QB X-MailFrom: tomi.ollila@iki.fi 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: 2.44 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=iki.fi header.s=lahtoruutu header.b=pi7cReWI; arc=reject (signature check failed: fail, {[1] = sig:iki.fi:reject}); 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: 6044D940366 X-Spam-Score: 2.44 X-Migadu-Scanner: scn1.migadu.com X-TUID: x3id/o1+3sr+ On Fri, Dec 11 2020, David Bremner wrote: > 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. Looks good. I use this opportunity to mention that `sort | uniq` can be replaced with `sort -u` :D (also) s/$4 == "FUNC"/$4 == "FUNC"/; i.e. remove one extra space Tomi > --- > 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