|
|
aebebb |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
aebebb |
From: Martin Wilck <mwilck@suse.com>
|
|
|
aebebb |
Date: Fri, 12 Aug 2022 18:58:15 +0200
|
|
|
aebebb |
Subject: [PATCH] multipathd: replace libreadline with libedit
|
|
|
aebebb |
|
|
|
aebebb |
Linking multipathd with libreadline may cause a license conflict,
|
|
|
aebebb |
because libreadline is licensed under GPL-3.0-or-later, and
|
|
|
aebebb |
libmultipath contains several files under GPL-2.0.
|
|
|
aebebb |
|
|
|
aebebb |
See:
|
|
|
aebebb |
https://github.com/opensvc/multipath-tools/issues/36
|
|
|
aebebb |
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979095
|
|
|
aebebb |
https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility
|
|
|
aebebb |
|
|
|
aebebb |
Replace the readline functionality with libedit, which comes under
|
|
|
aebebb |
a BSD license. The readline library can still be enabled (e.g. for
|
|
|
aebebb |
binaries not intended to be distributed) by running
|
|
|
aebebb |
"make READLINE=libreadline".
|
|
|
aebebb |
|
|
|
aebebb |
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
|
|
aebebb |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
aebebb |
---
|
|
|
aebebb |
Makefile.inc | 5 +++++
|
|
|
aebebb |
multipathd/Makefile | 12 +++++++++++-
|
|
|
aebebb |
multipathd/cli.c | 5 +++++
|
|
|
aebebb |
multipathd/uxclnt.c | 6 ++++++
|
|
|
aebebb |
4 files changed, 27 insertions(+), 1 deletion(-)
|
|
|
aebebb |
|
|
|
aebebb |
diff --git a/Makefile.inc b/Makefile.inc
|
|
|
aebebb |
index 688c4599..05027703 100644
|
|
|
aebebb |
--- a/Makefile.inc
|
|
|
aebebb |
+++ b/Makefile.inc
|
|
|
aebebb |
@@ -14,6 +14,11 @@
|
|
|
aebebb |
#
|
|
|
aebebb |
# Uncomment to disable dmevents polling support
|
|
|
aebebb |
# ENABLE_DMEVENTS_POLL = 0
|
|
|
aebebb |
+#
|
|
|
aebebb |
+# Readline library to use, libedit or libreadline
|
|
|
aebebb |
+# Caution: Using libreadline may make the multipathd binary undistributable,
|
|
|
aebebb |
+# see https://github.com/opensvc/multipath-tools/issues/36
|
|
|
aebebb |
+READLINE = libedit
|
|
|
aebebb |
|
|
|
aebebb |
PKGCONFIG ?= pkg-config
|
|
|
aebebb |
|
|
|
aebebb |
diff --git a/multipathd/Makefile b/multipathd/Makefile
|
|
|
aebebb |
index cd6f7e6d..00342464 100644
|
|
|
aebebb |
--- a/multipathd/Makefile
|
|
|
aebebb |
+++ b/multipathd/Makefile
|
|
|
aebebb |
@@ -19,7 +19,17 @@ CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) \
|
|
|
aebebb |
LDFLAGS += $(BIN_LDFLAGS)
|
|
|
aebebb |
LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
|
|
|
aebebb |
-L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread \
|
|
|
aebebb |
- -ldevmapper -lreadline
|
|
|
aebebb |
+ -ldevmapper
|
|
|
aebebb |
+
|
|
|
aebebb |
+ifeq ($(READLINE),libedit)
|
|
|
aebebb |
+CFLAGS += -DUSE_LIBEDIT
|
|
|
aebebb |
+LIBDEPS += -ledit
|
|
|
aebebb |
+endif
|
|
|
aebebb |
+ifeq ($(READLINE),libreadline)
|
|
|
aebebb |
+CFLAGS += -DUSE_LIBREADLINE
|
|
|
aebebb |
+LIBDEPS += -lreadline
|
|
|
aebebb |
+endif
|
|
|
aebebb |
+
|
|
|
aebebb |
CFLAGS += $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
|
|
|
aebebb |
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }')
|
|
|
aebebb |
|
|
|
aebebb |
diff --git a/multipathd/cli.c b/multipathd/cli.c
|
|
|
aebebb |
index 4d6c37c9..cc547e67 100644
|
|
|
aebebb |
--- a/multipathd/cli.c
|
|
|
aebebb |
+++ b/multipathd/cli.c
|
|
|
aebebb |
@@ -11,7 +11,12 @@
|
|
|
aebebb |
#include "parser.h"
|
|
|
aebebb |
#include "util.h"
|
|
|
aebebb |
#include "version.h"
|
|
|
aebebb |
+#ifdef USE_LIBEDIT
|
|
|
aebebb |
+#include <editline/readline.h>
|
|
|
aebebb |
+#endif
|
|
|
aebebb |
+#ifdef USE_LIBREADLINE
|
|
|
aebebb |
#include <readline/readline.h>
|
|
|
aebebb |
+#endif
|
|
|
aebebb |
|
|
|
aebebb |
#include "mpath_cmd.h"
|
|
|
aebebb |
#include "cli.h"
|
|
|
aebebb |
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
|
|
|
aebebb |
index f16a7309..2c17d8fc 100644
|
|
|
aebebb |
--- a/multipathd/uxclnt.c
|
|
|
aebebb |
+++ b/multipathd/uxclnt.c
|
|
|
aebebb |
@@ -16,8 +16,14 @@
|
|
|
aebebb |
#include <sys/socket.h>
|
|
|
aebebb |
#include <sys/un.h>
|
|
|
aebebb |
#include <poll.h>
|
|
|
aebebb |
+
|
|
|
aebebb |
+#ifdef USE_LIBEDIT
|
|
|
aebebb |
+#include <editline/readline.h>
|
|
|
aebebb |
+#endif
|
|
|
aebebb |
+#ifdef USE_LIBREADLINE
|
|
|
aebebb |
#include <readline/readline.h>
|
|
|
aebebb |
#include <readline/history.h>
|
|
|
aebebb |
+#endif
|
|
|
aebebb |
|
|
|
aebebb |
#include "mpath_cmd.h"
|
|
|
aebebb |
#include "uxsock.h"
|