Skip to contentSkip to conversation

nm01: fix regex matching internal symbols

PATCH New Jan Stancek 3 participants 3 messages May 8, 2020 – May 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nm01: fix regex matching internal symbols

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 ^ ^
---
 testcases/commands/nm/nm01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/commands/nm/nm01.sh +1 -1
index fd9d3d92262f..873126d20945 100755
@@ -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
Signature · 1 line
2.18.1
#1 lore raw

PATCH 1/1 nm01: fix regex matching internal symbols

Quoted 8 lines

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 ^ ^

Good catch, Jan.

Kind regards,
Petr

#2 lore raw

PATCH 1/1 nm01: fix regex matching internal symbols

Quoted 11 lines · Petr Vorel
Quoted 8 lines

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 ^ ^

Good catch, Jan.

Tested and pushed.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200511/d55a97d0/attachment.htm>