qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Richard W . M . Jones" <rjones@redhat.com>,
	qemu-devel@nongnu.org, Pino Toscano <ptoscano@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	qemu-block@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Max Reitz" <mreitz@redhat.com>, 周文青 <1151451036@qq.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [Qemu-devel] [PATCH 3/4] configure: Improve checking libssh version is 0.8
Date: Wed, 14 Aug 2019 14:15:26 +0200	[thread overview]
Message-ID: <20190814121527.17876-4-philmd@redhat.com> (raw)
In-Reply-To: <20190814121527.17876-1-philmd@redhat.com>

To figure out which libssh version is installed, checking for
ssh_get_server_publickey() is not sufficient.

ssh_get_server_publickey() has been introduced in libssh
commit bbd052202 (predating 0.8) but distributions also
backported other pre-0.8 patches, such libssh commit
963c46e4f which introduce the ssh_known_hosts_e enum.

Check the enum is available to assume the version is 0.8.

This fixes build failure on Ubuntu 18.04:

    CC      block/ssh.o
  block/ssh.c: In function 'check_host_key_knownhosts':
  block/ssh.c:281:28: error: storage size of 'state' isn't known
       enum ssh_known_hosts_e state;
                              ^~~~~
  rules.mak:69: recipe for target 'block/ssh.o' failed
  make: *** [block/ssh.o] Error 1

Reported-by: 周文青 <1151451036@qq.com>
Fixes: https://bugs.launchpad.net/qemu/+bug/1838763
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 configure | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index fe3fef9309..040aa8eb6c 100755
--- a/configure
+++ b/configure
@@ -3949,18 +3949,24 @@ fi
 if test "$libssh" = "yes"; then
   cat > $TMPC <<EOF
 #include <libssh/libssh.h>
+#ifdef HAVE_LIBSSH_0_8
+static const enum ssh_known_hosts_e val = SSH_KNOWN_HOSTS_OK;
+#endif
 #ifdef HAVE_SSH_GET_SERVER_PUBLICKEY
 int main(void) { return ssh_get_server_publickey(NULL, NULL); }
 #else
 int main(void) { return ssh_get_publickey(NULL, NULL); }
 #endif
 EOF
-  if compile_object "$libssh_cflags"; then
+  if compile_object "$libssh_cflags -DHAVE_LIBSSH_0_8"; then
     libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags"
   fi
   if compile_object "$libssh_cflags -DHAVE_SSH_GET_SERVER_PUBLICKEY"; then
     libssh_cflags="-DHAVE_SSH_GET_SERVER_PUBLICKEY $libssh_cflags"
   fi
+  if ! compile_object "$libssh_cflags"; then
+    error_exit "cannot use with libssh (is it broken?)"
+  fi
 fi
 
 ##########################################
-- 
2.20.1



  parent reply	other threads:[~2019-08-14 12:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 12:15 [Qemu-devel] [PATCH 0/4] configure: Fix libssh on Ubuntu 18.04 Philippe Mathieu-Daudé
2019-08-14 12:15 ` [Qemu-devel] [RFC PATCH 1/4] configure: Improve libssh check Philippe Mathieu-Daudé
2019-08-14 12:36   ` Pino Toscano
2019-08-14 12:15 ` [Qemu-devel] [PATCH 2/4] configure: Avoid using libssh deprecated API Philippe Mathieu-Daudé
2019-08-14 12:35   ` Pino Toscano
2019-08-14 13:27   ` Andrea Bolognani
2019-08-14 14:15     ` Philippe Mathieu-Daudé
2019-08-14 14:51       ` Andrea Bolognani
2019-08-14 15:14         ` Philippe Mathieu-Daudé
2019-08-15  8:52           ` Andrea Bolognani
2019-08-14 12:15 ` Philippe Mathieu-Daudé [this message]
2019-08-14 12:39   ` [Qemu-devel] [PATCH 3/4] configure: Improve checking libssh version is 0.8 Pino Toscano
2019-08-14 12:15 ` [Qemu-devel] [PATCH 4/4] configure: Log the libssh version detected Philippe Mathieu-Daudé
2019-08-14 12:29   ` Richard W.M. Jones
2019-08-14 12:41   ` Pino Toscano
2019-08-14 16:45 ` [Qemu-devel] [PATCH 0/4] configure: Fix libssh on Ubuntu 18.04 no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190814121527.17876-4-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=1151451036@qq.com \
    --cc=alex.bennee@linaro.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=ptoscano@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).