Package: lvm2
Severity: wishlist
Tags: patch

lvm2 depends on readline5 which is orphaned (#737301). The current
readline is not license-compatible.

The enclosed patches make the package build with libedit instead which
is a drop-in replacement for readline.
From 0789f4474d9c1f34d1c5ccba6806e6b970f0319a Mon Sep 17 00:00:00 2001
From: Bastian Germann <bastiangerm...@fishpost.de>
Date: Thu, 23 Jul 2020 22:49:49 +0200
Subject: [PATCH 1/2] Build with libedit instead of readline5

---
 configure.ac     | 2 +-
 lib/mm/memlock.c | 2 +-
 tools/lvm.c      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index fc05c7e33..2d8e663a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1431,7 +1431,7 @@ AC_ARG_WITH(tmpfilesdir,
 ################################################################################
 dnl -- Ensure additional headers required
 if test "$READLINE" = yes; then
-	AC_CHECK_LIB([readline], [readline], [READLINE_LIBS="-lreadline"], AC_MSG_ERROR(bailing out))
+	AC_CHECK_LIB([edit], [readline], [READLINE_LIBS="-ledit"], AC_MSG_ERROR(bailing out))
 	AC_DEFINE([READLINE_SUPPORT], 1, [Define to 1 to include the LVM readline shell.])
 fi
 AC_MSG_CHECKING(whether to enable readline)
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index aa47d665b..6cebe63bc 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -121,7 +121,7 @@ static const char * const _blacklist_maps[] = {
 	"/libncurses.so.",	/* not using ncurses during mlock */
 	"/libpcre.so.",		/* not using pcre during mlock (selinux) */
 	"/libpcre2-",		/* not using pcre during mlock (selinux) */
-	"/libreadline.so.",	/* not using readline during mlock */
+	"/libedit.so.",		/* not using editline during mlock */
 	"/libresolv-",		/* not using during mlock (udev) */
 	"/libselinux.so.",	/* not using selinux during mlock */
 	"/libsepol.so.",	/* not using sepol during mlock */
diff --git a/tools/lvm.c b/tools/lvm.c
index 65bc88df4..fa9ac1740 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -24,8 +24,8 @@ int main(int argc, char **argv)
 
 #ifdef READLINE_SUPPORT
 
-#  include <readline/readline.h>
-#  include <readline/history.h>
+#  include <editline/readline.h>
+#  include <editline/history.h>
 
 static struct cmdline_context *_cmdline;
 
-- 
2.27.0

From 0b893ed2dd30ff8acd3618bb72564f7a8c94a938 Mon Sep 17 00:00:00 2001
From: Bastian Germann <bastiangerm...@fishpost.de>
Date: Thu, 23 Jul 2020 23:07:19 +0200
Subject: [PATCH 2/2] d/control: build depend on libedit-dev

---
 debian/control | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 24e649c41..68afd001f 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,7 @@ Build-Depends:
  libdlm-dev (>> 2),
  libdlmcontrol-dev,
  libquorum-dev,
- libreadline-gplv2-dev,
+ libedit-dev,
  libsanlock-dev,
  libselinux1-dev,
  libsystemd-dev,
-- 
2.27.0

Reply via email to