lib/tst_mkfs: detect btrfs -f option correctly
PATCH 1/1 lib/tst_mkfs: detect btrfs -f option correctly
btrfs-progs commit 3f312d500b73 ("btrfs-progs: mkfs, align help strings") changed the usage text:
- -f --force
+ -f|--force
and tst_mkfs failed to add -f option to mkfs.btrfs.
Update the grep regex to match both old and new text, and now -f option is added to mkfs.btrfs.
[root@host ltp]# LTP_DEV_FS_TYPE=btrfs ./chown04
chown04 0 TINFO : Found free device '/dev/loop0' chown04 0 TINFO : Appending '-f' flag to mkfs.btrfs chown04 0 TINFO : Formatting /dev/loop0 with btrfs extra opts=''
...
Also use -q option of grep instead of redirecting output to /dev/null to avoid line over 80 column.
--- lib/tst_mkfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_mkfs.c +1 -1
@@ -45,7 +45,7 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,/* * The -f option was added to btrfs-progs v3.12 */ -if (!tst_system ("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null" )) { +if (!tst_system ("mkfs.btrfs 2>&1 | grep -q '\\-f[ |]'" )) {tst_resm (TINFO ,"Appending '-f' flag to mkfs.%s" , fs_type); argv[pos++] ="-f" ;
Signature · 1 line
2.4.3
PATCH 1/1 lib/tst_mkfs: detect btrfs -f option correctly
----- Original Message -----
Quoted 20 lines
From: "Eryu Guan" <[email protected]>
To: [email protected]
Sent: Thursday, 17 September, 2015 6:04:12 AM
Subject: [LTP] [PATCH]lib/tst_mkfs: detect btrfs -f option correctlybtrfs-progs commit
3f312d500b73("btrfs-progs: mkfs, align help strings") changed the usage text:- -f --force
+ -f|--forceand
tst_mkfsfailed to add -f option to mkfs.btrfs.Update the grep regex to match both old and new text, and now -f option is added to mkfs.btrfs.
[root@host ltp]# LTP_DEV_FS_TYPE=btrfs ./chown04
chown04 0 TINFO : Found free device '/dev/loop0' chown04 0 TINFO : Appending '-f' flag to mkfs.btrfs chown04 0 TINFO : Formatting /dev/loop0 with btrfs extra opts=''
Quoted 6 lines
...
Also use -q option of grep instead of redirecting output to
/dev/nullto avoid line over 80 column.Signed-off-by Eryu Guan <[email protected]>
Pushed, also thanks for referencing commit that introduced the change.
Regards,
Jan
Quoted 24 lines
--- lib/tst_mkfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/tst_mkfs.c +1
-2@@ -45,7 +45,7 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,/* * The -f option was added to btrfs-progs v3.12 */ -if (!tst_system ("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null" )) { +if (!tst_system ("mkfs.btrfs 2>&1 | grep -q '\\-f[ |]'" )) {tst_resm (TINFO ,"Appending '-f' flag to mkfs.%s" , fs_type); argv[pos++] ="-f" ; --2.4.3
--
Mailing list info: http://lists.linux.it/listinfo/ltp