tcgetpgrp() fails in scp
Brought to you by:
thesun
Hello,
"sshpass ... scp ..." doesn't display a progress bar as scp normally does.
I digged in scp code and found the following:
static int
can_output(void)
{
return (getpgrp() == tcgetpgrp(STDOUT_FILENO));
}
The tcgetpgrp call returns -1, if scp is called via sshpass.
I tried a bit hacking in sshpass without success. Without a call of setsid() in the child fork in sshpass, the tcgetpgrp call in the child works as it should, but that fails sshpass entering the password.
As I don't how theses terminals work in much detail, I am not able to find a solution to this.
I would appreciate it if someone with deeper knowledge fixes this.
Fixing this would involve sshpass taking control not only of the TTY for the process, but also of the STDOUT and STDIN for it. I believe this is out of scope for sshpass, but I've left comments on so you can try and convince me otherwise.