1
0
mirror of https://gitlab.isc.org/isc-projects/bind9.git synced 2025-04-18 09:44:09 +03:00

Drop readline alternatives in favor of libedit

The libedit is now ubiquitous and has a licences compatible with
MPL 2.0.  Drop readline (GPL 3.0) and editline (obsolete) support
in favor of libedit.
This commit is contained in:
Ondřej Surý 2025-03-03 12:32:14 +01:00
parent b6e6430b54
commit c27fce26e6
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41
9 changed files with 45 additions and 107 deletions

View File

@ -36,11 +36,8 @@ variables:
AM_COLOR_TESTS: always
WITHOUT_READLINE: "--without-readline"
WITH_READLINE: "--with-readline"
WITH_READLINE_EDITLINE: "--with-readline=editline"
WITH_READLINE_LIBEDIT: "--with-readline=libedit"
WITH_READLINE_READLINE: "--with-readline=readline"
WITHOUT_LIBEDIT: "--without-libedit"
WITH_LIBEDIT: "--with-libedit"
INSTALL_PATH: "${CI_PROJECT_DIR}/.local"
@ -153,7 +150,7 @@ stages:
GIT_CLONE_PATH: "/home/ec2-user/builds/${CI_PROJECT_PATH}/"
# Use MIT Kerberos5 for BIND 9 GSS-API support because of FreeBSD Heimdal
# incompatibility; see https://bugs.freebsd.org/275241.
EXTRA_CONFIGURE: "${WITH_READLINE_EDITLINE} --with-gssapi=/usr/local/bin/krb5-config"
EXTRA_CONFIGURE: "${WITH_LIBEDIT} --with-gssapi=/usr/local/bin/krb5-config"
# Autoscaling GitLab Runner on AWS EC2 (FreeBSD 13)
@ -313,18 +310,10 @@ stages:
- find -name 'tsan.*' -exec "$PYTHON" util/parse_tsan.py {} \;
.check_readline_setup: &check_readline_setup
- if [[ -n "${WITHOUT_READLINE}" ]]; then
! grep "^#define HAVE_READLINE" config.h;
elif [[ -n "${WITH_READLINE}" ]]; then
grep -e "^#define HAVE_READLINE_READLINE"
-e "^#define HAVE_READLINE_LIBEDIT"
-e "^#define HAVE_READLINE_EDITLINE" config.h;
elif [[ -n "${WITH_READLINE_EDITLINE}" ]]; then
grep "^#define HAVE_READLINE_EDITLINE" config.h;
elif [[ -n "${WITH_READLINE_LIBEDIT}" ]]; then
grep "^#define HAVE_READLINE_LIBEDIT" config.h;
elif [[ -n "${WITH_READLINE_READLINE}" ]]; then
grep "^#define HAVE_READLINE_READLINE" config.h;
- if [[ -n "${WITHOUT_LIBEDIT}" ]]; then
! grep "^#define HAVE_LIBEDIT" config.h;
elif [[ -n "${WITH_LIBEDIT}" ]]; then
grep -e "^#define HAVE_LIBEDIT" config.h;
fi
# Unpack release tarball and continue work in the extracted directory.
@ -831,7 +820,7 @@ gcc:alpine3.21:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON}"
EXTRA_CONFIGURE: "${WITHOUT_READLINE}"
EXTRA_CONFIGURE: "${WITHOUT_LIBEDIT}"
<<: *alpine_3_21_amd64_image
<<: *build_job
@ -971,7 +960,7 @@ gcc:bookworm:amd64:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} --coverage -O0"
# Tracing needs to be disabled otherwise gcovr fails
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_LIBEDIT} --disable-tracing"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_LIBEDIT} --disable-tracing"
RUN_MAKE_INSTALL: 1
<<: *debian_bookworm_amd64_image
<<: *build_job
@ -1028,7 +1017,7 @@ gcc:bookworm:amd64cross32:
variables:
CFLAGS: "${CFLAGS_COMMON}"
CROSS_COMPILATION: 1
EXTRA_CONFIGURE: "--build=x86_64-linux-gnu --host=i686-linux-gnu --with-libidn2 ${WITH_READLINE_LIBEDIT}"
EXTRA_CONFIGURE: "--build=x86_64-linux-gnu --host=i686-linux-gnu --with-libidn2 ${WITH_LIBEDIT}"
<<: *debian_bookworm_amd64cross32_image
<<: *build_job
@ -1099,7 +1088,7 @@ gcc:sid:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -O3"
EXTRA_CONFIGURE: "--with-libidn2 --without-lmdb ${WITH_READLINE}"
EXTRA_CONFIGURE: "--with-libidn2 --without-lmdb ${WITH_LIBEDIT}"
RUN_MAKE_INSTALL: 1
<<: *debian_sid_amd64_image
<<: *build_job
@ -1198,7 +1187,7 @@ gcc:tumbleweed:amd64:
variables:
CC: gcc
CFLAGS: "${CFLAGS_COMMON} -DDEBUG"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE_READLINE}"
EXTRA_CONFIGURE: "--with-libidn2 ${WITH_LIBEDIT}"
<<: *tumbleweed_latest_amd64_image
<<: *build_job

