|
|
923a60 |
From 4365589534812dc2dc4d015f3459c82a440ec44f Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Mike Gilbert <floppymaster@gmail.com>
|
|
|
923a60 |
Date: Tue, 10 Jan 2017 02:39:05 -0500
|
|
|
923a60 |
Subject: [PATCH] build-sys: add check for gperf lookup function signature
|
|
|
923a60 |
(#5055)
|
|
|
923a60 |
|
|
|
923a60 |
gperf-3.1 generates lookup functions that take a size_t length
|
|
|
923a60 |
parameter instead of unsigned int. Test for this at configure time.
|
|
|
923a60 |
|
|
|
923a60 |
Fixes: https://github.com/systemd/systemd/issues/5039
|
|
|
923a60 |
(cherry picked from commit c9f7b4d356a453a01aa77a6bb74ca7ef49732c08)
|
|
|
923a60 |
---
|
|
|
923a60 |
configure.ac | 22 ++++++++++++++++++++++
|
|
|
923a60 |
src/core/load-fragment.h | 2 +-
|
|
|
923a60 |
src/journal/journald-server.h | 2 +-
|
|
|
923a60 |
src/login/logind.h | 2 +-
|
|
|
923a60 |
src/network/networkd-netdev.h | 2 +-
|
|
|
923a60 |
src/network/networkd.h | 2 +-
|
|
|
923a60 |
src/resolve/dns-type.c | 2 +-
|
|
|
923a60 |
src/resolve/resolved-conf.h | 2 +-
|
|
|
923a60 |
src/shared/af-list.c | 2 +-
|
|
|
923a60 |
src/shared/arphrd-list.c | 2 +-
|
|
|
923a60 |
src/shared/cap-list.c | 2 +-
|
|
|
923a60 |
src/shared/conf-parser.h | 2 +-
|
|
|
923a60 |
src/shared/errno-list.c | 2 +-
|
|
|
923a60 |
src/timesync/timesyncd-conf.h | 2 +-
|
|
|
923a60 |
src/udev/net/link-config.h | 2 +-
|
|
|
923a60 |
src/udev/udev-builtin-keyboard.c | 2 +-
|
|
|
923a60 |
16 files changed, 37 insertions(+), 15 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/configure.ac b/configure.ac
|
|
|
923a60 |
index 19d42602c9..f885853f49 100644
|
|
|
923a60 |
--- a/configure.ac
|
|
|
923a60 |
+++ b/configure.ac
|
|
|
923a60 |
@@ -237,6 +237,28 @@ AC_CHECK_SIZEOF(rlim_t,,[
|
|
|
923a60 |
#include <sys/resource.h>
|
|
|
923a60 |
])
|
|
|
923a60 |
|
|
|
923a60 |
+GPERF_TEST="$(echo foo,bar | ${GPERF} -L ANSI-C)"
|
|
|
923a60 |
+
|
|
|
923a60 |
+AC_COMPILE_IFELSE(
|
|
|
923a60 |
+ [AC_LANG_PROGRAM([
|
|
|
923a60 |
+ #include <string.h>
|
|
|
923a60 |
+ const char * in_word_set(const char *, size_t);
|
|
|
923a60 |
+ $GPERF_TEST]
|
|
|
923a60 |
+ )],
|
|
|
923a60 |
+ [GPERF_LEN_TYPE=size_t],
|
|
|
923a60 |
+ [AC_COMPILE_IFELSE(
|
|
|
923a60 |
+ [AC_LANG_PROGRAM([
|
|
|
923a60 |
+ #include <string.h>
|
|
|
923a60 |
+ const char * in_word_set(const char *, unsigned);
|
|
|
923a60 |
+ $GPERF_TEST]
|
|
|
923a60 |
+ )],
|
|
|
923a60 |
+ [GPERF_LEN_TYPE=unsigned],
|
|
|
923a60 |
+ [AC_MSG_ERROR([** unable to determine gperf len type])]
|
|
|
923a60 |
+ )]
|
|
|
923a60 |
+)
|
|
|
923a60 |
+
|
|
|
923a60 |
+AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
|
|
|
923a60 |
+
|
|
|
923a60 |
# ------------------------------------------------------------------------------
|
|
|
923a60 |
# we use python to build the man page index, and for systemd-python
|
|
|
923a60 |
have_python=no
|
|
|
923a60 |
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
|
|
|
923a60 |
index 8d334f2c86..4bd286c11b 100644
|
|
|
923a60 |
--- a/src/core/load-fragment.h
|
|
|
923a60 |
+++ b/src/core/load-fragment.h
|
|
|
923a60 |
@@ -112,7 +112,7 @@ int config_parse_protect_system(const char* unit, const char *filename, unsigned
|
|
|
923a60 |
int config_parse_bus_name(const char* unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
|
|
|
923a60 |
/* gperf prototypes */
|
|
|
923a60 |
-const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
extern const char load_fragment_gperf_nulstr[];
|
|
|
923a60 |
|
|
|
923a60 |
typedef enum Disabled {
|
|
|
923a60 |
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
|
|
|
923a60 |
index f046fde834..e74c65dbec 100644
|
|
|
923a60 |
--- a/src/journal/journald-server.h
|
|
|
923a60 |
+++ b/src/journal/journald-server.h
|
|
|
923a60 |
@@ -164,7 +164,7 @@ void server_dispatch_message(Server *s, struct iovec *iovec, unsigned n, unsigne
|
|
|
923a60 |
void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...) _printf_(3,4);
|
|
|
923a60 |
|
|
|
923a60 |
/* gperf lookup function */
|
|
|
923a60 |
-const struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* journald_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
int config_parse_storage(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
int config_parse_line_max(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
diff --git a/src/login/logind.h b/src/login/logind.h
|
|
|
923a60 |
index 8503eb24dd..29fb1b3082 100644
|
|
|
923a60 |
--- a/src/login/logind.h
|
|
|
923a60 |
+++ b/src/login/logind.h
|
|
|
923a60 |
@@ -187,7 +187,7 @@ int manager_unit_is_active(Manager *manager, const char *unit);
|
|
|
923a60 |
int manager_job_is_active(Manager *manager, const char *path);
|
|
|
923a60 |
|
|
|
923a60 |
/* gperf lookup function */
|
|
|
923a60 |
-const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* logind_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
int manager_watch_busname(Manager *manager, const char *name);
|
|
|
923a60 |
void manager_drop_busname(Manager *manager, const char *name);
|
|
|
923a60 |
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
|
|
|
923a60 |
index 3756b1e5a7..fb44f38e64 100644
|
|
|
923a60 |
--- a/src/network/networkd-netdev.h
|
|
|
923a60 |
+++ b/src/network/networkd-netdev.h
|
|
|
923a60 |
@@ -199,7 +199,7 @@ NetDevKind netdev_kind_from_string(const char *d) _pure_;
|
|
|
923a60 |
int config_parse_netdev_kind(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
|
|
|
923a60 |
/* gperf */
|
|
|
923a60 |
-const struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
/* Macros which append INTERFACE= to the message */
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/network/networkd.h b/src/network/networkd.h
|
|
|
923a60 |
index bdb2f20e2f..8902bbce6b 100644
|
|
|
923a60 |
--- a/src/network/networkd.h
|
|
|
923a60 |
+++ b/src/network/networkd.h
|
|
|
923a60 |
@@ -328,7 +328,7 @@ int network_node_enumerator(sd_bus *bus, const char *path, void *userdata, char
|
|
|
923a60 |
int network_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
|
|
|
923a60 |
|
|
|
923a60 |
/* gperf */
|
|
|
923a60 |
-const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
/* Route */
|
|
|
923a60 |
int route_new_static(Network *network, unsigned section, Route **ret);
|
|
|
923a60 |
diff --git a/src/resolve/dns-type.c b/src/resolve/dns-type.c
|
|
|
923a60 |
index a3e740896f..e409df974a 100644
|
|
|
923a60 |
--- a/src/resolve/dns-type.c
|
|
|
923a60 |
+++ b/src/resolve/dns-type.c
|
|
|
923a60 |
@@ -27,7 +27,7 @@ typedef const struct {
|
|
|
923a60 |
} dns_type;
|
|
|
923a60 |
|
|
|
923a60 |
static const struct dns_type_name *
|
|
|
923a60 |
-lookup_dns_type (register const char *str, register unsigned int len);
|
|
|
923a60 |
+lookup_dns_type (register const char *str, register GPERF_LEN_TYPE len);
|
|
|
923a60 |
|
|
|
923a60 |
#include "dns_type-from-name.h"
|
|
|
923a60 |
#include "dns_type-to-name.h"
|
|
|
923a60 |
diff --git a/src/resolve/resolved-conf.h b/src/resolve/resolved-conf.h
|
|
|
923a60 |
index b3dbea7b6b..17b0960594 100644
|
|
|
923a60 |
--- a/src/resolve/resolved-conf.h
|
|
|
923a60 |
+++ b/src/resolve/resolved-conf.h
|
|
|
923a60 |
@@ -26,7 +26,7 @@
|
|
|
923a60 |
int manager_parse_dns_server(Manager *m, DnsServerType type, const char *string);
|
|
|
923a60 |
int manager_parse_config_file(Manager *m);
|
|
|
923a60 |
|
|
|
923a60 |
-const struct ConfigPerfItem* resolved_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* resolved_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
int config_parse_dnsv(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
int config_parse_support(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
diff --git a/src/shared/af-list.c b/src/shared/af-list.c
|
|
|
923a60 |
index f396115a34..cbdec82240 100644
|
|
|
923a60 |
--- a/src/shared/af-list.c
|
|
|
923a60 |
+++ b/src/shared/af-list.c
|
|
|
923a60 |
@@ -25,7 +25,7 @@
|
|
|
923a60 |
#include "util.h"
|
|
|
923a60 |
#include "af-list.h"
|
|
|
923a60 |
|
|
|
923a60 |
-static const struct af_name* lookup_af(register const char *str, register unsigned int len);
|
|
|
923a60 |
+static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
|
|
|
923a60 |
|
|
|
923a60 |
#include "af-to-name.h"
|
|
|
923a60 |
#include "af-from-name.h"
|
|
|
923a60 |
diff --git a/src/shared/arphrd-list.c b/src/shared/arphrd-list.c
|
|
|
923a60 |
index 6e113eff7a..588956c56f 100644
|
|
|
923a60 |
--- a/src/shared/arphrd-list.c
|
|
|
923a60 |
+++ b/src/shared/arphrd-list.c
|
|
|
923a60 |
@@ -26,7 +26,7 @@
|
|
|
923a60 |
#include "util.h"
|
|
|
923a60 |
#include "arphrd-list.h"
|
|
|
923a60 |
|
|
|
923a60 |
-static const struct arphrd_name* lookup_arphrd(register const char *str, register unsigned int len);
|
|
|
923a60 |
+static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
|
|
|
923a60 |
|
|
|
923a60 |
#include "arphrd-to-name.h"
|
|
|
923a60 |
#include "arphrd-from-name.h"
|
|
|
923a60 |
diff --git a/src/shared/cap-list.c b/src/shared/cap-list.c
|
|
|
923a60 |
index 8033e8c7b2..aa23f5e13c 100644
|
|
|
923a60 |
--- a/src/shared/cap-list.c
|
|
|
923a60 |
+++ b/src/shared/cap-list.c
|
|
|
923a60 |
@@ -26,7 +26,7 @@
|
|
|
923a60 |
#include "cap-list.h"
|
|
|
923a60 |
#include "missing.h"
|
|
|
923a60 |
|
|
|
923a60 |
-static const struct capability_name* lookup_capability(register const char *str, register unsigned int len);
|
|
|
923a60 |
+static const struct capability_name* lookup_capability(register const char *str, register GPERF_LEN_TYPE len);
|
|
|
923a60 |
|
|
|
923a60 |
#include "cap-to-name.h"
|
|
|
923a60 |
#include "cap-from-name.h"
|
|
|
923a60 |
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
|
|
|
923a60 |
index 7a2f855f9f..895f6f6a38 100644
|
|
|
923a60 |
--- a/src/shared/conf-parser.h
|
|
|
923a60 |
+++ b/src/shared/conf-parser.h
|
|
|
923a60 |
@@ -61,7 +61,7 @@ typedef struct ConfigPerfItem {
|
|
|
923a60 |
} ConfigPerfItem;
|
|
|
923a60 |
|
|
|
923a60 |
/* Prototype for a low-level gperf lookup function */
|
|
|
923a60 |
-typedef const ConfigPerfItem* (*ConfigPerfItemLookup)(const char *section_and_lvalue, unsigned length);
|
|
|
923a60 |
+typedef const ConfigPerfItem* (*ConfigPerfItemLookup)(const char *section_and_lvalue, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
/* Prototype for a generic high-level lookup function */
|
|
|
923a60 |
typedef int (*ConfigItemLookup)(
|
|
|
923a60 |
diff --git a/src/shared/errno-list.c b/src/shared/errno-list.c
|
|
|
923a60 |
index c63296f292..99b0c689bf 100644
|
|
|
923a60 |
--- a/src/shared/errno-list.c
|
|
|
923a60 |
+++ b/src/shared/errno-list.c
|
|
|
923a60 |
@@ -26,7 +26,7 @@
|
|
|
923a60 |
#include "errno-list.h"
|
|
|
923a60 |
|
|
|
923a60 |
static const struct errno_name* lookup_errno(register const char *str,
|
|
|
923a60 |
- register unsigned int len);
|
|
|
923a60 |
+ register GPERF_LEN_TYPE len);
|
|
|
923a60 |
|
|
|
923a60 |
#include "errno-to-name.h"
|
|
|
923a60 |
#include "errno-from-name.h"
|
|
|
923a60 |
diff --git a/src/timesync/timesyncd-conf.h b/src/timesync/timesyncd-conf.h
|
|
|
923a60 |
index 56466fe462..a776475ea9 100644
|
|
|
923a60 |
--- a/src/timesync/timesyncd-conf.h
|
|
|
923a60 |
+++ b/src/timesync/timesyncd-conf.h
|
|
|
923a60 |
@@ -25,7 +25,7 @@
|
|
|
923a60 |
|
|
|
923a60 |
#include "timesyncd-manager.h"
|
|
|
923a60 |
|
|
|
923a60 |
-const struct ConfigPerfItem* timesyncd_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* timesyncd_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
int manager_parse_server_string(Manager *m, ServerType type, const char *string);
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h
|
|
|
923a60 |
index f2e9174887..af01989919 100644
|
|
|
923a60 |
--- a/src/udev/net/link-config.h
|
|
|
923a60 |
+++ b/src/udev/net/link-config.h
|
|
|
923a60 |
@@ -93,7 +93,7 @@ const char *mac_policy_to_string(MACPolicy p) _const_;
|
|
|
923a60 |
MACPolicy mac_policy_from_string(const char *p) _pure_;
|
|
|
923a60 |
|
|
|
923a60 |
/* gperf lookup function */
|
|
|
923a60 |
-const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, unsigned length);
|
|
|
923a60 |
+const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
|
|
923a60 |
|
|
|
923a60 |
int config_parse_mac_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
int config_parse_name_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
|
|
923a60 |
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
|
|
|
923a60 |
index eaa21abf60..7d30482b13 100644
|
|
|
923a60 |
--- a/src/udev/udev-builtin-keyboard.c
|
|
|
923a60 |
+++ b/src/udev/udev-builtin-keyboard.c
|
|
|
923a60 |
@@ -28,7 +28,7 @@
|
|
|
923a60 |
|
|
|
923a60 |
#include "udev.h"
|
|
|
923a60 |
|
|
|
923a60 |
-static const struct key *keyboard_lookup_key(const char *str, unsigned len);
|
|
|
923a60 |
+static const struct key *keyboard_lookup_key(const char *str, GPERF_LEN_TYPE len);
|
|
|
923a60 |
#include "keyboard-keys-from-name.h"
|
|
|
923a60 |
#include "keyboard-keys-to-name.h"
|
|
|
923a60 |
|