update duplicateargs to copy args properly (#617)

* update duplicateargs to copy args properly

* add bash test for scp printf specifiers

* retrigger appveyor
This commit is contained in:
Tess Gauthier 2022-11-01 15:02:08 -04:00 committed by GitHub
parent 0e5150318b
commit 6dbc6f637f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

2
misc.c
View File

@ -1149,7 +1149,7 @@ duplicateargs(arglist *dest, arglist *source)
if (source->list != NULL) {
for (int i = 0; i < source->num; i++) {
addargs(dest, source->list[i]);
addargs(dest, "%s", source->list[i]);
}
}
}

View File

@ -105,6 +105,16 @@ for mode in scp sftp ; do
$SCP "${scpopts[@]}" *metachar* ${DIR2} 2>&1 2>/dev/null; \
[ ! -f metachartest ] ) || fail "shell metacharacters"
if test $mode = scp ; then
verbose "$tag: input args & printf check"
scpclean
cp ${DATA} ${COPY}
$SCP "${scpopts[@]}" -vvv -o '"%h %p"' ${COPY} somehost:${DIR} 2>&1 | tee scp_printf_test.txt
# relies on debug log statement, specifically from "debug3: spawning..."
[[ " $( cat "scp_printf_test.txt" ) " =~ "%h %p" ]] || fail "input args & printf check failed"
rm -f scp_printf_test.txt
fi
if [ ! -z "$SUDO" ]; then
verbose "$tag: skipped file after scp -p with failed chown+utimes"
scpclean