Skip to contentSkip to conversation

xfsprogs: remove libreadline support

PATCH In review Christoph Hellwig 2 participants 2 messages Apr 27, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: remove libreadline support

libreadline has been relicensed to GPLv3 and thus incompatible to xfsprogs many years ago, and all the distros have dropped or are in the stages of dropping the last GPLv2 version. As the BSD licensed libeditline provides the same functionality there is no need to keep the obsolete libreadline support around.

---
 configure.ac         |  7 -------
 db/Makefile          |  5 -----
 db/input.c           | 26 ++------------------------
 growfs/Makefile      |  3 ---
 include/builddefs.in |  2 --
 io/Makefile          |  4 ----
 libxcmd/Makefile     |  5 -----
 libxcmd/input.c      | 18 ++----------------
 quota/Makefile       |  5 -----
 spaceman/Makefile    |  4 ----
 10 files changed, 4 insertions(+), 75 deletions(-)
configure.ac +0 -7
index c609ff6a..0d1ca43e 100644
@@ -42,13 +42,6 @@ AC_ARG_ENABLE(blkid,
 	enable_blkid=yes)
 AC_SUBST(enable_blkid)
 
-AC_ARG_ENABLE(readline,
-[  --enable-readline=[yes/no] Enable readline command editing [default=no]],
-	test $enable_readline = yes && libreadline="-lreadline",
-	enable_readline=no)
-AC_SUBST(libreadline)
-AC_SUBST(enable_readline)
-
 AC_ARG_ENABLE(editline,
 [  --enable-editline=[yes/no] Enable editline command editing [default=no]],
 	test $enable_editline = yes && libeditline="-ledit",
db/Makefile +0 -5
index ed9f56c2..9bd9bf51 100644
@@ -21,11 +21,6 @@ LLDLIBS	= $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
 LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBFROG)
 LLDFLAGS += -static-libtool-libs
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-CFLAGS += -DENABLE_READLINE
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 CFLAGS += -DENABLE_EDITLINE
db/input.c +2 -24
index 4d6c7376..553025bc 100644
@@ -13,10 +13,7 @@
 #include "malloc.h"
 #include "init.h"
 
-#if defined(ENABLE_READLINE)
-# include <readline/history.h>
-# include <readline/readline.h>
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 # include <histedit.h>
 #endif
 
@@ -211,26 +208,7 @@ fetchline_internal(void)
 	return rval;
 }
 
-#ifdef ENABLE_READLINE
-char *
-fetchline(void)
-{
-	char	*line;
-
-	if (inputstacksize == 1) {
-		line = readline(get_prompt());
-		if (!line)
-			dbprintf("\n");
-		else if (line && *line) {
-			add_history(line);
-			logprintf("%s", line);
-		}
-	} else {
-		line = fetchline_internal();
-	}
-	return line;
-}
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 static char *el_get_prompt(EditLine *e) { return get_prompt(); }
 char *
 fetchline(void)
growfs/Makefile +0 -3
index 4104cc0d..a107d348 100644
@@ -10,9 +10,6 @@ LTCOMMAND = xfs_growfs
 CFILES = xfs_growfs.c
 
 LLDLIBS = $(LIBXFS) $(LIBXCMD) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
 
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
include/builddefs.in +0 -2
index 6ed9d295..30b2727a 100644
@@ -25,7 +25,6 @@ LIBUUID = @libuuid@
 LIBPTHREAD = @libpthread@
 LIBTERMCAP = @libtermcap@
 LIBEDITLINE = @libeditline@
-LIBREADLINE = @libreadline@
 LIBBLKID = @libblkid@
 LIBDEVMAPPER = @libdevmapper@
 LIBXFS = $(TOPDIR)/libxfs/libxfs.la
@@ -82,7 +81,6 @@ RPM_VERSION	= @rpm_version@
 ENABLE_SHARED	= @enable_shared@
 ENABLE_GETTEXT	= @enable_gettext@
 ENABLE_EDITLINE	= @enable_editline@
-ENABLE_READLINE	= @enable_readline@
 ENABLE_BLKID	= @enable_blkid@
 ENABLE_SCRUB	= @enable_scrub@
 
