Skip to contentSkip to conversation

fs/acls/acl_test01: Fix shellcheck issue SC2069

PATCH New Yixin Zhang 3 participants 9 messages Apr 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 fs/acls/acl_test01: Fix shellcheck issue SC2069

error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/kernel/fs/acls/acl_test01 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/fs/acls/acl_test01 +1 -1
index 63683e707..c91eb5686 100755
@@ -78,7 +78,7 @@ do_setup()
 		tst_brkm TCONF "[ losetup.1 ] Failed to find an available loopback device -- is the required support compiled in your kernel?"
 	fi
 
-	if ! losetup $LOOP_DEV $TMP/tacl/blkext3 2>&1 > /dev/null; then
+	if ! losetup $LOOP_DEV $TMP/tacl/blkext3 > /dev/null 2>&1; then
 		echo ""
 		tst_brkm TCONF "[ losetup.2 ] Failed to setup the device."
 	fi
Signature · 1 line
2.14.1
#1 lore raw

PATCH 2/6 io/stress_floppy/stress_floppy: Fix shellcheck issue SC2069

error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/kernel/io/stress_floppy/stress_floppy | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/kernel/io/stress_floppy/stress_floppy +4 -4
index b269f5ffe..ff327dffb 100755
@@ -96,7 +96,7 @@ test_tar()
 		else
 			tst_resm TINFO "$the_file Tar read passed."
 		fi
-		diff $TCdat/dumpdir/$the_file $the_file 2>&1 >/dev/null
+		diff $TCdat/dumpdir/$the_file $the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL "Diff of the $the_file tar files failed!"
 			return
@@ -140,7 +140,7 @@ test_dump()
 
 	for the_file in 1K_file 10K_file 100K_file
 	do
-		diff dumpdir/$the_file /$TCdat/dumpdir/$the_file 2>&1 >/dev/null
+		diff dumpdir/$the_file /$TCdat/dumpdir/$the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL \
 				 "Diff of the $the_file backup files failed!"
@@ -180,7 +180,7 @@ test_cpio()
 		else
 			tst_resm TINFO "$the_file cpio read passed."
 		fi
-		diff $TCdat/dumpdir/$the_file $the_file 2>&1 >/dev/null
+		diff $TCdat/dumpdir/$the_file $the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL \
 				 "Diff of the $the_file cpio files failed!"
@@ -213,7 +213,7 @@ test_dd()
 		else
 			tst_resm TINFO "$the_file dd read passed."
 		fi
-		diff $TCdat/$the_file $the_file 2>&1 >/dev/null
+		diff $TCdat/$the_file $the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL "Diff of the $the_file dd files failed!"
 			return
Signature · 1 line
2.14.1
#2 lore raw

PATCH 3/6 numa/numa01.sh: Fix shellcheck issue SC2069

In reply to Yixin Zhang

error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/kernel/numa/numa01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/numa/numa01.sh +1 -1
index fd3b4be64..27a2f2f7c 100755
@@ -315,7 +315,7 @@ test8()
 	# Memory will be allocated using round robin on nodes.
 	Exp_incr=$(echo "$MB / $total_nodes" |bc)
 
-	numactl --interleave=all memhog -r1000000 1MB 2>&1 >ltp_numa_test8.log &
+	numactl --interleave=all memhog -r1000000 1MB >ltp_numa_test8.log 2>&1 &
 	pid=$!
 
 	local retries=20
Signature · 1 line
2.14.1
#3 lore raw

PATCH 4/6 network/nfs/fsx-linux/fsx.sh: Fix shellcheck issue SC2069

In reply to Yixin Zhang

