Use variable for diff options instead of unconditionally specifying "-rN".
authordtucker <dtucker@openbsd.org>
Sun, 30 Oct 2022 18:42:07 +0000 (18:42 +0000)
committerdtucker <dtucker@openbsd.org>
Sun, 30 Oct 2022 18:42:07 +0000 (18:42 +0000)
This will make life easier in -portable where not all diff's understand -N.

regress/usr.bin/ssh/scp.sh

index 6476b4a..10088a5 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: scp.sh,v 1.15 2022/10/24 21:52:50 djm Exp $
+#      $OpenBSD: scp.sh,v 1.16 2022/10/30 18:42:07 dtucker Exp $
 #      Placed in the Public Domain.
 
 tid="scp"
@@ -10,6 +10,7 @@ DIR=${COPY}.dd
 DIR2=${COPY}.dd2
 COPY3=${OBJ}/copy.glob[123]
 DIR3=${COPY}.dd.glob[456]
+DIFFOPT="-rN"
 
 SRC=`dirname ${SCRIPT}`
 cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
@@ -92,21 +93,21 @@ for mode in scp sftp ; do
        rm -rf ${DIR2}
        cp ${DATA} ${DIR}/copy
        $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed"
-       diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+       diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
 
        verbose "$tag: recursive local dir to local dir"
        scpclean
        rm -rf ${DIR2}
        cp ${DATA} ${DIR}/copy
        $SCP $scpopts -r ${DIR} ${DIR2} || fail "copy failed"
-       diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+       diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
 
        verbose "$tag: recursive remote dir to local dir"
        scpclean
        rm -rf ${DIR2}
        cp ${DATA} ${DIR}/copy
        $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed"
-       diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+       diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
 
        verbose "$tag: unmatched glob file local->remote"
        scpclean
@@ -124,13 +125,13 @@ for mode in scp sftp ; do
        cp ${DATA} ${DIR}/copy
        cp ${DATA} ${DIR}/copy.glob[1234]
        $SCP $scpopts -r ${DIR} somehost:${DIR3} || fail "copy failed"
-       diff -rN ${DIR} ${DIR3} || fail "corrupted copy"
+       diff ${DIFFOPT} ${DIR} ${DIR3} || fail "corrupted copy"
 
        verbose "$tag: unmatched glob dir recursive remote->local"
        # NB. no clean
        rm -rf ${DIR2}
        $SCP $scpopts -r somehost:${DIR3} ${DIR2} || fail "copy failed"
-       diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+       diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
 
        verbose "$tag: shell metacharacters"
        scpclean
@@ -148,7 +149,7 @@ for mode in scp sftp ; do
                chmod 660 ${DIR2}/copy
                $SUDO chown root ${DIR2}/copy
                $SCP -p $scpopts somehost:${DIR}/\* ${DIR2} >/dev/null 2>&1
-               $SUDO diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+               $SUDO diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
                $SUDO rm ${DIR2}/copy
        fi