Skip to contentSkip to conversation

xfs/021: filter out detailed array element info from xfs_db

PATCH Superseded Eryu Guan 2 participants 3 messages Nov 4, 2016 – Nov 6, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 xfs/021: filter out detailed array element info from xfs_db

Starting from xfsprogs commit 384283555871 ("xfs_db: print one array element per line"), xfs_db prints one array element per line. This breaks the filter in xfs/021, which now fails as:

hdr.freemap[0-2] = [base,size] [FREEMAP..]
+0:[104,1892]
+1:[0,0]
+2:[0,0]
entries[0-2] = [hashval,nameidx,incomplete,root,local] [ENTRIES..]

So we have extra lines that need to be filtered out,

---
 tests/xfs/021 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/021 +1 -1
index 67a4346..b99eff7 100755
@@ -151,7 +151,7 @@ s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/;
 s/^(hdr.firstused =) (\d+)/\1 FIRSTUSED/;
 s/^(hdr.freemap\[0-2] = \[base,size]).*/\1 [FREEMAP..]/;
 s/^(entries\[0-2] = \[hashval,nameidx,incomplete,root,local]).*/\1 [ENTRIES..]/;
-	print;'
+	print unless /^[0-9]/;'
 
 echo "*** done"
 exit
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Eryu Guan

Starting from xfsprogs commit 384283555871 ("xfs_db: print one array element per line"), xfs_db prints one array element per line. This breaks the filter in xfs/021, which now fails as:

hdr.freemap[0-2] = [base,size] [FREEMAP..]
+0:[104,1892]
+1:[0,0]
+2:[0,0]

Hmm... So [FREEMAP..] was printed in one line, but now every records will take one line.

Quoted 14 lines

entries[0-2] = [hashval,nameidx,incomplete,root,local] [ENTRIES..]

So we have extra lines that need to be filtered out,

---
 tests/xfs/021 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/021 +0 -0
index 67a4346..b99eff7 100755

tests/xfs/021 s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/; · line 152

Quoted 2 lines
tests/xfs/021 +0 -0
@@ -151,7 +151,7 @@ s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/;
 s/^(hdr.firstused =) (\d+)/\1 FIRSTUSED/;
 s/^(hdr.freemap\[0-2] = \[base,size]).*/\1 [FREEMAP..]/;

So this line script trys to deal with all freemap things, but now it can't deal with multi-lines output. (Same as below)

tests/xfs/021 s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/; · line 154

Quoted 3 lines
tests/xfs/021 +1 -1
 s/^(entries\[0-2] = \[hashval,nameidx,incomplete,root,local]).*/\1 [ENTRIES..]/;
-	print;'
+	print unless /^[0-9]/;'

Filter all lines start with a digit(0~9). It works, but I can't be sure that if it'll affect others useful error output, maybe more accurate expression will be better?

Thanks,
Zorro

Quoted 10 lines
tests/xfs/021 +0 -0
 echo "*** done"
 exit
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw
Quoted 33 lines · Zorro Lang
Quoted 8 lines · Eryu Guan

Starting from xfsprogs commit 384283555871 ("xfs_db: print one array element per line"), xfs_db prints one array element per line. This breaks the filter in xfs/021, which now fails as:

hdr.freemap[0-2] = [base,size] [FREEMAP..]
+0:[104,1892]
+1:[0,0]
+2:[0,0]

Hmm... So [FREEMAP..] was printed in one line, but now every records will take one line.

Quoted 14 lines

entries[0-2] = [hashval,nameidx,incomplete,root,local] [ENTRIES..]

So we have extra lines that need to be filtered out,

---
 tests/xfs/021 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/021 +0 -0
index 67a4346..b99eff7 100755

tests/xfs/021 s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/; · line 152

Quoted 2 lines
tests/xfs/021 +0 -0
@@ -151,7 +151,7 @@ s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/;
 s/^(hdr.firstused =) (\d+)/\1 FIRSTUSED/;
 s/^(hdr.freemap\[0-2] = \[base,size]).*/\1 [FREEMAP..]/;

So this line script trys to deal with all freemap things, but now it can't deal with multi-lines output. (Same as below)

Quoted 7 lines

tests/xfs/021 s/^(hdr.info.magic =) 0x3bee/\1 0xfbee/; · line 154

Quoted 3 lines
tests/xfs/021 +1 -1
 s/^(entries\[0-2] = \[hashval,nameidx,incomplete,root,local]).*/\1 [ENTRIES..]/;
-	print;'
+	print unless /^[0-9]/;'

Filter all lines start with a digit(0~9). It works, but I can't be sure that if it'll affect others useful error output, maybe more accurate expression will be better?

I think it's fine, we only filter stdout here and if there's any error it should go to stderr and we can still catch it.

Thanks,
Eryu