artyom-poptsov / guile-ssh

Guile-SSH is a library that provides access to the SSH protocol for GNU Guile programs.
https://memory-heap.org/~avp/projects/guile-ssh
GNU General Public License v3.0
65 stars 13 forks source link

libguile-ssh/session-func.c: Add NODELAY option #21

Closed PromyLOPh closed 4 years ago

PromyLOPh commented 4 years ago

This pull request adds the nodelay option libssh provides. It is intended to be used by guix, which currently opens its own socket and manually sets NODELAY. See https://issues.guix.gnu.org/41702#11

The Guile 2.2 build pipeline fails, because it’s using a really old version of libssh (0.8.0~20170825.94fa1e38-1ubuntu0.6). NODELAY was introduced in 2018 by https://git.libssh.org/projects/libssh.git/commit/?id=be22c0d442a1c5c016e2ebb99075b61614b5b447

artyom-poptsov commented 4 years ago

Thanks for the patch!

There is a problem in Ubuntu 18.04 LTS: it ships with libssh version 0.8.0~20170825.94fa1e38-1ubuntu0.6, which is actually libssh 0.7. I tested it in a Docker container with Ubuntu GNU/Linux 18.04:

$ apt show libssh-dev 2>/dev/null | grep Version
Version: 0.8.0~20170825.94fa1e38-1ubuntu0.6
$ guile -c "(use-modules (ssh version)) (display (get-libssh-version)) (newline)"
0.7.0

Don't know for sure why the Ubuntu people decided to trick pkg-config into thinking that it's 0.8. But Guile-SSH will fail with your patch on this distribution, because SSH_OPTIONS_NODELAY appears only in actual libssh 0.8 (not the fake one 0.8 that is in Ubuntu 18.04.) That's the reason the tests fail here.

To fix that we need to check for libssh 0.8.1+ in configure.ac to make sure we have valid 0.8 -- that's the simplest solution (0.8.1 is quite old already so the most users will be okay with that I think.) Let me know if you come up with a better solution.

PromyLOPh commented 4 years ago

Not ideal but the best solution I can think of right now as well, thanks for merging! Would it be possible to create a new release of guile-ssh that we can then package and use?

artyom-poptsov commented 4 years ago

Sure. I'll see if I can fix some random test failures with Guile 2.2 that sometimes occur, and then I'll prepare a new release.