Skip to content

Commit

Permalink
multipathd: replace libreadline with libedit
Browse files Browse the repository at this point in the history
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:
   opensvc/multipath-tools#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 <[email protected]>
  • Loading branch information
mwilck authored and bmarzins committed Aug 18, 2022
1 parent 5df49a4 commit 2bf3401
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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

ifeq ($(TOPDIR),)
TOPDIR = ..
Expand Down
11 changes: 10 additions & 1 deletion multipathd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) \
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
CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
Expand Down
5 changes: 5 additions & 0 deletions multipathd/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions multipathd/uxclnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,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"
Expand Down

0 comments on commit 2bf3401

Please sign in to comment.