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