Skip to contentSkip to conversation

package/zabbix: fix libcurl build

PATCH In review Fabrice Fontaine 2 participants 3 messages Feb 20, 2023 – Feb 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/zabbix: fix libcurl build

Fix the following libcurl build failure:

In file included from /tmp/instance-1/output-1/host/s390x-buildroot-linux-gnu/sysroot/usr/include/curl/curl.h:3195,

                 from ../../../../include/sysinc.h:384,
                 from ../../../../include/common.h:23,
                 from simple.c:20:

simple.c: In function 'check_https':
simple.c:167:65: error: invalid use of void expression
167 | if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_USERAGENT, "Zabbix " ZABBIX_VERSION)) ||
| ^

Fixes:
- http://autobuild.buildroot.org/results/053a62e9969046a7f8a0e1890c24d2bfb099ae42

---
 ...se-parentheses-to-ensure-compilation.patch | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 package/zabbix/0002-Use-parentheses-to-ensure-compilation.patch
package/zabbix/0002-Use-parentheses-to-ensure-compilation.patch new file +65 -0
new file mode 100644
index 0000000000..482480e5e0
@@ -0,0 +1,65 @@
+From 2fe3c652bd6a6522d5be3fd41c6ed39ddc2d21fa Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Mon, 13 Feb 2023 14:32:38 +0100
+Subject: [PATCH] Use parentheses to ensure compilation
+
+Compiler fails with latest Curl release. Use parenthesis to ensure
+compiler evaluates expression correctly:
+
+In file included from /tmp/instance-1/output-1/host/s390x-buildroot-linux-gnu/sysroot/usr/include/curl/curl.h:3195,
+                 from ../../../../include/sysinc.h:384,
+                 from ../../../../include/common.h:23,
+                 from simple.c:20:
+simple.c: In function 'check_https':
+simple.c:167:65: error: invalid use of void expression
+  167 |         if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_USERAGENT, "Zabbix " ZABBIX_VERSION)) ||
+      |                                                                 ^
+
+Fixes:
+ - http://autobuild.buildroot.org/results/053a62e9969046a7f8a0e1890c24d2bfb099ae42
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: not sent (no feedback on first patch)]
+---
+ src/libs/zbxsysinfo/simple/simple.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/libs/zbxsysinfo/simple/simple.c b/src/libs/zbxsysinfo/simple/simple.c
+index fc16a784cf..c3ce974492 100644
+--- a/src/libs/zbxsysinfo/simple/simple.c
++++ b/src/libs/zbxsysinfo/simple/simple.c
+@@ -177,14 +177,14 @@ static int	check_https(const char *host, unsigned short port, int timeout, int *
+ 	else
+ 		zbx_snprintf(https_host, sizeof(https_host), "%s%s", (0 == strncmp(host, "https://", 8) ? "" : "https://"), host);
+ 
+-	if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_USERAGENT, "Zabbix " ZABBIX_VERSION)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_URL, https_host)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_PORT, (long)port)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_NOBODY, 1L)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_SSL_VERIFYPEER, 0L)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_SSL_VERIFYHOST, 0L)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_TIMEOUT, (long)timeout)) ||
+-		CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = ZBX_CURLOPT_ACCEPT_ENCODING, "")))
++	if (CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_USERAGENT), "Zabbix " ZABBIX_VERSION)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_URL), https_host)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_PORT), (long)port)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_NOBODY), 1L)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_SSL_VERIFYPEER), 0L)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_SSL_VERIFYHOST), 0L)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_TIMEOUT), (long)timeout)) ||
++		CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = ZBX_CURLOPT_ACCEPT_ENCODING), "")))
+ 	{
+ 		zabbix_log(LOG_LEVEL_DEBUG, "%s: could not set cURL option [%d]: %s",
+ 				__func__, (int)opt, curl_easy_strerror(err));
+@@ -193,7 +193,7 @@ static int	check_https(const char *host, unsigned short port, int timeout, int *
+ 
+ 	if (NULL != CONFIG_SOURCE_IP)
+ 	{
+-		if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_INTERFACE, CONFIG_SOURCE_IP)))
++		if (CURLE_OK != (err = curl_easy_setopt(easyhandle, (opt = CURLOPT_INTERFACE), CONFIG_SOURCE_IP)))
+ 		{
+ 			zabbix_log(LOG_LEVEL_DEBUG, "%s: could not set source interface option [%d]: %s",
+ 					__func__, (int)opt, curl_easy_strerror(err));
+-- 
+2.39.0
+
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Fabrice,

Quoted 11 lines · On Mon, 20 Feb 2023 10:33:36 +0100 Fabrice Fontaine…

Fix the following libcurl build failure:

In file included from /tmp/instance-1/output-1/host/s390x-buildroot-linux-gnu/sysroot/usr/include/curl/curl.h:3195,

                 from ../../../../include/sysinc.h:384,
                 from ../../../../include/common.h:23,
                 from simple.c:20:

simple.c: In function 'check_https':
simple.c:167:65: error: invalid use of void expression
167 | if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_USERAGENT, "Zabbix " ZABBIX_VERSION)) ||
| ^

Quoted 8 lines

Fixes:
- http://autobuild.buildroot.org/results/053a62e9969046a7f8a0e1890c24d2bfb099ae42

---
 ...se-parentheses-to-ensure-compilation.patch | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 package/zabbix/0002-Use-parentheses-to-ensure-compilation.patch

This was reported to curl upstream in
https://github.com/curl/curl/issues/10148, and apparently fixed in curl by
https://github.com/curl/curl/commit/e2aed004302e51cfa5b6ce8c8ab65ef92aa83196.

So it apparently was considered a bug in curl, so perhaps it should be fixed in curl rather than in zabbix?

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello,

Quoted 33 lines · Thomas Petazzoni

Hello Fabrice,

Quoted 3 lines · On Mon, 20 Feb 2023 10:33:36 +0100 Fabrice Fontaine…

Fix the following libcurl build failure:

In file included from

/tmp/instance-1/output-1/host/s390x-buildroot-linux-gnu/sysroot/usr/include/curl/curl.h:3195,

Quoted 6 lines
                 from ../../../../include/sysinc.h:384,
                 from ../../../../include/common.h:23,
                 from simple.c:20:

simple.c: In function 'check_https':
simple.c:167:65: error: invalid use of void expression
167 | if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt

= CURLOPT_USERAGENT, "Zabbix " ZABBIX_VERSION)) ||

Quoted 4 lines

| ^

Fixes:
-

http://autobuild.buildroot.org/results/053a62e9969046a7f8a0e1890c24d2bfb099ae42

Quoted 6 lines
---
 ...se-parentheses-to-ensure-compilation.patch | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644

package/zabbix/0002-Use-parentheses-to-ensure-compilation.patch

This was reported to curl upstream in
https://github.com/curl/curl/issues/10148, and apparently fixed in curl by

Quoted 6 lines

https://github.com/curl/curl/commit/e2aed004302e51cfa5b6ce8c8ab65ef92aa83196
.

So it apparently was considered a bug in curl, so perhaps it should be fixed in curl rather than in zabbix?

Indeed, I'll set this patch as not applicable as the build failure is not raised since commit 14ca6b5fdb6a5e0fa99b04461240772d93076b2e

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot