summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2022-10-24 21:52:51 +0000
committerDamien Miller <djm@cvs.openbsd.org>2022-10-24 21:52:51 +0000
commit16a0f494fafa03157d544f55512beec2943ddc3b (patch)
tree58aa72c5d19f76fe98cdacf4564dab8ea1eddba2 /regress
parentf37e714ac1005b791d356837aecd1da93b1102df (diff)
regress test for unmatched glob characters; fails before previous
commit but passes now. bz3488; prodded by dtucker@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/ssh/scp.sh34
1 files changed, 30 insertions, 4 deletions
diff --git a/regress/usr.bin/ssh/scp.sh b/regress/usr.bin/ssh/scp.sh
index f7fd1f7b8e3..6476b4acaa2 100644
--- a/regress/usr.bin/ssh/scp.sh
+++ b/regress/usr.bin/ssh/scp.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: scp.sh,v 1.14 2022/05/15 23:48:07 djm Exp $
+# $OpenBSD: scp.sh,v 1.15 2022/10/24 21:52:50 djm Exp $
# Placed in the Public Domain.
tid="scp"
@@ -8,6 +8,8 @@ tid="scp"
COPY2=${OBJ}/copy2
DIR=${COPY}.dd
DIR2=${COPY}.dd2
+COPY3=${OBJ}/copy.glob[123]
+DIR3=${COPY}.dd.glob[456]
SRC=`dirname ${SCRIPT}`
cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
@@ -15,9 +17,9 @@ chmod 755 ${OBJ}/scp-ssh-wrapper.scp
export SCP # used in scp-ssh-wrapper.scp
scpclean() {
- rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
- mkdir ${DIR} ${DIR2}
- chmod 755 ${DIR} ${DIR2}
+ rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} ${COPY3} ${DIR3}
+ mkdir ${DIR} ${DIR2} ${DIR3}
+ chmod 755 ${DIR} ${DIR2} ${DIR3}
}
for mode in scp sftp ; do
@@ -106,6 +108,30 @@ for mode in scp sftp ; do
$SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed"
diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+ verbose "$tag: unmatched glob file local->remote"
+ scpclean
+ $SCP $scpopts ${DATA} somehost:${COPY3} || fail "copy failed"
+ cmp ${DATA} ${COPY3} || fail "corrupted copy"
+
+ verbose "$tag: unmatched glob file remote->local"
+ # NB. no clean
+ $SCP $scpopts somehost:${COPY3} ${COPY2} || fail "copy failed"
+ cmp ${DATA} ${COPY2} || fail "corrupted copy"
+
+ verbose "$tag: unmatched glob dir recursive local->remote"
+ scpclean
+ rm -rf ${DIR3}
+ 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"
+
+ 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"
+
verbose "$tag: shell metacharacters"
scpclean
(cd ${DIR} && \