Public bug reported:
collectd fails to build from source in Ubuntu stonking (amd64 and other
architectures).
== Build Error ==
src/dpdkstat.c: In function 'dpdk_stats_resolve_cnt_type':
src/dpdkstat.c:314:12: error: assignment discards 'const' qualifier from
pointer target type [-Werror=discarded-qualifiers]
314 | type_end = strrchr(cnt_name, '_');
| ^
cc1: all warnings being treated as errors
== Root Cause ==
In src/dpdkstat.c, the variable `type_end` is declared as `char*` but assigned
the result of `strrchr(cnt_name, '_')` where `cnt_name` is `const char*`.
GCC's builtin strrchr preserves const-ness, returning `const char*` when given
a `const char*` argument. Assigning this to a plain `char*` discards the const
qualifier, which is rejected by -Werror=discarded-qualifiers.
== Fix ==
Declare `type_end` as `const char*`:
--- a/src/dpdkstat.c
+++ b/src/dpdkstat.c
@@ -311,7 +311,7 @@
static void dpdk_stats_resolve_cnt_type(char *cnt_type, size_t cnt_type_len,
const char *cnt_name) {
- char *type_end;
+ const char *type_end;
type_end = strrchr(cnt_name, '_');
== References ==
PPA build log: https://launchpad.net/~hectorcao/+archive/ubuntu/net-
snmp-transition/+build/32908421
** Affects: collectd (Ubuntu)
Importance: Undecided
Status: New
** Tags: ftbfs stonking
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2154420
Title:
collectd: FTBFS in stonking - const qualifier discarded in dpdkstat.c
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/collectd/+bug/2154420/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs