From 66a64c077c329184470172751f754a89f2fee2fc Mon Sep 17 00:00:00 2001 From: Chenxi Mao Date: Mon, 3 Apr 2023 17:46:03 +0800 Subject: [PATCH] Fix build error if compiler switch to clang Signed-off-by: Chenxi Mao --- ...es-Fix-build-issue-with-new-clang-15.patch | 170 ++++++++++++++++++ libssh.spec | 9 +- 2 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 backport-examples-Fix-build-issue-with-new-clang-15.patch diff --git a/backport-examples-Fix-build-issue-with-new-clang-15.patch b/backport-examples-Fix-build-issue-with-new-clang-15.patch new file mode 100644 index 0000000..ebccc3d --- /dev/null +++ b/backport-examples-Fix-build-issue-with-new-clang-15.patch @@ -0,0 +1,170 @@ +From 22f0f0dd60907ee7bcf30a5e32638ef12b8f0457 Mon Sep 17 00:00:00 2001 +From: Jakub Jelen +Date: Wed, 12 Oct 2022 13:03:45 +0200 +Subject: [PATCH 1/1] examples: Fix build issue with new clang 15 + +The error was the following + +/builds/libssh/libssh-mirror/examples/sshnetcat.c:241:18: error: a function +declaration without a prototype is deprecated in all versions of C +[-Werror,-Wstrict-prototypes] +void cleanup_pcap(){ + ^ + void + +and similar + +Signed-off-by: Jakub Jelen +Reviewed-by: Anderson Toshiyuki Sasaki +--- + examples/ssh_X11_client.c | 2 +- + examples/sshnetcat.c | 5 +++-- + src/init.c | 2 +- + tests/pkd/pkd_keyutil.c | 24 ++++++++++++------------ + 4 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/examples/ssh_X11_client.c b/examples/ssh_X11_client.c +index 369b9b4a..6e785ee2 100644 +--- a/examples/ssh_X11_client.c ++++ b/examples/ssh_X11_client.c +@@ -453,7 +453,7 @@ connect_local_xsocket(int display_number) + + + static int +-x11_connect_display() ++x11_connect_display(void) + { + int display_number; + const char *display = NULL; +diff --git a/examples/sshnetcat.c b/examples/sshnetcat.c +index 9bc5d52e..59b0a289 100644 +--- a/examples/sshnetcat.c ++++ b/examples/sshnetcat.c +@@ -238,9 +238,10 @@ void set_pcap(ssh_session session){ + } + + void cleanup_pcap(void); +-void cleanup_pcap(){ ++void cleanup_pcap(void) ++{ + ssh_pcap_file_free(pcap); +- pcap=NULL; ++ pcap = NULL; + } + #endif + +diff --git a/src/init.c b/src/init.c +index 7f184b9c..36911a42 100644 +--- a/src/init.c ++++ b/src/init.c +@@ -278,7 +278,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, + * + * @see ssh_init() + */ +-bool is_ssh_initialized() { ++bool is_ssh_initialized(void) { + + bool is_initialized = false; + +diff --git a/tests/pkd/pkd_keyutil.c b/tests/pkd/pkd_keyutil.c +index 3991bcbb..533d2788 100644 +--- a/tests/pkd/pkd_keyutil.c ++++ b/tests/pkd/pkd_keyutil.c +@@ -22,7 +22,7 @@ + #include "pkd_keyutil.h" + #include "pkd_util.h" + +-void setup_rsa_key() { ++void setup_rsa_key(void) { + int rc = 0; + if (access(LIBSSH_RSA_TESTKEY, F_OK) != 0) { + rc = system_checked(OPENSSH_KEYGEN " -t rsa -q -N \"\" -f " +@@ -31,7 +31,7 @@ void setup_rsa_key() { + assert_int_equal(rc, 0); + } + +-void setup_ed25519_key() { ++void setup_ed25519_key(void) { + int rc = 0; + if (access(LIBSSH_ED25519_TESTKEY, F_OK) != 0) { + rc = system_checked(OPENSSH_KEYGEN " -t ed25519 -q -N \"\" -f " +@@ -41,7 +41,7 @@ void setup_ed25519_key() { + } + + #ifdef HAVE_DSA +-void setup_dsa_key() { ++void setup_dsa_key(void) { + int rc = 0; + if (access(LIBSSH_DSA_TESTKEY, F_OK) != 0) { + rc = system_checked(OPENSSH_KEYGEN " -t dsa -q -N \"\" -f " +@@ -51,7 +51,7 @@ void setup_dsa_key() { + } + #endif + +-void setup_ecdsa_keys() { ++void setup_ecdsa_keys(void) { + int rc = 0; + + if (access(LIBSSH_ECDSA_256_TESTKEY, F_OK) != 0) { +@@ -71,27 +71,27 @@ void setup_ecdsa_keys() { + } + } + +-void cleanup_rsa_key() { ++void cleanup_rsa_key(void) { + cleanup_key(LIBSSH_RSA_TESTKEY); + } + +-void cleanup_ed25519_key() { ++void cleanup_ed25519_key(void) { + cleanup_key(LIBSSH_ED25519_TESTKEY); + } + + #ifdef HAVE_DSA +-void cleanup_dsa_key() { ++void cleanup_dsa_key(void) { + cleanup_key(LIBSSH_DSA_TESTKEY); + } + #endif + +-void cleanup_ecdsa_keys() { ++void cleanup_ecdsa_keys(void) { + cleanup_key(LIBSSH_ECDSA_256_TESTKEY); + cleanup_key(LIBSSH_ECDSA_384_TESTKEY); + cleanup_key(LIBSSH_ECDSA_521_TESTKEY); + } + +-void setup_openssh_client_keys() { ++void setup_openssh_client_keys(void) { + int rc = 0; + + if (access(OPENSSH_CA_TESTKEY, F_OK) != 0) { +@@ -184,7 +184,7 @@ void setup_openssh_client_keys() { + } + } + +-void cleanup_openssh_client_keys() { ++void cleanup_openssh_client_keys(void) { + cleanup_key(OPENSSH_CA_TESTKEY); + cleanup_key(OPENSSH_RSA_TESTKEY); + cleanup_file(OPENSSH_RSA_TESTKEY "-sha256-cert.pub"); +@@ -199,7 +199,7 @@ void cleanup_openssh_client_keys() { + } + } + +-void setup_dropbear_client_rsa_key() { ++void setup_dropbear_client_rsa_key(void) { + int rc = 0; + if (access(DROPBEAR_RSA_TESTKEY, F_OK) != 0) { + rc = system_checked(DROPBEAR_KEYGEN " -t rsa -f " +@@ -208,6 +208,6 @@ void setup_dropbear_client_rsa_key() { + assert_int_equal(rc, 0); + } + +-void cleanup_dropbear_client_rsa_key() { ++void cleanup_dropbear_client_rsa_key(void) { + unlink(DROPBEAR_RSA_TESTKEY); + } +-- +2.33.0 + diff --git a/libssh.spec b/libssh.spec index 7b79dc8..dc77a54 100644 --- a/libssh.spec +++ b/libssh.spec @@ -1,6 +1,6 @@ Name: libssh Version: 0.10.4 -Release: 2 +Release: 3 Summary: A library implementing the SSH protocol License: LGPLv2+ URL: http://www.libssh.org @@ -11,6 +11,7 @@ Source2: https://cryptomilk.org/gpgkey-8DFF53E18F2ABC8D8F3C92237EE0FC4DCC Patch0: backport-config-Escape-brackets-in-ProxyCommand-build-from.patch Patch1: backport-packet-do-not-enqueue-outgoing-packets-after-sending.patch +Patch2: backport-examples-Fix-build-issue-with-new-clang-15.patch BuildRequires: cmake gcc-c++ gnupg2 openssl-devel pkgconfig zlib-devel BuildRequires: krb5-devel libcmocka-devel openssh-clients openssh-server @@ -96,6 +97,12 @@ popd %doc CHANGELOG README %changelog +* Mon Apr 3 2023 Chenxi Mao - 0.10.4-3 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:Backport patches to fix build error if compiler switch to clang. + * Sat Mar 18 2023 renmingshuai - 0.10.4-2 - Type:bugfix - Id:NA -- Gitee