diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fda94aa60e..33985b21d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/bin/dig/Makefile.am b/bin/dig/Makefile.am index 18af2407c2..0aadcd3bc2 100644 --- a/bin/dig/Makefile.am +++ b/bin/dig/Makefile.am @@ -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 diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index 5001c0dfeb..a6b30183f4 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +41,6 @@ #include #include "dighost.h" -#include "readline.h" static char cmdlinebuf[COMMSIZE]; static char *cmdline = NULL; diff --git a/bin/nsupdate/Makefile.am b/bin/nsupdate/Makefile.am index 4ef15ed799..c37189a7ef 100644 --- a/bin/nsupdate/Makefile.am +++ b/bin/nsupdate/Makefile.am @@ -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 diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index be1d720c4a..30bf9a15c3 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -93,8 +94,6 @@ #endif /* HAVE_GSSAPI */ -#include "../dig/readline.h" - #define MAXCMD (128 * 1024) #define MAXWIRE (64 * 1024) #define INITTEXT (2 * 1024) diff --git a/configure.ac b/configure.ac index c3c16f69db..46de92c5dd 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/doc/arm/build.inc.rst b/doc/arm/build.inc.rst index b87b82c9ce..bbceecb546 100644 --- a/doc/arm/build.inc.rst +++ b/doc/arm/build.inc.rst @@ -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 diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am index 1cdc540fb2..ad3d69a05b 100644 --- a/lib/isc/Makefile.am +++ b/lib/isc/Makefile.am @@ -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 \ diff --git a/bin/dig/readline.h b/lib/isc/include/isc/readline.h similarity index 60% rename from bin/dig/readline.h rename to lib/isc/include/isc/readline.h index 5341994586..a3979d56bb 100644 --- a/bin/dig/readline.h +++ b/lib/isc/include/isc/readline.h @@ -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 -#elif defined(HAVE_READLINE_EDITLINE) -#include -#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 -#include -#endif +#ifdef HAVE_LIBEDIT -#if !defined(HAVE_READLINE_LIBEDIT) && !defined(HAVE_READLINE_EDITLINE) && \ - !defined(HAVE_READLINE_READLINE) +#include + +#else /* HAVE_LIBEDIT */ #include #include @@ -55,4 +44,4 @@ readline(const char *prompt) { #define add_history(line) -#endif +#endif /* HAVE_LIBEDIT */