[dm-devel] [PATCH 2/2] multipathd: replace libreadline with libedit
Benjamin Marzinski
bmarzins at redhat.com
Fri Aug 19 17:56:24 UTC 2022
On Fri, Aug 12, 2022 at 08:55:48PM +0200, mwilck at suse.com wrote:
> From: Martin Wilck <mwilck at suse.com>
>
> Linking multipathd with libreadline may cause a license conflict,
> because libreadline is licensed under GPL-3.0-or-later, and
> libmultipath contains several files under GPL-2.0.
>
> See:
> https://github.com/opensvc/multipath-tools/issues/36
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979095
> https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility
>
> Replace the readline functionality with libedit, which comes under
> a BSD license. The readline library can still be enabled (e.g. for
> binaries not intended to be distributed) by running
> "make READLINE=libreadline".
>
> Signed-off-by: Martin Wilck <mwilck at suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
> Makefile.inc | 5 +++++
> multipathd/Makefile | 11 ++++++++++-
> multipathd/cli.c | 5 +++++
> multipathd/uxclnt.c | 6 ++++++
> 4 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile.inc b/Makefile.inc
> index bcd2212..ad7afd0 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -8,6 +8,11 @@
> #
> # Uncomment to disable dmevents polling support
> # ENABLE_DMEVENTS_POLL = 0
> +#
> +# Readline library to use, libedit or libreadline
> +# Caution: Using libreadline may make the multipathd binary undistributable,
> +# see https://github.com/opensvc/multipath-tools/issues/36
> +READLINE = libedit
>
> # List of scsi device handler modules to load on boot, e.g.
> # SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac
> diff --git a/multipathd/Makefile b/multipathd/Makefile
> index c937cd5..95acd88 100644
> --- a/multipathd/Makefile
> +++ b/multipathd/Makefile
> @@ -22,7 +22,16 @@ CFLAGS += $(BIN_CFLAGS)
> LDFLAGS += $(BIN_LDFLAGS)
> LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
> -L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread \
> - -ldevmapper -lreadline
> + -ldevmapper
> +
> +ifeq ($(READLINE),libedit)
> +CPPFLAGS += -DUSE_LIBEDIT
> +LIBDEPS += -ledit
> +endif
> +ifeq ($(READLINE),libreadline)
> +CPPFLAGS += -DUSE_LIBREADLINE
> +LIBDEPS += -lreadline
> +endif
>
> ifdef SYSTEMD
> CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
> diff --git a/multipathd/cli.c b/multipathd/cli.c
> index b2ee9a9..fa482a6 100644
> --- a/multipathd/cli.c
> +++ b/multipathd/cli.c
> @@ -11,7 +11,12 @@
> #include "parser.h"
> #include "util.h"
> #include "version.h"
> +#ifdef USE_LIBEDIT
> +#include <editline/readline.h>
> +#endif
> +#ifdef USE_LIBREADLINE
> #include <readline/readline.h>
> +#endif
>
> #include "mpath_cmd.h"
> #include "cli.h"
> diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
> index bdcc7c3..251e7d7 100644
> --- a/multipathd/uxclnt.c
> +++ b/multipathd/uxclnt.c
> @@ -16,8 +16,14 @@
> #include <sys/socket.h>
> #include <sys/un.h>
> #include <poll.h>
> +
> +#ifdef USE_LIBEDIT
> +#include <editline/readline.h>
> +#endif
> +#ifdef USE_LIBREADLINE
> #include <readline/readline.h>
> #include <readline/history.h>
> +#endif
>
> #include "mpath_cmd.h"
> #include "uxsock.h"
> --
> 2.37.1
More information about the dm-devel
mailing list