rapier1/hpn-ssh

scp-hpn execs vanilla ssh

walterdejong opened this issue · 4 comments

Build with default prefix and use EXEEXT=-hpn.
When you execute scp-hpn, you will find that under the hood it execs the vanilla ssh:

strace -f /usr/bin/scp-hpn -vvvv -P 8000 /etc/motd dm5:/tmp/ 2>&1 |grep exec
execve("/usr/bin/scp-hpn", ["/usr/bin/scp-hpn", "-vvvv", "-P", "8000", "/etc/motd", "dm5:/tmp"...], [/* 58 vars */]) = 0
[pid 14724] execve("/usr/bin/ssh", ["/usr/bin/ssh", "-x", "-oForwardAgent=no", "-oPermitLocalCommand=no", "-oClearAllForwardings=yes", "-oRemoteCommand=none", "-oRequestTTY=no", "-v", "-v", "-v", "-v", "-p", "8000", "--", "dm5", "scp -v -t /tmp/", ...], [/* 58 vars */]) = 0

Next I built with prefix=/home/walter/sw and EXEEXT=-hpn.
Now scp-hpn tries executing /home/walter/sw/bin/ssh, which is not installed:

$ strace -f ./scp-hpn -vvv /etc/issue localhost:/tmp/ 2>&1 |grep exec
execve("./scp-hpn", ["./scp-hpn", "-vvv", "/etc/issue", "localhost:/tmp/"], [/* 65 vars */]) = 0
[pid 29588] execve("/home/walter/sw/bin/ssh", ["/home/walter/sw/bin/ssh", "-x", "-oForwardAgent=no", "-oPermitLocalCommand=no", "-oClearAllForwardings=yes", "-oRemoteCommand=none", "-oRequestTTY=no", "-v", "-v", "-v", "--", "localhost", "scp -v -t /tmp/"], [/* 65 vars */]) = -1 ENOENT (No such file or directory)

Solution/workaround: build with a prefix dir dedicated to ssh-hpn, and use a blank EXEEXT.

I really do like having the extension -hpn on the command names, so hopefully you can make a fix.

this is default OpenSSH behavior where it does program selection. upstream doesn't respect EXEEXT.

you can just use scp's -S option to select your custom ssh program.

I suggest making a fix along these lines:

# Makefile
EXEEXT=

CFLAGS=-DEXEEXT=$(EXEEXT)
#ifndef EXEEXT
#define EXEEXT ""
#endif

    execv("ssh" EXEEXT);

or append it to a buffer if execv() is called with a buffer argument.

feel free to send that patch to upstream since it's a bug there:
https://www.openssh.com/list.html

HPN shouldn't carry arbitrary patches unrelated to HPN feature work.