io/Makefile +0 -4
index 1112605e..71741926 100644
@@ -68,10 +68,6 @@ ifeq ($(HAVE_SYNCFS),yes)
 LCFLAGS += -DHAVE_SYNCFS
 endif
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
libxcmd/Makefile +0 -5
index f9bc1c5c..70e54308 100644
@@ -14,11 +14,6 @@ LTLDFLAGS += -static
 
 CFILES = command.c input.c help.c quit.c
 
-ifeq ($(ENABLE_READLINE),yes)
-LCFLAGS += -DENABLE_READLINE
-LTLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LCFLAGS += -DENABLE_EDITLINE
 LTLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
libxcmd/input.c +2 -16
index 137856e3..203110df 100644
@@ -9,10 +9,7 @@
 #include <ctype.h>
 #include <stdbool.h>
 
-#if defined(ENABLE_READLINE)
-# include <readline/history.h>
-# include <readline/readline.h>
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 # include <histedit.h>
 #endif
 
@@ -28,18 +25,7 @@ get_prompt(void)
 	return prompt;
 }
 
-#if defined(ENABLE_READLINE)
-char *
-fetchline(void)
-{
-	char	*line;
-
-	line = readline(get_prompt());
-	if (line && *line)
-		add_history(line);
-	return line;
-}
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 static char *el_get_prompt(EditLine *e) { return get_prompt(); }
 char *
 fetchline(void)
quota/Makefile +0 -5
index 384f023a..da5a1489 100644
@@ -14,11 +14,6 @@ LLDLIBS = $(LIBXCMD) $(LIBFROG)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBFROG)
 LLDFLAGS = -static
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-CFLAGS += -DENABLE_READLINE
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 CFLAGS += -DENABLE_EDITLINE
spaceman/Makefile +0 -4
index d01aa74a..2a366918 100644
@@ -14,10 +14,6 @@ LLDLIBS = $(LIBXCMD) $(LIBFROG)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBFROG)
 LLDFLAGS = -static
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
Signature · 1 line
2.26.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Christoph Hellwig

libreadline has been relicensed to GPLv3 and thus incompatible to xfsprogs many years ago, and all the distros have dropped or are in the stages of dropping the last GPLv2 version. As the BSD licensed libeditline provides the same functionality there is no need to keep the obsolete libreadline support around.

Seems reasonable, but did you notice that xfs_io segfaults if you build with libedit and feed stdin garbage/EOF? :)

Anyway this is a straightforward removal, so:

--D

Quoted 226 lines
---
 configure.ac         |  7 -------
 db/Makefile          |  5 -----
 db/input.c           | 26 ++------------------------
 growfs/Makefile      |  3 ---
 include/builddefs.in |  2 --
 io/Makefile          |  4 ----
 libxcmd/Makefile     |  5 -----
 libxcmd/input.c      | 18 ++----------------
 quota/Makefile       |  5 -----
 spaceman/Makefile    |  4 ----
 10 files changed, 4 insertions(+), 75 deletions(-)
configure.ac +0 -7
index c609ff6a..0d1ca43e 100644
@@ -42,13 +42,6 @@ AC_ARG_ENABLE(blkid,
 	enable_blkid=yes)
 AC_SUBST(enable_blkid)
 
-AC_ARG_ENABLE(readline,
-[  --enable-readline=[yes/no] Enable readline command editing [default=no]],
-	test $enable_readline = yes && libreadline="-lreadline",
-	enable_readline=no)
-AC_SUBST(libreadline)
-AC_SUBST(enable_readline)
-
 AC_ARG_ENABLE(editline,
 [  --enable-editline=[yes/no] Enable editline command editing [default=no]],
 	test $enable_editline = yes && libeditline="-ledit",
db/Makefile +0 -5
index ed9f56c2..9bd9bf51 100644
@@ -21,11 +21,6 @@ LLDLIBS	= $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
 LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG) $(LIBFROG)
 LLDFLAGS += -static-libtool-libs
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-CFLAGS += -DENABLE_READLINE
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 CFLAGS += -DENABLE_EDITLINE
db/input.c +2 -24
index 4d6c7376..553025bc 100644
@@ -13,10 +13,7 @@
 #include "malloc.h"
 #include "init.h"
 
-#if defined(ENABLE_READLINE)
-# include <readline/history.h>
-# include <readline/readline.h>
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 # include <histedit.h>
 #endif
 