View File

@ -6,6 +6,7 @@ AM_CPPFLAGS += \
$(LIBISCCFG_CFLAGS) \
$(LIBIDN2_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(LIBEDIT_CFLAGS) \
$(LIBUV_CFLAGS) \
$(OPENSSL_CFLAGS)
@ -15,6 +16,7 @@ LDADD += \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(OPENSSL_LIBS) \
$(LIBEDIT_LIBS) \
$(LIBIDN2_LIBS)
noinst_LTLIBRARIES = libdighost.la
@ -24,16 +26,3 @@ libdighost_la_SOURCES = \
dighost.c
bin_PROGRAMS = dig host nslookup
nslookup_CPPFLAGS = \
$(AM_CPPFLAGS)
nslookup_LDADD = \
$(LDADD)
if HAVE_READLINE
nslookup_CPPFLAGS += \
$(READLINE_CFLAGS)
nslookup_LDADD += \
$(READLINE_LIBS)
endif HAVE_READLINE

View File

@ -24,6 +24,7 @@
#include <isc/loop.h>
#include <isc/netaddr.h>
#include <isc/parseint.h>
#include <isc/readline.h>
#include <isc/string.h>
#include <isc/util.h>
#include <isc/work.h>
@ -40,7 +41,6 @@
#include <dns/rdatatype.h>
#include "dighost.h"
#include "readline.h"
static char cmdlinebuf[COMMSIZE];
static char *cmdline = NULL;

View File

@ -6,7 +6,7 @@ AM_CPPFLAGS += \
$(LIBISCCFG_CFLAGS) \
$(GSSAPI_CFLAGS) \
$(KRB5_CFLAGS) \
$(READLINE_CFLAGS)
$(LIBEDIT_CFLAGS)
AM_CPPFLAGS += \
-DSESSION_KEYFILE=\"${localstatedir}/run/named/session.key\"
@ -16,15 +16,7 @@ LDADD += \
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS) \
$(GSSAPI_LIBS) \
$(KRB5_LIBS)
if HAVE_READLINE
LDADD += \
$(READLINE_LIBS)
endif
$(KRB5_LIBS) \
$(LIBEDIT_LIBS)
bin_PROGRAMS = nsupdate
nsupdate_SOURCES = \
nsupdate.c \
../dig/readline.h

View File

@ -40,6 +40,7 @@
#include <isc/parseint.h>
#include <isc/portset.h>
#include <isc/random.h>
#include <isc/readline.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
@ -93,8 +94,6 @@
#endif /* HAVE_GSSAPI */
#include "../dig/readline.h"
#define MAXCMD (128 * 1024)
#define MAXWIRE (64 * 1024)
#define INITTEXT (2 * 1024)

View File

