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