Skip to contentSkip to conversation

shared/032 is broken on Fedora

PATCH Superseded Boaz Harrosh 3 participants 7 messages Feb 11, 2015 VFS

lore
Share & tools
lore
#0 lore raw

This is not the proper patch just to show a working version for Fedora. But I think it now breaks the other ARCHs.

What happens is that the output of ${MKFS_PROG}.* is:
/usr/sbin/mkfs.bfs /usr/sbin/mkfs.btrfs /usr/sbin/mkfs.cramfs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext3 /usr/sbin/mkfs.ext4 ...

So in Fedora sbin has moved to /usr/... and therefor the sed below fails. My sed foo is not good enough. How to support both places for sbin?

Also why the "_supported_fs xfs btrfs"? So if all those other mkfs.* that are destructive to foreign filesystem, should the test not fail instead of skipped?
Maybe if the maintainers of all these filesystems day in and day out running xfstests and see shared/032 failing, they might decide to fix their evil ways. Instead of skipping the test and the said maintainer just ignores it?

Thanks
Boaz

---

tests/shared/032 +2 -3
index a410003..726e6b4 100755
@@ -37,8 +37,8 @@ rm -f $seqres.full
 . ./common/filter
 
 # real QA test starts here
-_supported_fs xfs btrfs
+# _supported_fs xfs btrfs
 _supported_os Linux
 
 _require_scratch_nocheck
 _require_no_large_scratch_dev
@@ -49,8 +49,7 @@ if [ "$FSTYP" == "btrfs" ]; then
 		_notrun "Installed mkfs.btrfs does not support -f option"
 fi
 
-echo "Silence is golden."
-for fs in `echo ${MKFS_PROG}.* | sed -e 's/.sbin.mkfs.//g'`
+for fs in `echo ${MKFS_PROG}.* | sed -e 's/.usr\/sbin.mkfs.//g'`
 do
 	preop=""	# for special input needs
 	preargs=""	# for any special pre-device options

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 7 lines · Boaz Harrosh

This is not the proper patch just to show a working version for Fedora. But I think it now breaks the other ARCHs.

What happens is that the output of ${MKFS_PROG}.* is:
/usr/sbin/mkfs.bfs /usr/sbin/mkfs.btrfs /usr/sbin/mkfs.cramfs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext3 /usr/sbin/mkfs.ext4 ...

Quoted 9 lines

So in Fedora sbin has moved to /usr/... and therefor the sed below fails. My sed foo is not good enough. How to support both places for sbin?

Also why the "_supported_fs xfs btrfs"? So if all those other mkfs.* that are destructive to foreign filesystem, should the test not fail instead of skipped?
Maybe if the maintainers of all these filesystems day in and day out running xfstests and see shared/032 failing, they might decide to fix their evil ways. Instead of skipping the test and the said maintainer just ignores it?

I was thinking about fixing this test, say for ext4. And came to the conclusion.

Should I not hack and fix the mount command? This problem is common to all filesystems. Why do we want to force all mkfs.* maintainers to link with some global library that checks all registered FSs and see existence of an FS, something like blkid.

Why not link that library to the driver "mount" command, and not call the mkfs.$type in question at all unless say --force flag is supplied.

This way I fix this test for all FSs past and future. (Should I send a patch?)

Thanks
Boaz

#2 lore raw
In reply to Boaz Harrosh

(cc: fstests list)

Quoted 9 lines · Boaz Harrosh

This is not the proper patch just to show a working version for Fedora. But I think it now breaks the other ARCHs.

What happens is that the output of ${MKFS_PROG}.* is:
/usr/sbin/mkfs.bfs /usr/sbin/mkfs.btrfs /usr/sbin/mkfs.cramfs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext3 /usr/sbin/mkfs.ext4 ...

So in Fedora sbin has moved to /usr/... and therefor the sed below fails. My sed foo is not good enough. How to support both places for sbin?

All we really want is the mkfs filesystem type, i.e. the ${FS} in mkfs.${FS}

So

sed -e 's/.*mkfs.//g'

should work,

awk -F . '{print $NF}' would work too