error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/network/nfs/fsx-linux/fsx.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/nfs/fsx-linux/fsx.sh +1 -1
index 473ecb2da..84ad0e204 100755
@@ -33,7 +33,7 @@ do_test()
 {
 	ITERATIONS=${ITERATIONS:=50000}
 	tst_resm TINFO "starting fsx-linux -N $ITERATIONS..."
-	fsx-linux -N $ITERATIONS testfile 2>&1 > fsx-out.log
+	fsx-linux -N $ITERATIONS testfile > fsx-out.log 2>&1
 	if [ "$?" -ne 0 ]; then
 		tst_resm TFAIL "Errors have resulted from this test"
 		cat fsx-out.log
Signature · 1 line
2.14.1
#4 lore raw

PATCH 5/6 network/tcp_cmds/host/host01: Fix shellcheck issue SC2069

In reply to Yixin Zhang

error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/network/tcp_cmds/host/host01 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/network/tcp_cmds/host/host01 +2 -2
index fb59e35fa..1308870f7 100755
@@ -60,8 +60,8 @@ do_test()
     while [ $TST_COUNT -lt $NUMLOOPS ]; do
 
         if rhost_addr=$(host $RHOST); then
-            rhost_addr=$(echo "$rhost_addr" | awk -F, '{print $NF}') 2>&1 >/dev/null
-            if ! host $rhost_addr 2>&1 >/dev/null; then
+            rhost_addr=$(echo "$rhost_addr" | awk -F, '{print $NF}') >/dev/null 2>&1
+            if ! host $rhost_addr >/dev/null 2>&1; then
                 end_testcase "reverse lookup with host failed"
             fi
 
Signature · 1 line
2.14.1
#5 lore raw

PATCH 6/6 network/tcp_cmds/rcp/rcp01: Fix shellcheck issue SC2157/SC2069

In reply to Yixin Zhang

error: Argument to implicit -n is always true due to literal strings. [SC2157]
error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/network/tcp_cmds/rcp/rcp01 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/network/tcp_cmds/rcp/rcp01 +3 -3
index 1f54471cd..4eaeca175 100755
@@ -55,7 +55,7 @@ do_setup()
 
     exists awk rcp rsh sum
 
-    if ! rsh -n -l root $RHOST mkdir -p $TCtmp 2>&1 1>/dev/null; then
+    if ! rsh -n -l root $RHOST mkdir -p $TCtmp >/dev/null 2>&1; then
         end_testcase "Remote mkdir failed"
     fi
 
@@ -83,7 +83,7 @@ do_test()
         rsh -n -l root $RHOST "rm -f $TCtmp/$j"
         sleep $SLEEPTIME
 
-        if [ "$SUM1 = $SUM2" ]; then
+        if [ "$SUM1" = "$SUM2" ]; then
             tst_resm TINFO "rcp $TCdat/$j $RHOST:$TCtmp/$j successful"
         else
             end_testcase "FAILED: wrong sum in transfer to $RHOST"
@@ -96,7 +96,7 @@ do_test()
     for j in $FILES; do
 
         tst_resm TINFO "remote copying $RHOST:$TCdat/$j to $TCtmp/$j"
-        if ! rcp $RHOST:$TCdat/$j $TCtmp/$j 2>&1 1>/dev/null; then
+        if ! rcp $RHOST:$TCdat/$j $TCtmp/$j >/dev/null 2>&1; then
             tst_resm TFAIL "Failed to rcp file."; continue
         fi
 
Signature · 1 line
2.14.1
#6 lore raw

PATCH 1/6 fs/acls/acl_test01: Fix shellcheck issue SC2069

In reply to Yixin Zhang

Hi Yixin,

thanks for fixes, obviously correct whole patchset.

Kind regards,
Petr

Quoted 21 lines

error: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last. [SC2069]

---
 testcases/kernel/fs/acls/acl_test01 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/fs/acls/acl_test01 +1 -1
index 63683e707..c91eb5686 100755
@@ -78,7 +78,7 @@ do_setup()
 		tst_brkm TCONF "[ losetup.1 ] Failed to find an available loopback device -- is the required support compiled in your kernel?"
 	fi
 
-	if ! losetup $LOOP_DEV $TMP/tacl/blkext3 2>&1 > /dev/null; then
+	if ! losetup $LOOP_DEV $TMP/tacl/blkext3 > /dev/null 2>&1; then
 		echo ""
 		tst_brkm TCONF "[ losetup.2 ] Failed to setup the device."
 	fi
#7 lore raw

PATCH 1/6 fs/acls/acl_test01: Fix shellcheck issue SC2069

Hi!

Quoted 1 line

thanks for fixes, obviously correct whole patchset.

Looks correct to me as well, peter go ahead and apply this please.

Signature · 2 lines
Cyril Hrubis
[email protected]