Menu

#23 Show STDOUT of scp

v1.06
open
nobody
5
2024-05-31
2021-12-21
No

When using sshpass with scp, the progress bar (STDOUT) is completely removed from view.

It would be ideal if the STDOUT after the authentication interactions can be show directly to the STDOUT of sshpass.

Discussion

  • Shachar Shemesh

    Shachar Shemesh - 2022-05-28

    The problem isn't that sshpass doesn't pass scp's output. The problem is that scp decides that it is running non-interactively, and therefor doesn't produce any output.

    I don't know, at this point, what caused scp to decide that.

     
  • Shachar Shemesh

    Shachar Shemesh - 2024-05-31

    The immediate cause for scp is an ioctl it does that fails with ENOTTY:
    ioctl(1, TIOCGPGRP, 0x7ffc18af0484) = -1 ENOTTY (Inappropriate ioctl for device)

    Still investigating why.

     
  • Shachar Shemesh

    Shachar Shemesh - 2024-05-31

    I'm not sure this is worth fixing.
    The setup here is this: scp is checking whether it's "foreground" (and thus print the progress) by checking which is the process leader of STDOUT.
    When running under sshpass, STDOUT is directed to the parent's STDOUT (typically, the controlling terminal of where sshpass was run). But this is not the controlling terminal for scp itself. This is the PTY that sshpass created to accept the password prompt. This causes the IOCTL to fail, and scp to conclude it is running non-interactively, and not produce the progress output.

    A fix would be directing STDOUT and STDERR to the same TTY. This would require sshpass to stick around and continue forwarding output and input from its own streams to the running program.

    Feel free to submit such a patch, but this is outside sshpass' intended use.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.