$ cat mkfses 
/usr/sbin/mkfs.ext4
/sbin/mkfs.ext4
$ cat mkfses | awk -F . '{print $NF}'
ext4
ext4
$ cat mkfses | sed -e 's/.*mkfs.//g'
ext4
ext4
Quoted 2 lines

Also why the "_supported_fs xfs btrfs"? So if all those other mkfs.* that are destructive to foreign filesystem, should the test not fail instead of skipped?

mkfs.xfs & mkfs.btrfs are the only filesystems I know of which check for an existing format before proceeding, so they are the only ones tested. Any other fs is skipped, because they are not designed to do what this test is... testing for.

Quoted 3 lines

Maybe if the maintainers of all these filesystems day in and day out running xfstests and see shared/032 failing, they might decide to fix their evil ways. Instead of skipping the test and the said maintainer just ignores it?

I think it's just a design decision. There's no actual requirement to warn about overwriting a format, so not doing so is not a failure or a bug, IMHO.

-Eric

Quoted 34 lines

Thanks
Boaz

---

tests/shared/032 +2 -3
index a410003..726e6b4 100755
@@ -37,8 +37,8 @@ rm -f $seqres.full
 . ./common/filter
 
 # real QA test starts here
-_supported_fs xfs btrfs
+# _supported_fs xfs btrfs
 _supported_os Linux
 
 _require_scratch_nocheck
 _require_no_large_scratch_dev
@@ -49,8 +49,7 @@ if [ "$FSTYP" == "btrfs" ]; then
 		_notrun "Installed mkfs.btrfs does not support -f option"
 fi
 
-echo "Silence is golden."
-for fs in `echo ${MKFS_PROG}.* | sed -e 's/.sbin.mkfs.//g'`
+for fs in `echo ${MKFS_PROG}.* | sed -e 's/.usr\/sbin.mkfs.//g'`
 do
 	preop=""	# for special input needs
 	preargs=""	# for any special pre-device options

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 10 lines · Eric Sandeen

(cc: fstests list)

Quoted 7 lines · Boaz Harrosh

This is not the proper patch just to show a working version for Fedora. But I think it now breaks the other ARCHs.

What happens is that the output of ${MKFS_PROG}.* is:
/usr/sbin/mkfs.bfs /usr/sbin/mkfs.btrfs /usr/sbin/mkfs.cramfs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext3 /usr/sbin/mkfs.ext4 ...

Quoted 8 lines
Quoted 2 lines

So in Fedora sbin has moved to /usr/... and therefor the sed below fails. My sed foo is not good enough. How to support both places for sbin?

All we really want is the mkfs filesystem type, i.e. the ${FS} in mkfs.${FS}

So

sed -e 's/.*mkfs.//g'

Wait, no, I misunderstood what it was working on ;) Hang on ...

-Eric

#4 lore raw
In reply to Eric Sandeen
Quoted 42 lines · Eric Sandeen

Date: Wed, 11 Feb 2015 10:50:53 -0600
From: Eric Sandeen <[email protected]>
To: Boaz Harrosh <[email protected]>, Dave Chinner <[email protected]>,
[email protected], linux-fsdevel <[email protected]>, [email protected]
Subject: Re: shared/032 is broken on Fedora

(cc: fstests list)

Quoted 9 lines · Boaz Harrosh

This is not the proper patch just to show a working version for Fedora. But I think it now breaks the other ARCHs.

What happens is that the output of ${MKFS_PROG}.* is:
/usr/sbin/mkfs.bfs /usr/sbin/mkfs.btrfs /usr/sbin/mkfs.cramfs /usr/sbin/mkfs.ext2 /usr/sbin/mkfs.ext3 /usr/sbin/mkfs.ext4 ...

So in Fedora sbin has moved to /usr/... and therefor the sed below fails. My sed foo is not good enough. How to support both places for sbin?

All we really want is the mkfs filesystem type, i.e. the ${FS} in mkfs.${FS}

So

sed -e 's/.*mkfs.//g'

should work,

awk -F . '{print $NF}' would work too

$ cat mkfses 
/usr/sbin/mkfs.ext4
/sbin/mkfs.ext4
$ cat mkfses | awk -F . '{print $NF}'
ext4
ext4
$ cat mkfses | sed -e 's/.*mkfs.//g'
ext4
ext4
Quoted 7 lines
Quoted 2 lines

