* Potential licensing issue with libreadline
@ 2021-01-04 12:21 Arturo Borrero Gonzalez
2021-01-04 16:48 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Arturo Borrero Gonzalez @ 2021-01-04 12:21 UTC (permalink / raw)
To: netfilter-devel
Hi,
the debian nftables package got a bug report about a potential licensing issue
related to libreadline. More info here:
https://bugs.debian.org/979103 Legally problematic GPL-3+ readline dependency
This may or may not be a Debian-specific problem, but I wanted to notify you and
collect your ideas before trying to work out a solution myself.
Happy new year!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Potential licensing issue with libreadline
2021-01-04 12:21 Potential licensing issue with libreadline Arturo Borrero Gonzalez
@ 2021-01-04 16:48 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-01-04 16:48 UTC (permalink / raw)
To: Arturo Borrero Gonzalez; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
Hi Arturo,
On Mon, Jan 04, 2021 at 01:21:46PM +0100, Arturo Borrero Gonzalez wrote:
> Hi,
>
> the debian nftables package got a bug report about a potential licensing
> issue related to libreadline. More info here:
>
> https://bugs.debian.org/979103 Legally problematic GPL-3+ readline dependency
>
> This may or may not be a Debian-specific problem, but I wanted to notify you
> and collect your ideas before trying to work out a solution myself.
I'm attaching a quick patch to use libeditreadline shim as suggested.
[-- Attachment #2: libedit.patch --]
[-- Type: text/x-diff, Size: 4184 bytes --]
diff --git a/INSTALL b/INSTALL
index a3f10c372d14..a80bc99f8318 100644
--- a/INSTALL
+++ b/INSTALL
@@ -16,7 +16,7 @@ Installation instructions for nftables
- libgmp
- - libreadline
+ - libedit
- pkg-config
diff --git a/configure.ac b/configure.ac
index 1b493541af3d..ff2e18376066 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,13 +68,13 @@ AC_CHECK_LIB([gmp],[__gmpz_init], , AC_MSG_ERROR([No suitable version of libgmp
AM_CONDITIONAL([BUILD_MINIGMP], [test "x$with_mini_gmp" = xyes])
AC_ARG_WITH([cli], [AS_HELP_STRING([--without-cli],
- [disable interactive CLI (libreadline or linenoise support)])],
- [], [with_cli=readline])
+ [disable interactive CLI (libedit or linenoise support)])],
+ [], [with_cli=edit])
-AS_IF([test "x$with_cli" = xreadline], [
-AC_CHECK_LIB([readline], [readline], ,
- AC_MSG_ERROR([No suitable version of libreadline found]))
-AC_DEFINE([HAVE_LIBREADLINE], [1], [])
+AS_IF([test "x$with_cli" = xedit], [
+AC_CHECK_LIB([edit], [read_history], ,
+ AC_MSG_ERROR([No suitable version of libedit found]))
+AC_DEFINE([HAVE_LIBEDIT], [1], [])
],
[test "x$with_cli" = xlinenoise], [
AC_CHECK_LIB([linenoise], [linenoise], ,
diff --git a/doc/nft.txt b/doc/nft.txt
index 2642d8903787..dabdb8aefb7a 100644
--- a/doc/nft.txt
+++ b/doc/nft.txt
@@ -46,7 +46,7 @@ understanding of their meaning. You can get information about options by running
*-i*::
*--interactive*::
- Read input from an interactive readline CLI. You can use quit to exit, or use the EOF marker,
+ Read input from an interactive CLI. You can use quit to exit, or use the EOF marker,
normally this is CTRL-D.
*-I*::
diff --git a/include/cli.h b/include/cli.h
index d82517750abc..3d93679278b4 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -4,7 +4,7 @@
#include <nftables/libnftables.h>
#include <config.h>
-#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBLINENOISE)
+#if defined(HAVE_LIBEDIT) || defined(HAVE_LIBLINENOISE)
extern int cli_init(struct nft_ctx *nft);
#else
static inline int cli_init(struct nft_ctx *nft)
diff --git a/src/cli.c b/src/cli.c
index 4c0c3e9d67c6..e1950e869dd6 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -21,9 +21,9 @@
#include <string.h>
#include <ctype.h>
#include <limits.h>
-#ifdef HAVE_LIBREADLINE
-#include <readline/readline.h>
-#include <readline/history.h>
+#ifdef HAVE_LIBEDIT
+#include <editline/readline.h>
+#include <editline/history.h>
#else
#include <linenoise.h>
#endif
@@ -48,7 +48,7 @@ init_histfile(void)
snprintf(histfile, sizeof(histfile), "%s/%s", home, CMDLINE_HISTFILE);
}
-#ifdef HAVE_LIBREADLINE
+#ifdef HAVE_LIBEDIT
static struct nft_ctx *cli_nft;
static char *multiline;
@@ -72,8 +72,6 @@ static char *cli_append_multiline(char *line)
if (multiline == NULL) {
multiline = line;
- rl_save_prompt();
- rl_clear_message();
rl_set_prompt(".... ");
} else {
len += strlen(multiline);
@@ -93,7 +91,7 @@ static char *cli_append_multiline(char *line)
if (complete) {
line = multiline;
multiline = NULL;
- rl_restore_prompt();
+ rl_set_prompt("nft> ");
}
return line;
}
@@ -139,10 +137,13 @@ static char **cli_completion(const char *text, int start, int end)
return NULL;
}
+static char nft_readline_name[4];
+
int cli_init(struct nft_ctx *nft)
{
cli_nft = nft;
- rl_readline_name = "nft";
+ sprintf(nft_readline_name, "nft");
+ rl_readline_name = nft_readline_name;
rl_instream = stdin;
rl_outstream = stdout;
@@ -166,7 +167,7 @@ void cli_exit(void)
write_history(histfile);
}
-#else /* !HAVE_LIBREADLINE */
+#else /* !HAVE_LIBEDIT */
int cli_init(struct nft_ctx *nft)
{
@@ -195,4 +196,4 @@ void cli_exit(void)
linenoiseHistorySave(histfile);
}
-#endif /* HAVE_LIBREADLINE */
+#endif /* HAVE_LIBEDIT */
diff --git a/src/main.c b/src/main.c
index 3c26f51029ff..0a2acc41b935 100644
--- a/src/main.c
+++ b/src/main.c
@@ -227,8 +227,8 @@ static void show_version(void)
{
const char *cli, *minigmp, *json, *xt;
-#if defined(HAVE_LIBREADLINE)
- cli = "readline";
+#if defined(HAVE_LIBEDIT)
+ cli = "edit";
#elif defined(HAVE_LIBLINENOISE)
cli = "linenoise";
#else
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-04 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 12:21 Potential licensing issue with libreadline Arturo Borrero Gonzalez
2021-01-04 16:48 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).