@@ -211,26 +208,7 @@ fetchline_internal(void)
 	return rval;
 }
 
-#ifdef ENABLE_READLINE
-char *
-fetchline(void)
-{
-	char	*line;
-
-	if (inputstacksize == 1) {
-		line = readline(get_prompt());
-		if (!line)
-			dbprintf("\n");
-		else if (line && *line) {
-			add_history(line);
-			logprintf("%s", line);
-		}
-	} else {
-		line = fetchline_internal();
-	}
-	return line;
-}
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 static char *el_get_prompt(EditLine *e) { return get_prompt(); }
 char *
 fetchline(void)
growfs/Makefile +0 -3
index 4104cc0d..a107d348 100644
@@ -10,9 +10,6 @@ LTCOMMAND = xfs_growfs
 CFILES = xfs_growfs.c
 
 LLDLIBS = $(LIBXFS) $(LIBXCMD) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
 
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
include/builddefs.in +0 -2
index 6ed9d295..30b2727a 100644
@@ -25,7 +25,6 @@ LIBUUID = @libuuid@
 LIBPTHREAD = @libpthread@
 LIBTERMCAP = @libtermcap@
 LIBEDITLINE = @libeditline@
-LIBREADLINE = @libreadline@
 LIBBLKID = @libblkid@
 LIBDEVMAPPER = @libdevmapper@
 LIBXFS = $(TOPDIR)/libxfs/libxfs.la
@@ -82,7 +81,6 @@ RPM_VERSION	= @rpm_version@
 ENABLE_SHARED	= @enable_shared@
 ENABLE_GETTEXT	= @enable_gettext@
 ENABLE_EDITLINE	= @enable_editline@
-ENABLE_READLINE	= @enable_readline@
 ENABLE_BLKID	= @enable_blkid@
 ENABLE_SCRUB	= @enable_scrub@
 
io/Makefile +0 -4
index 1112605e..71741926 100644
@@ -68,10 +68,6 @@ ifeq ($(HAVE_SYNCFS),yes)
 LCFLAGS += -DHAVE_SYNCFS
 endif
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
libxcmd/Makefile +0 -5
index f9bc1c5c..70e54308 100644
@@ -14,11 +14,6 @@ LTLDFLAGS += -static
 
 CFILES = command.c input.c help.c quit.c
 
-ifeq ($(ENABLE_READLINE),yes)
-LCFLAGS += -DENABLE_READLINE
-LTLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LCFLAGS += -DENABLE_EDITLINE
 LTLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
libxcmd/input.c +2 -16
index 137856e3..203110df 100644
@@ -9,10 +9,7 @@
 #include <ctype.h>
 #include <stdbool.h>
 
-#if defined(ENABLE_READLINE)
-# include <readline/history.h>
-# include <readline/readline.h>
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 # include <histedit.h>
 #endif
 
@@ -28,18 +25,7 @@ get_prompt(void)
 	return prompt;
 }
 
-#if defined(ENABLE_READLINE)
-char *
-fetchline(void)
-{
-	char	*line;
-
-	line = readline(get_prompt());
-	if (line && *line)
-		add_history(line);
-	return line;
-}
-#elif defined(ENABLE_EDITLINE)
+#ifdef ENABLE_EDITLINE
 static char *el_get_prompt(EditLine *e) { return get_prompt(); }
 char *
 fetchline(void)
quota/Makefile +0 -5
index 384f023a..da5a1489 100644
@@ -14,11 +14,6 @@ LLDLIBS = $(LIBXCMD) $(LIBFROG)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBFROG)
 LLDFLAGS = -static
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-CFLAGS += -DENABLE_READLINE
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 CFLAGS += -DENABLE_EDITLINE
spaceman/Makefile +0 -4
index d01aa74a..2a366918 100644
@@ -14,10 +14,6 @@ LLDLIBS = $(LIBXCMD) $(LIBFROG)
 LTDEPENDENCIES = $(LIBXCMD) $(LIBFROG)
 LLDFLAGS = -static
 
-ifeq ($(ENABLE_READLINE),yes)
-LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
-endif
-
 ifeq ($(ENABLE_EDITLINE),yes)
 LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
 endif
Signature · 1 line
2.26.1