Also why the "_supported_fs xfs btrfs"? So if all those other mkfs.* that are destructive to foreign filesystem, should the test not fail instead of skipped?

mkfs.xfs & mkfs.btrfs are the only filesystems I know of which check for an existing format before proceeding, so they are the only ones tested. Any other fs is skipped, because they are not designed to do what this test is... testing for.

First of all it's not only about other file system, but any common signatures which the test is ignoring.

Moreover ext4 is looking for existing signatures, but will not complain in case it's run without the console attached to it so it does not break existing scripts.

Quoted 7 lines
Quoted 4 lines

Maybe if the maintainers of all these filesystems day in and day out running xfstests and see shared/032 failing, they might decide to fix their evil ways. Instead of skipping the test and the said maintainer just ignores it?

I think it's just a design decision. There's no actual requirement to warn about overwriting a format, so not doing so is not a failure or a bug, IMHO.

Exactly, also as I said above mkfs.extN is checking for signatures, but at the same time we can not break scripts people has been using for lifetime.

-Lukas

Quoted 43 lines

-Eric

Quoted 29 lines

Thanks
Boaz

---

tests/shared/032 +2 -3
index a410003..726e6b4 100755
@@ -37,8 +37,8 @@ rm -f $seqres.full
 . ./common/filter
 
 # real QA test starts here
-_supported_fs xfs btrfs
+# _supported_fs xfs btrfs
 _supported_os Linux
 
 _require_scratch_nocheck
 _require_no_large_scratch_dev
@@ -49,8 +49,7 @@ if [ "$FSTYP" == "btrfs" ]; then
 		_notrun "Installed mkfs.btrfs does not support -f option"
 fi
 
-echo "Silence is golden."
-for fs in `echo ${MKFS_PROG}.* | sed -e 's/.sbin.mkfs.//g'`
+for fs in `echo ${MKFS_PROG}.* | sed -e 's/.usr\/sbin.mkfs.//g'`
 do
 	preop=""	# for special input needs
 	preargs=""	# for any special pre-device options
Quoted 5 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH 1/1 fstests: shared/032 handle mkfs.* in either /sbin or /usr/sbin

In reply to Boaz Harrosh

mkfs programs may live in either /sbin or /usr/sbin, and the current regexp in this test only catches the latter, and so the test wont' run properly for the former.

Fix this by iterating over each full path to every mkfs.${FS} program in ${MKFS.PROG}.*, and extracting the ${FS} part.

We found the paths in the first place by using a wildcard with the found ${MKFS_PROG}, so we can use that string to filter out everything except the wildcard match at the end, which is the fs name we are looking for.

---

tests/shared/032 +2 -1
index a410003..8ffb54b 100755
@@ -50,8 +50,9 @@ if [ "$FSTYP" == "btrfs" ]; then
 fi
 
 echo "Silence is golden."
-for fs in `echo ${MKFS_PROG}.* | sed -e 's/.sbin.mkfs.//g'`
+for mkfs in `echo ${MKFS_PROG}.*`
 do
+	fs=`echo $mkfs | sed -e s:${MKFS_PROG}.::`
 	preop=""	# for special input needs
 	preargs=""	# for any special pre-device options
 	postargs=""	# for any special post-device options
#6 lore raw

PATCH v2 1/1 fstests: shared/032 handle mkfs.* in either /sbin or /usr/sbin

mkfs executables may live in either /sbin or /usr/sbin, and the current regexp in this test only catches the former, and so the test won't run properly with the latter.

Fix this by filtering out whatever was found as ${MKFS_PROG}, rather than a hard-coded /sbin/mkfs path.

Because the list was generated by using a wildcard with ${MKFS_PROG}.* this will always be the correct filter.

---

V2: KISS

tests/shared/032 +1 -1
index a410003..3b06382 100755
@@ -50,7 +50,7 @@ if [ "$FSTYP" == "btrfs" ]; then
 fi
 
 echo "Silence is golden."
-for fs in `echo ${MKFS_PROG}.* | sed -e 's/.sbin.mkfs.//g'`
+for fs in `echo ${MKFS_PROG}.* | sed -e "s:${MKFS_PROG}.::g"`
 do
 	preop=""	# for special input needs
 	preargs=""	# for any special pre-device options