From 69d7fcb105738c33ad53326628c1c1d8d567b36a Mon Sep 17 00:00:00 2001 From: dtucker Date: Sun, 30 Oct 2022 18:42:07 +0000 Subject: [PATCH] Use variable for diff options instead of unconditionally specifying "-rN". This will make life easier in -portable where not all diff's understand -N. --- regress/usr.bin/ssh/scp.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/regress/usr.bin/ssh/scp.sh b/regress/usr.bin/ssh/scp.sh index 6476b4acaa2..10088a58c08 100644 --- a/regress/usr.bin/ssh/scp.sh +++ b/regress/usr.bin/ssh/scp.sh @@ -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 -- 2.20.1