Hey all, I know this is a corner case but it turns out that the scp3.sh regression test fails if you don't already have scp installed in your path. I know a lot of people won't run into that but it's sort of a chicken or egg problem. The following patch checks to see if it's in the path or if it's only in the openssh-portable build directory. I have a strong suspicion that this test will fail in debuild or rpmbuild environments but it will fail in a way that the test is run. Chris diff --git a/regress/scp3.sh b/regress/scp3.sh index f71b15677..7555e4e4d 100644 --- a/regress/scp3.sh +++ b/regress/scp3.sh @@ -14,6 +14,15 @@ cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp chmod 755 ${OBJ}/scp-ssh-wrapper.scp export SCP # used in scp-ssh-wrapper.scp + +scp_path=$(which -a scp) +if [ -x "$scp_path" ] || [ $scp_path == "*openssh-portable*" ]; then + echo "*****************" + echo "scp not found in path. Skipping scp3 test." + echo "*****************" + exit +fi + scpclean() { rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} mkdir ${DIR} ${DIR2}
Darren Tucker
2022-Jul-23 04:33 UTC
scp3.sh regression test fails if scp not already installed
Hi. On Sat, 23 Jul 2022 at 05:34, rapier <rapier at psc.edu> wrote: [...]> The following patch checks to see if it's in the path or if it's only in > the openssh-portable build directory. I have a strong suspicion that > this test will fail in debuild or rpmbuild environments but it will fail > in a way that the test is run.Thanks for the report. I am fine with doing this in principle but there's a few problems with the specifics of this patch:> +scp_path=$(which -a scp) > +if [ -x "$scp_path" ]"which" is not POSIX, its semantics vary wildly and not all of them have a "-a". This test is probably also going to do the wrong thing in the case where there are two scps on the path. There's a "have_prog" function in test-exec.sh in portable for this specific purpose. Also, the $() subshell syntax is not in the earlier POSIX standards and doesn't work on older shells. Solaris is particularly annoying in this regard: /bin/sh on Solaris <=10 doesn't understand $() while on Solaris 11 it's ksh in disguise and does but will complain about backticks (under at least some conditions).> || [ $scp_path == "*openssh-portable*" ]; thenWhat's the purpose of this? In case the build dir is in the build shell's path but not the login shell's? There's no guarantee the build directory is going to be named in a way that matches. Also, pattern matching with "==" is not POSIX (we would use a "case" if we needed to do this, but I think there's a better way here). Instead, I think what we would need to do is check for scp in the path over the ssh connection in a similar way to how have_prog does it.> + echo "scp not found in path. Skipping scp3 test." > + echo "*****************" > + exittest-exec.sh has a "skip" function to do this in a consistent (and shorter) way. After a bit of fiddling, this seems to work, which I'll commit shortly: $SSH -F $OBJ/ssh_proxy somehost \ 'IFS=":"; for i in $PATH;do [ -x "$i/scp" ] && exit 0; done; exit 1' if [ $? -eq 1 ]; then skip "No scp on remote path." fi -- Darren Tucker (dtucker at dtucker.net) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new) Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.