@ -886,45 +886,26 @@ AS_IF([test "$enable_tcp_fastopen" = "yes"],
AC_CHECK_FUNCS([strlcpy strlcat strnstr])
#
# Check for readline support
# Check for libedit support
#
# [pairwise: --with-libedit=auto, --with-libedit=yes, --without-libedit]
AC_ARG_WITH([libedit],
[AS_HELP_STRING([--with-libedit=auto|yes|no],
[specify libedit library [default auto]])],
[], [with_libedit="auto"])
# editline is not included in pairwise testing as the library
# is not present in the relevant Docker image.
#
# GNU Readline is not included in pairwise testing as the library
# in the relevant Docker image does not support pkg-config.
#
# [pairwise: --with-readline=auto, --with-readline=yes, --with-readline=libedit, --without-readline]
AC_ARG_WITH([readline],
[AS_HELP_STRING([--with-readline=yes|no|libedit|readline],
[specify readline library [default auto]])],
[], [with_readline="auto"])
AS_CASE([$with_libedit],
[no], [],
[auto], [PKG_CHECK_MODULES([LIBEDIT], [libedit],
[AC_DEFINE([HAVE_LIBEDIT], [1], [Build with libedit support])],
[:])],
AS_CASE([$with_readline],
[no],[],
[auto|yes],
[PKG_CHECK_MODULES([READLINE], [libedit],
[AC_DEFINE([HAVE_READLINE_LIBEDIT], [1], [Build with libedit support])],
[PKG_CHECK_MODULES([READLINE], [libeditline],
[AC_DEFINE([HAVE_READLINE_EDITLINE], [1], [Build with editline support.])],
[PKG_CHECK_MODULES([READLINE], [readline],
[AC_DEFINE([HAVE_READLINE_READLINE], [1], [Build with readline support.])],
[AS_IF([test "$with_readline" = "yes"],
[AC_MSG_ERROR([readline support requested, but none of the libraries have been found.])])])])])],
[libedit],
[PKG_CHECK_MODULES([READLINE], [libedit],
[AC_DEFINE([HAVE_READLINE_LIBEDIT], [1], [Build with libedit support])])],
[editline],
[PKG_CHECK_MODULES([READLINE], [libeditline],
[AC_DEFINE([HAVE_READLINE_EDITLINE], [1], [Build with editline support])])],
[readline],
[PKG_CHECK_MODULES([READLINE], [readline],
[AC_DEFINE([HAVE_READLINE_READLINE], [1], [Build with readline support])])],
[AC_MSG_ERROR([Unknown readline '$with_readline' library requested.])])
AM_CONDITIONAL([HAVE_READLINE], [test -n "$READLINE_LIBS"])
AC_SUBST([READLINE_CFLAGS])
AC_SUBST([READLINE_LIBS])
[yes], [PKG_CHECK_MODULES([LIBEDIT], [libedit],
[AC_DEFINE([HAVE_LIBEDIT], [1], [Build with libedit support])])],
[AC_MSG_ERROR([Specifying libedit installation path is not supported, adjust PKG_CONFIG_PATH instead])])
AM_CONDITIONAL([HAVE_LIBEDIT], [test -n "$LIBEDIT_LIBS"])
AC_SUBST([LIBEDIT_CFLAGS])
AC_SUBST([LIBEDIT_LIBS])
#
# Security Stuff

View File

@ -139,12 +139,10 @@ To support internationalized domain names in :iscman:`dig`, ``libidn2``
library is installed in a nonstandard location, specify the prefix using
``--with-libidn2=/prefix`` or adjust ``PKG_CONFIG_PATH``.
For line editing in :iscman:`nsupdate` and :iscman:`nslookup`, either the
``readline`` (https://tiswww.case.edu/php/chet/readline/rltop.html) or
For line editing in :iscman:`nsupdate` and :iscman:`nslookup`,
the ``libedit`` library (https://www.thrysoee.dk/editline/) must be
installed. If these are installed at a nonstandard location, adjust
``PKG_CONFIG_PATH``. ``readline`` is used by default, and ``libedit``
can be explicitly requested using ``--with-readline=libedit``.
``PKG_CONFIG_PATH``.
On some platforms it is necessary to explicitly request large file
support to handle files bigger than 2GB. This can be done by using

View File

@ -68,6 +68,7 @@ libisc_la_HEADERS = \
include/isc/radix.h \
include/isc/random.h \
include/isc/ratelimiter.h \
include/isc/readline.h \
include/isc/refcount.h \
include/isc/regex.h \
include/isc/region.h \

View File

@ -14,26 +14,15 @@
#pragma once
/*
* A little wrapper around readline(), add_history() and free() to make using
* A little wrapper around readline(), and add_history() to make using
* the readline code simpler.
*/
#if defined(HAVE_READLINE_LIBEDIT)
#include <editline/readline.h>
#elif defined(HAVE_READLINE_EDITLINE)
#include <editline.h>
#elif defined(HAVE_READLINE_READLINE)
/* Prevent deprecated functions being declared. */
#define _FUNCTION_DEF 1
/* Ensure rl_message() gets prototype. */
#define USE_VARARGS 1
#define PREFER_STDARG 1
#include <readline/history.h>
#include <readline/readline.h>
#endif
#ifdef HAVE_LIBEDIT
#if !defined(HAVE_READLINE_LIBEDIT) && !defined(HAVE_READLINE_EDITLINE) && \
!defined(HAVE_READLINE_READLINE)
#include <editline/readline.h>
#else /* HAVE_LIBEDIT */
#include <stdio.h>
#include <stdlib.h>
@ -55,4 +44,4 @@ readline(const char *prompt) {
#define add_history(line)
#endif
#endif /* HAVE_LIBEDIT */