Skip to contentSkip to conversation

xfstests: fix _mount_ops_filter() to support $TEST_DIR containing -o

PATCH In review Koen De Wit 3 participants 3 messages Jul 2, 2013 – Aug 15, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fix _mount_ops_filter() to support $TEST_DIR containing -o

If multiple mount options are given with multiple -o parameters, _mount_ops_filter concatenates them by replacing all -o's with a comma (except for the first -o).

If $TEST_DIR contains "-o" (e.g. /mnt/test-os/) you get errors like this:

   # ./check generic/002
     mount: mount point /mnt/test,s/ does not exist
     common/rc: retrying test device mount with external set
     mount: mount point /mnt/test,s/ does not exist
     common/rc: could not mount /dev/sdc3 on /mnt/test-os/

Fix it by only replacing -o's that are preceded by at least one space.

---
 common/rc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/rc +1 -1
index fe6bbfc..2a3c040 100644
@@ -260,7 +260,7 @@ _mount_ops_filter()
     # the sed script replaces all -o's (except the first) with a comma
     # not required for linux, but won't hurt
     
-    echo $params | sed -e 's/[[:space:]]*-o[[:space:]]*/UnIqUe/1; s/[[:space:]]*-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
+    echo $params | sed -e 's/[[:space:]]\+-o[[:space:]]*/UnIqUe/1; s/[[:space:]]\+-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
         | sed -e 's/dmapi/dmi/' \
         | $PERL_PROG -ne "s#mtpt=[^,|^\n|^\s]*#mtpt=$FS_ESCAPED\1\2#; print;"
 
Signature · 6 lines
1.7.2.5

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Koen De Wit

If multiple mount options are given with multiple -o parameters, _mount_ops_filter concatenates them by replacing all -o's with a comma (except for the first -o).

If $TEST_DIR contains "-o" (e.g. /mnt/test-os/) you get errors like this:

   # ./check generic/002
     mount: mount point /mnt/test,s/ does not exist
     common/rc: retrying test device mount with external set
     mount: mount point /mnt/test,s/ does not exist
     common/rc: could not mount /dev/sdc3 on /mnt/test-os/
Quoted 3 lines

Fix it by only replacing -o's that are preceded by at least one space.

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

#2 lore raw
In reply to Koen De Wit
Quoted 25 lines · Koen De Wit

If multiple mount options are given with multiple -o parameters, _mount_ops_filter concatenates them by replacing all -o's with a comma (except for the first -o).

If $TEST_DIR contains "-o" (e.g. /mnt/test-os/) you get errors like this:

    # ./check generic/002
      mount: mount point /mnt/test,s/ does not exist
      common/rc: retrying test device mount with external set
      mount: mount point /mnt/test,s/ does not exist
      common/rc: could not mount /dev/sdc3 on /mnt/test-os/

Fix it by only replacing -o's that are preceded by at least one space.

---
  common/rc |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
common/rc +0 -0
index fe6bbfc..2a3c040 100644

common/rc _mount_ops_filter() · line 266

Quoted 8 lines
common/rc +1 -1
@@ -260,7 +260,7 @@ _mount_ops_filter()
      # the sed script replaces all -o's (except the first) with a comma
      # not required for linux, but won't hurt
 
-    echo $params | sed -e 's/[[:space:]]*-o[[:space:]]*/UnIqUe/1; s/[[:space:]]*-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
+    echo $params | sed -e 's/[[:space:]]\+-o[[:space:]]*/UnIqUe/1; s/[[:space:]]\+-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
          | sed -e 's/dmapi/dmi/' \
          | $PERL_PROG -ne "s#mtpt=[^,|^\n|^\s]*#mtpt=$FS_ESCAPED\1\2#; print;"
 

Sorry Koen I did not see this had been reviewed, thanks for the patch. It has been committed.

--Rich

commit 74357dea4a975d2942163a2df7a527b57c46650b

Author: Koen De Wit <[email protected]>
Date:   Tue Jul 2 21:44:57 2013 +0000

xfstests: fix _mount_ops_filter() to support $TEST_DIR containing -o

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