[LTP] [PATCH] nm01: fix regex matching internal symbols

Jan Stancek jstancek@redhat.com
Fri May 8 14:58:32 CEST 2020


Current regex matches any word character followed by space
and one of letters "abdft". So it doesn't match only symbol type,
but can match for example value and size:
  $ grep "\w [a,b,d,f,t]" nm.out
  __libc_csu_init T 10000640 b4
                   matches ^ ^

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/commands/nm/nm01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/commands/nm/nm01.sh b/testcases/commands/nm/nm01.sh
index fd9d3d92262f..873126d20945 100755
--- a/testcases/commands/nm/nm01.sh
+++ b/testcases/commands/nm/nm01.sh
@@ -47,7 +47,7 @@ test2()
 {
 	EXPECT_PASS $NM -f posix -g $TST_DATAROOT/f1 \> nm.out
 
-	if grep -q "\w [a,b,d,f,t]" nm.out; then
+	if grep -q "^[^ ]\+ [abdft]" nm.out; then
 		tst_res TFAIL "Got internal symbols with -g"
 		cat nm.out
 	else
-- 
2.18.1



More information about the ltp mailing list