[Pkg-voip-commits] [asterisk] 01/02: Import upstream fix for libedit unicode garbage
Bernhard Schmidt
berni at moszumanska.debian.org
Fri Dec 2 12:38:21 UTC 2016
This is an automated email from the git hooks/post-receive script.
berni pushed a commit to branch master
in repository asterisk.
commit 1ebd10163e3e48657e44aa0537f6eacb27d3da6a
Author: Bernhard Schmidt <berni at debian.org>
Date: Thu Dec 1 20:12:11 2016 +0100
Import upstream fix for libedit unicode garbage
Closes: #845144
---
debian/patches/fix_libedit_unicode.patch | 222 +++++++++++++++++++++++++++++++
debian/patches/series | 3 +
2 files changed, 225 insertions(+)
diff --git a/debian/patches/fix_libedit_unicode.patch b/debian/patches/fix_libedit_unicode.patch
new file mode 100644
index 0000000..d6ac6ec
--- /dev/null
+++ b/debian/patches/fix_libedit_unicode.patch
@@ -0,0 +1,222 @@
+From 5e0c22404316ecdf8e1510553474274eddf55e20 Mon Sep 17 00:00:00 2001
+From: George Joseph <gjoseph at digium.com>
+Date: Mon, 14 Nov 2016 11:16:03 -0700
+Subject: [PATCH] cli: Fix ast_el_read_char to work with libedit >= 3.1
+
+Libedit 3.1 is not build with unicode on as a default and so the
+prototype for the el_gets callback changed from expecting a char buffer
+to accepting a wchar buffer. If ast_el_read_char isn't changed,
+the cli reads garbage from teh terminal.
+
+Added a configure test for (*el_rfunc_t)(EditLine *, wchar_t *) and
+updated ast_el_read_char to use the HAVE_ define to detemrine whether
+to use char or wchar.
+
+ASTERISK-26592 #close
+
+Change-Id: I9099b46f68e06d0202ff80e53022a2b68b08871a
+---
+ configure | 65 +++++++++++++++++++++++++++++++++++++++-
+ configure.ac | 6 +++-
+ include/asterisk/autoconfig.h.in | 3 ++
+ main/asterisk.c | 21 ++++++++++++-
+ 4 files changed, 92 insertions(+), 3 deletions(-)
+
+diff --git a/configure b/configure
+index 0446c45..0214a0b 100755
+--- a/configure
++++ b/configure
+@@ -1031,6 +1031,10 @@ PBX_LIBXML2
+ LIBXML2_DIR
+ LIBXML2_INCLUDE
+ LIBXML2_LIB
++PBX_LIBEDIT_IS_UNICODE
++LIBEDIT_IS_UNICODE_DIR
++LIBEDIT_IS_UNICODE_INCLUDE
++LIBEDIT_IS_UNICODE_LIB
+ PBX_LIBEDIT
+ LIBEDIT_DIR
+ LIBEDIT_INCLUDE
+@@ -10652,6 +10656,18 @@ fi
+
+
+
++LIBEDIT_IS_UNICODE_DESCRIP="Libedit compiled for unicode"
++LIBEDIT_IS_UNICODE_OPTION=libedit
++LIBEDIT_IS_UNICODE_DIR=${LIBEDIT_DIR}
++
++PBX_LIBEDIT_IS_UNICODE=0
++
++
++
++
++
++
++
+ LIBXML2_DESCRIP="LibXML2"
+ LIBXML2_OPTION="libxml2"
+ PBX_LIBXML2=0
+@@ -20828,11 +20844,58 @@ fi
+ fi
+
+ if test "$PBX_LIBEDIT" = "1"; then
+- LIBEDIT_INTERNAL="no"
++ LIBEDIT_INTERNAL="no"
+ fi
+ fi
+ if test "${LIBEDIT_INTERNAL}" = "yes"; then
+ PBX_LIBEDIT=1
++ LIBEDIT_IS_UNICODE=no
++ else
++
++ if test "x${PBX_LIBEDIT_IS_UNICODE}" != "x1" -a "${USE_LIBEDIT_IS_UNICODE}" != "no"; then
++ if test "xTesting for libedit unicode support" != "x"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Testing for libedit unicode support" >&5
++$as_echo_n "checking for Testing for libedit unicode support... " >&6; }
++ else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"el_rfunc_t *callback;\" compiles using histedit.h" >&5
++$as_echo_n "checking if \"el_rfunc_t *callback;\" compiles using histedit.h... " >&6; }
++ fi
++ saved_cppflags="${CPPFLAGS}"
++ if test "x${LIBEDIT_IS_UNICODE_DIR}" != "x"; then
++ LIBEDIT_IS_UNICODE_INCLUDE="-I${LIBEDIT_IS_UNICODE_DIR}/include"
++ fi
++ CPPFLAGS="${CPPFLAGS} ${LIBEDIT_IS_UNICODE_INCLUDE}"
++
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++ #include <histedit.h>
++int
++main ()
++{
++ el_rfunc_t *callback;;
++
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++ PBX_LIBEDIT_IS_UNICODE=1
++
++$as_echo "#define HAVE_LIBEDIT_IS_UNICODE 1" >>confdefs.h
++
++
++
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++ CPPFLAGS="${saved_cppflags}"
++ fi
++
+ fi
+ fi
+
+diff --git a/configure.ac b/configure.ac
+index e4a20cf..550e68b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -479,6 +479,7 @@ AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
+ AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
+ AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
+ AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit], [, use 'internal' Editline otherwise])
++AST_EXT_LIB_SETUP_OPTIONAL([LIBEDIT_IS_UNICODE], [Libedit compiled for unicode], [LIBEDIT], [libedit])
+ AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
+ AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
+ AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
+@@ -1519,11 +1520,14 @@ if test "${USE_LIBEDIT}" != "no"; then
+ if test "${LIBEDIT_SYSTEM}" = "yes"; then
+ AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
+ if test "$PBX_LIBEDIT" = "1"; then
+- LIBEDIT_INTERNAL="no"
++ LIBEDIT_INTERNAL="no"
+ fi
+ fi
+ if test "${LIBEDIT_INTERNAL}" = "yes"; then
+ PBX_LIBEDIT=1
++ LIBEDIT_IS_UNICODE=no
++ else
++ AST_C_COMPILE_CHECK([LIBEDIT_IS_UNICODE], [el_rfunc_t *callback;], [histedit.h], [], [Testing for libedit unicode support])
+ fi
+ fi
+
+diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
+index 55189e2..53ac217 100644
+--- a/include/asterisk/autoconfig.h.in
++++ b/include/asterisk/autoconfig.h.in
+@@ -394,6 +394,9 @@
+ /* Define if your system has the LIBEDIT libraries. */
+ #undef HAVE_LIBEDIT
+
++/* Define if your system has the LIBEDIT_IS_UNICODE headers. */
++#undef HAVE_LIBEDIT_IS_UNICODE
++
+ /* Define to 1 if you have the <libintl.h> header file. */
+ #undef HAVE_LIBINTL_H
+
+diff --git a/main/asterisk.c b/main/asterisk.c
+index 1c7a0e1..fa91993 100644
+--- a/main/asterisk.c
++++ b/main/asterisk.c
+@@ -2834,7 +2834,11 @@ static void send_rasterisk_connect_commands(void)
+ }
+ }
+
++#ifdef HAVE_LIBEDIT_IS_UNICODE
++static int ast_el_read_char(EditLine *editline, wchar_t *cp)
++#else
+ static int ast_el_read_char(EditLine *editline, char *cp)
++#endif
+ {
+ int num_read = 0;
+ int lastpos = 0;
+@@ -2864,10 +2868,16 @@ static int ast_el_read_char(EditLine *editline, char *cp)
+ }
+
+ if (!ast_opt_exec && fds[1].revents) {
+- num_read = read(STDIN_FILENO, cp, 1);
++ char c = '\0';
++ num_read = read(STDIN_FILENO, &c, 1);
+ if (num_read < 1) {
+ break;
+ } else {
++#ifdef HAVE_LIBEDIT_IS_UNICODE
++ *cp = btowc(c);
++#else
++ *cp = c;
++#endif
+ return (num_read);
+ }
+ }
+@@ -2911,7 +2921,11 @@ static int ast_el_read_char(EditLine *editline, char *cp)
+ console_print(buf, 0);
+
+ if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (res >= 2 && buf[res-2] == '\n'))) {
++#ifdef HAVE_LIBEDIT_IS_UNICODE
++ *cp = btowc(CC_REFRESH);
++#else
+ *cp = CC_REFRESH;
++#endif
+ return(1);
+ } else {
+ lastpos = 1;
+@@ -2919,7 +2933,12 @@ static int ast_el_read_char(EditLine *editline, char *cp)
+ }
+ }
+
++#ifdef HAVE_LIBEDIT_IS_UNICODE
++ *cp = btowc('\0');
++#else
+ *cp = '\0';
++#endif
++
+ return (0);
+ }
+
+--
+2.10.2
+
diff --git a/debian/patches/series b/debian/patches/series
index 02d15d6..41ee33f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -39,3 +39,6 @@ ffmpeg-includes.patch
radcli-detection.patch
OpenSSL-1.1.0-support.patch
OpenSSL-1.1.0-support-2.patch
+
+# Can be dropped with 13.13.0
+fix_libedit_unicode.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/asterisk.git
More information about the Pkg-voip-commits
mailing list