Skip to contentSkip to conversation

fstests: fix error redirection in generic/256

PATCH In review Christoph Hellwig 2 participants 8 messages Nov 12, 2016 – Jan 10, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fstests: fix error redirection in generic/256

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

tests/generic/256 +2 -2
index cfbf790..2db22cd 100755
@@ -80,7 +80,7 @@ _fill_fs() {
 	# Creation of files or folders
 	# must not be done as root or
 	# reserved blocks will be consumed
-	_user_do "mkdir -p $dir &> /dev/null"
+	_user_do "mkdir -p $dir > /dev/null 2>&1"
 	if [ $? -ne 0 ] ; then
 		return 0
 	fi
@@ -93,7 +93,7 @@ _fill_fs() {
 	while [ $file_size -ge $block_size ]
 	do
 		bytes_written=0
-		_user_do "$XFS_IO_PROG -f -c \"pwrite 0 $file_size\" $dir/$file_count.bin &> /dev/null"
+		_user_do "$XFS_IO_PROG -f -c \"pwrite 0 $file_size\" $dir/$file_count.bin > /dev/null 2>&1"
 
 		if [ -f $dir/$file_count.bin ]
 		then
#1 lore raw
Quoted 3 lines · Christoph Hellwig

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

That's weird, from bash manpage, "&>" should be equivalent to "> ... 2>&1"

There're many other tests use "&>" as well, do you see such failures from other tests, such as generic/347?

Thanks,
Eryu

#2 lore raw
Quoted 9 lines · Eryu Guan
Quoted 3 lines · Christoph Hellwig

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

That's weird, from bash manpage, "&>" should be equivalent to "> ... 2>&1"

There're many other tests use "&>" as well, do you see such failures from other tests, such as generic/347?

generic/347 works fine for me, but I'm not sure I hit an error there which would have to be redirected.

#3 lore raw
In reply to Eryu Guan
Quoted 9 lines · Eryu Guan
Quoted 3 lines · Christoph Hellwig

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

That's weird, from bash manpage, "&>" should be equivalent to "> ... 2>&1"

There're many other tests use "&>" as well, do you see such failures from other tests, such as generic/347?

No. But 256 keeps on failing for me without this. Given that it's just a slightly more verbose syntax is there any reason not to just apply this patch for now?

#4 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Eryu Guan
Quoted 3 lines · Christoph Hellwig

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

Quoted 8 lines
Quoted 4 lines

That's weird, from bash manpage, "&>" should be equivalent to "> ... 2>&1"

There're many other tests use "&>" as well, do you see such failures from other tests, such as generic/347?

No. But 256 keeps on failing for me without this. Given that it's just a slightly more verbose syntax is there any reason not to just apply this patch for now?

Ok, I've queued it up for next update.

Thanks,
Eryu

#5 lore raw
Quoted 9 lines · Eryu Guan
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines · Eryu Guan
Quoted 3 lines · Christoph Hellwig

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

That's weird, from bash manpage, "&>" should be equivalent to "> ... 2>&1"

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

There're many other tests use "&>" as well, do you see such failures from other tests, such as generic/347?

No. But 256 keeps on failing for me without this. Given that it's just a slightly more verbose syntax is there any reason not to just apply this patch for now?

Ok, I've queued it up for next update.

I need to do some tweaks on this patch, generic/256 has been updated and patch didn't apply cleanly. I replaced all "&>" with "> ... 2>&1", though some of them won't generate any output.

Thanks,
Eryu

From: Christoph Hellwig <[email protected]>
Date: Sat, 12 Nov 2016 08:47:20 -0800
Subject: [PATCH] generic/256: fix error redirection

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

---
 tests/generic/256 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/generic/256 +4 -4
index 63f2d4f..5327c33 100755
@@ -81,10 +81,10 @@ _test_full_fs_punch()
                exit 1
        fi
 
-       rm -f $file_name &> /dev/null
+       rm -f $file_name > /dev/null 2>&1
 
        $XFS_IO_PROG -f -c "pwrite 0 $file_len" \
-               -c "fsync" $file_name &> /dev/null
+               -c "fsync" $file_name > /dev/null 2>&1
        chmod 666 $file_name
 
        # All files are created as a non root user to prevent reserved blocks
@@ -111,8 +111,8 @@ _test_full_fs_punch()
 }
 
 # Make a small file system to fill
-_scratch_unmount &> /dev/null
-_scratch_mkfs_sized $(( 1536 * 1024 * 1024 )) &> /dev/null
+_scratch_unmount > /dev/null 2>&1
+_scratch_mkfs_sized $(( 1536 * 1024 * 1024 )) > /dev/null 2>&1
 _scratch_mount
 # Test must be able to write files with non-root permissions
 chmod 777 $SCRATCH_MNT
#6 lore raw
In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Eryu Guan
Quoted 3 lines · Christoph Hellwig

Not sure if my shell is the problem here, but I need this explicit redirection to ignore the error output from mkdir and xfs_io, otherwise the test fails due to the error messages from these commands.

Quoted 8 lines
Quoted 4 lines

That's weird, from bash manpage, "&>" should be equivalent to "> ... 2>&1"

There're many other tests use "&>" as well, do you see such failures from other tests, such as generic/347?

No. But 256 keeps on failing for me without this. Given that it's just a slightly more verbose syntax is there any reason not to just apply this patch for now?

BTW, are you using Debian, or your default shell is not bash? If so, I guess you may hit this

https://www.spinics.net/lists/fstests/msg00686.html

Changing the default shell to bash for fsgqa user should do the work for you, I guess.

Thanks,
Eryu

#7 lore raw
Quoted 2 lines · Eryu Guan

BTW, are you using Debian, or your default shell is not bash? If so, I guess you may hit this

Yes, this is debian with dash.

Quoted 5 lines

https://www.spinics.net/lists/fstests/msg00686.html

Changing the default shell to bash for fsgqa user should do the work for you, I guess.

I don't think that's a good idea. But option 2) from Ted's list to use a specific shell for executions is a good idea. I'll look into that.