aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <rbt@sent.as>2024-09-08 18:37:28 -0700
committerRebecca Turner <rbt@sent.as>2024-09-16 10:48:20 -0700
commit7ae0409989187d44044c4cd6f274f0a02ec5f826 (patch)
treea8c0d1e6f64687204776118c90a0dfa713b710bd
parente9505dcc5a0ff259b9e284e9e617486e81a1ff6f (diff)
Remove readline support
Lix cannot be built with GNU readline, and we would "rather not" be GPL. Change-Id: I0e86f0f10dab966ab1d1d467fb61fd2de50c00de
-rw-r--r--doc/manual/rl-next/readline-support-removed.md17
-rw-r--r--src/libcmd/repl-interacter.cc9
-rw-r--r--src/libutil/experimental-features.cc2
3 files changed, 18 insertions, 10 deletions
diff --git a/doc/manual/rl-next/readline-support-removed.md b/doc/manual/rl-next/readline-support-removed.md
new file mode 100644
index 000000000..6e4faeb67
--- /dev/null
+++ b/doc/manual/rl-next/readline-support-removed.md
@@ -0,0 +1,17 @@
+---
+synopsis: readline support removed
+cls: [1885]
+category: Packaging
+credits: [9999years]
+---
+
+Support for building Lix with [`readline`][readline] instead of
+[`editline`][editline] has been removed. `readline` support hasn't worked for a
+long time (attempting to use it would lead to build errors) and would make Lix
+subject to the GPL if it did work. In the future, we're hoping to replace
+`editline` with [`rustyline`][rustyline] for improved ergonomics in the `nix
+repl`.
+
+[readline]: https://en.wikipedia.org/wiki/GNU_Readline
+[editline]: https://github.com/troglobit/editline
+[rustyline]: https://github.com/kkawakam/rustyline
diff --git a/src/libcmd/repl-interacter.cc b/src/libcmd/repl-interacter.cc
index 6979e3db4..459b048f4 100644
--- a/src/libcmd/repl-interacter.cc
+++ b/src/libcmd/repl-interacter.cc
@@ -8,10 +8,6 @@
#include <string_view>
#include <cerrno>
-#ifdef READLINE
-#include <readline/history.h>
-#include <readline/readline.h>
-#else
// editline < 1.15.2 don't wrap their API for C++ usage
// (added in https://github.com/troglobit/editline/commit/91398ceb3427b730995357e9d120539fb9bb7461).
// This results in linker errors due to to name-mangling of editline C symbols.
@@ -20,7 +16,6 @@
extern "C" {
#include <editline.h>
}
-#endif
#include "finally.hh"
#include "repl-interacter.hh"
@@ -115,17 +110,13 @@ ReadlineLikeInteracter::Guard ReadlineLikeInteracter::init(detail::ReplCompleter
} catch (SysError & e) {
logWarning(e.info());
}
-#ifndef READLINE
el_hist_size = 1000;
-#endif
read_history(historyFile.c_str());
auto oldRepl = curRepl;
curRepl = repl;
Guard restoreRepl([oldRepl] { curRepl = oldRepl; });
-#ifndef READLINE
rl_set_complete_func(completionCallback);
rl_set_list_possib_func(listPossibleCallback);
-#endif
return restoreRepl;
}
diff --git a/src/libutil/experimental-features.cc b/src/libutil/experimental-features.cc
index 35982c28c..bb7a95a24 100644
--- a/src/libutil/experimental-features.cc
+++ b/src/libutil/experimental-features.cc
@@ -247,7 +247,7 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
.tag = Xp::ReplAutomation,
.name = "repl-automation",
.description = R"(
- Makes the repl not use readline/editline, print ENQ (U+0005) when ready for a command, and take commands followed by newline.
+ Makes the repl not use editline, print ENQ (U+0005) when ready for a command, and take commands followed by newline.
)",
},
}};