Package: reiser4progs
Severity: wishlist
Tags: patch

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

The enclosed patch makes the package build with libedit instead which is
a drop-in replacement for readline.
diff --git a/debian/control b/debian/control
index 520823b..c27a02d 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: Felix Zielcke <fziel...@z-51.de>
 Build-Depends: debhelper-compat (=13),
                libaal-dev (<< 1.0.8),
                libaal-dev (>= 1.0.7),
-               libreadline-gplv2-dev,
+               libedit-dev,
                uuid-dev
 Standards-Version: 4.5.0
 Rules-Requires-Root: no
@@ -28,7 +28,6 @@ Architecture: linux-any
 Multi-Arch: same
 Depends: libaal-dev (>= 1.0.7),
          libc6-dev | libc-dev,
-         libreadline-gplv2-dev,
          uuid-dev,
          ${misc:Depends}
 Description: Reiser4's filesystem access and manipulation library. Devel files
From: Bastian Germann <bastiangerm...@fishpost.de>
Date: Thu, 23 Jul 2020 20:41:52 +0200
Subject: Build with libedit instead of readline
---
diff --git a/configure.ac b/configure.ac
index ff09e4a..fa77d43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -168,7 +168,7 @@ PROGS_LIBS=""
 if test "x$with_readline" = xyes; then
     	OLD_LIBS="$LIBS"
     	LIBS=""
-    	AC_CHECK_LIB(readline, readline, ,
+    	AC_CHECK_LIB(edit, readline, ,
 	    	AC_MSG_WARN(GNU Readline could not be found which is required \
 for the --with-readline
 	    	)
@@ -321,7 +321,7 @@ are required for the --with-uuid option.
 fi
 
 if test "x$with_readline" = xyes; then
-    	AC_CHECK_HEADERS(readline/readline.h readline/history.h, ,
+    	AC_CHECK_HEADERS(editline/readline.h editline/history.h, ,
 		AC_MSG_WARN(The headers for GNU Readline could not be found which \
 are required for the --with-readline option.
 		)
@@ -396,7 +396,7 @@ if test "x$with_readline" = xyes && test "x$redundant_decls" == xyes; then
 
   	AC_TRY_COMPILE([
 #include <stdio.h> 
-#include <readline/readline.h>
+#include <editline/readline.h>
 	], ,[
 		redundant_decls=yes; 
 		AC_MSG_RESULT(yes)
diff --git a/include/misc/ui.h b/include/misc/ui.h
index e1027f3..23e4f6b 100644
--- a/include/misc/ui.h
+++ b/include/misc/ui.h
@@ -16,7 +16,7 @@ extern void misc_wipe_line(void *stream);
 extern void misc_print_wrap(void *stream, char *text);
 extern char *misc_readline(char *prompt, void *stream);
 
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 extern aal_list_t *misc_get_variant(void);
 extern void misc_set_variant(aal_list_t *list);
 #endif
diff --git a/libmisc/exception.c b/libmisc/exception.c
index 0bdb2b7..8d6b129 100644
--- a/libmisc/exception.c
+++ b/libmisc/exception.c
@@ -144,7 +144,7 @@ extern aal_gauge_t *current_gauge;
 aal_exception_option_t misc_exception_handler(
 	aal_exception_t *exception)		/* exception to be processed */
 {
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 	int i;
 	aal_list_t *variant = NULL;
 #endif
@@ -172,7 +172,7 @@ aal_exception_option_t misc_exception_handler(
 	if (misc_exception_option_count(exception->options, 0) == 1)
 		return exception->options;
 
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 	for (i = 1; i < misc_log2(EXCEPTION_OPT_LAST); i++) {
 		if ((1 << i) & exception->options) {
 			char *name = aal_exception_option_name(1 << i);
@@ -188,7 +188,7 @@ aal_exception_option_t misc_exception_handler(
 		opt = misc_exception_prompt(exception->options, stream);
 	} while (opt == EXCEPTION_OPT_UNHANDLED);
 	
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 	aal_list_free(variant, NULL, NULL);
 	misc_set_variant(NULL);
 #endif
diff --git a/libmisc/ui.c b/libmisc/ui.c
index c2bdcfa..0727b85 100644
--- a/libmisc/ui.c
+++ b/libmisc/ui.c
@@ -12,14 +12,14 @@
 #  include <config.h>
 #endif
 
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 
 #ifndef HAVE_RL_COMPLETION_MATCHES
 #  define OLD_READLINE (1)
 #endif
 
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <editline/readline.h>
+#include <editline/history.h>
 
 #ifndef HAVE_RL_COMPLETION_MATCHES
 #  define rl_completion_matches completion_matches
@@ -31,7 +31,7 @@
 
 static aal_list_t *variant = NULL;
 
-#endif /* defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H) */
+#endif /* defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H) */
 
 #include <misc/misc.h>
 
@@ -48,7 +48,7 @@ char *misc_readline(
 	aal_assert("umka-1021", prompt != NULL);
 	aal_assert("umka-1536", stream != NULL);
     
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 	rl_instream = stdin;
 	rl_outstream = stream;
 	
@@ -131,7 +131,7 @@ void misc_print_wrap(void *stream, char *text) {
 	}
 }
 
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 static char *misc_generator(char *text, int state) {
 	char *opt;
 	char s[80], s1[80];
@@ -265,10 +265,10 @@ static void _init(void) __attribute__((constructor));
 
 static void _init(void) {
 	
-#if defined(HAVE_LIBREADLINE) && defined(HAVE_READLINE_READLINE_H)
+#if defined(HAVE_LIBEDIT) && defined(HAVE_EDITLINE_READLINE_H)
 	rl_initialize();
 	rl_attempted_completion_function = 
-		(CPPFunction *)misc_complete;
+		(rl_completion_func_t *)misc_complete;
 #endif
     
 	aal_exception_set_handler(misc_exception_handler);

Reply via email to