diff mbox series

generic/398: filter out extra string from newer mv

Message ID 20181109041913.31032-1-xzhou@redhat.com (mailing list archive)
State New, archived
Headers show
Series generic/398: filter out extra string from newer mv | expand

Commit Message

Murphy Zhou Nov. 9, 2018, 4:19 a.m. UTC
mv command produces a leading string "renamed" from some time.
This breaks generic/398. Adding a _filter_mv to filter it out.
Tested this patch on Fedora 28.

sh-4.2$ rpm -qf /usr/bin/mv
coreutils-8.22-23.el7.x86_64
sh-4.2$ mv -v 1 2
‘1’ -> ‘2’
sh-4.2$

h-4.4# rpm -qf /usr/bin/mv
coreutils-8.30-5.el8.x86_64
sh-4.4# mv -v 1 2
renamed '1' -> '2'
sh-4.4#

igned-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
---
 common/filter     | 6 ++++++
 tests/generic/398 | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/common/filter b/common/filter
index e87740dd..ed082d24 100644
--- a/common/filter
+++ b/common/filter
@@ -504,6 +504,12 @@  _filter_mknod()
 	sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/"
 }
 
+# Remove leading "rename" in "mv -v" output
+_filter_mv()
+{
+	sed -e "s/^renamed //"
+}
+
 _filter_lostfound()
 {
 	sed -e '/^lost+found$/d'
diff --git a/tests/generic/398 b/tests/generic/398
index 58b54af0..efb8348c 100755
--- a/tests/generic/398
+++ b/tests/generic/398
@@ -95,7 +95,7 @@  ln -v $edir1/efile1 $udir/efile1 |& _filter_scratch
 rm $udir/efile1 # undo
 
 echo -e "\n*** Rename encrypted => unencrypted ***"
-mv -v $edir1/efile1 $udir/efile1 |& _filter_scratch
+mv -v $edir1/efile1 $udir/efile1 |& _filter_scratch |& _filter_mv
 mv $udir/efile1 $edir1/efile1 # undo
 
 
@@ -119,9 +119,9 @@  src/renameat2 -x $edir1/efile1 $udir/ufile |& _filter_scratch
 
 echo -e "\n\n*** Special file tests ***"
 mkfifo $edir1/fifo
-mv -v $edir1/fifo $edir2/fifo | _filter_scratch
-mv -v $edir2/fifo $udir/fifo | _filter_scratch
-mv -v $udir/fifo $edir1/fifo | _filter_scratch
+mv -v $edir1/fifo $edir2/fifo | _filter_scratch |& _filter_mv
+mv -v $edir2/fifo $udir/fifo | _filter_scratch |& _filter_mv
+mv -v $udir/fifo $edir1/fifo | _filter_scratch |& _filter_mv
 mkfifo $udir/fifo
 src/renameat2 -x $udir/fifo $edir1/fifo
 ln -v $edir1/fifo $edir2/fifo | _filter_scratch