Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2020 14:49:33 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r358113 - in stable/12: contrib/libedit lib/libedit lib/libedit/TEST lib/libedit/edit lib/libedit/readline
Message-ID:  <202002191449.01JEnXOa097936@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Feb 19 14:49:32 2020
New Revision: 358113
URL: https://svnweb.freebsd.org/changeset/base/358113

Log:
  MFC r352136, r352204, r352275, r352341
  
  r352136:
  Import libedit 2019-09-10
  
  Compared to current version in base:
  - great improvements on the Unicode support
  - full support for filename completion including quoting
    which means we do not need anymore our custom addition)
  - Improved readline compatiblity
  
  Upgrading libedit has been a pain in the past, because somehow we never
  managed to properly cleanup the tree in lib/libedit and each merge has always
  been very painful. After years of fighting give up and refresh a merge from
  scrarch properly in contrib.
  
  Note that the switch to this version will be done in another commit.
  
  r352204:
  Readd _el_fn_sh_complete for backward compatibility
  
  This function is not needed anymore, it allows old sh binary to continue
  to run and avoid breaking backward compatibility.
  Note that is now just calls the regular _el_fn_complete which does a proper
  job at quoting.
  
  Discussed with: jilles
  
  r352275:
  Update libedit to a snapshot from 2019-09-10
  
  This version bring many fixes regarding unicode support
  It also adds proper support for filename completion (we do not need our custom
  patches anymore)
  Improves the libreadline compatibility
  
  Note that the same work was done by Yuichiro Naito in
  https://reviews.freebsd.org/D21196 the main difference is in this case we have
  reimported libedit in contrib to fix a long standing mess in the previous merges
  which prevented a proper update workflow. (discussed long ago with pfg@)
  
  The only difference with upstream libedit is we have added a compatibility shim
  for the _elf_fn_sh_complete function which we previously added to support quoting
  in filename completion and is not needed anymore.
  This was added to continue supported old /bin/sh binaries and not break backward
  compatibility (as discussed with jilles@)
  
  Reviewed by: Yuichiro Naito <naito.yuichiro_gmail.com>
  Differential Revision: https://reviews.freebsd.org/D21584
  
  r352341:
  Fix arm and aarch64 builds of libedit after r352275
  
  On arm and arm64, where chars are unsigned by default, buildworld dies
  with:
  
  --- terminal.o ---
  /usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
  integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
  'unsigned int') [-Werror,-Wsign-compare]
                                       el->el_cursor.v][where & 0370] !=
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
  /usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
  integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
  'unsigned int') [-Werror,-Wsign-compare]
                                       [el->el_cursor.h] == MB_FILL_CHAR)
                                       ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
  
  Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.
  
  Note that in https://reviews.freebsd.org/D21584 this was also proposed
  by Yuichiro Naito <naito.yuichiro_gmail.com>.
  
  Reviewed by: bapt
  Subscribers: naito.yuichiro_gmail.com, ml_vishwin.info
  X-MFC-With: r352275
  Differential Revision: https://reviews.freebsd.org/D21657

Added:
  stable/12/contrib/libedit/
     - copied from r352136, head/contrib/libedit/
  stable/12/lib/libedit/readline/
     - copied from r352275, head/lib/libedit/readline/
Deleted:
  stable/12/lib/libedit/Makefile.depend
  stable/12/lib/libedit/TEST/
  stable/12/lib/libedit/chared.c
  stable/12/lib/libedit/chared.h
  stable/12/lib/libedit/chartype.c
  stable/12/lib/libedit/chartype.h
  stable/12/lib/libedit/common.c
  stable/12/lib/libedit/config.h
  stable/12/lib/libedit/edit/
  stable/12/lib/libedit/editline.3
  stable/12/lib/libedit/editrc.5
  stable/12/lib/libedit/el.c
  stable/12/lib/libedit/el.h
  stable/12/lib/libedit/eln.c
  stable/12/lib/libedit/emacs.c
  stable/12/lib/libedit/filecomplete.c
  stable/12/lib/libedit/filecomplete.h
  stable/12/lib/libedit/hist.c
  stable/12/lib/libedit/hist.h
  stable/12/lib/libedit/histedit.h
  stable/12/lib/libedit/history.c
  stable/12/lib/libedit/keymacro.c
  stable/12/lib/libedit/keymacro.h
  stable/12/lib/libedit/makelist
  stable/12/lib/libedit/map.c
  stable/12/lib/libedit/map.h
  stable/12/lib/libedit/parse.c
  stable/12/lib/libedit/parse.h
  stable/12/lib/libedit/prompt.c
  stable/12/lib/libedit/prompt.h
  stable/12/lib/libedit/read.c
  stable/12/lib/libedit/read.h
  stable/12/lib/libedit/readline.c
  stable/12/lib/libedit/refresh.c
  stable/12/lib/libedit/refresh.h
  stable/12/lib/libedit/search.c
  stable/12/lib/libedit/search.h
  stable/12/lib/libedit/sig.c
  stable/12/lib/libedit/sig.h
  stable/12/lib/libedit/sys.h
  stable/12/lib/libedit/terminal.c
  stable/12/lib/libedit/terminal.h
  stable/12/lib/libedit/tokenizer.c
  stable/12/lib/libedit/tty.c
  stable/12/lib/libedit/tty.h
  stable/12/lib/libedit/vi.c
Modified:
  stable/12/contrib/libedit/chartype.h
  stable/12/contrib/libedit/filecomplete.c
  stable/12/contrib/libedit/histedit.h
  stable/12/contrib/libedit/terminal.c
  stable/12/lib/libedit/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/libedit/chartype.h
==============================================================================
--- head/contrib/libedit/chartype.h	Tue Sep 10 14:30:10 2019	(r352136)
+++ stable/12/contrib/libedit/chartype.h	Wed Feb 19 14:49:32 2020	(r358113)
@@ -87,7 +87,7 @@ libedit_private size_t ct_enc_width(wchar_t);
 /* The terminal is thought of in terms of X columns by Y lines. In the cases
  * where a wide character takes up more than one column, the adjacent
  * occupied column entries will contain this faux character. */
-#define MB_FILL_CHAR ((wchar_t)-1)
+#define MB_FILL_CHAR ((wint_t)-1)
 
 /* Visual width of character c, taking into account ^? , \0177 and \U+nnnnn
  * style visual expansions. */

Modified: stable/12/contrib/libedit/filecomplete.c
==============================================================================
--- head/contrib/libedit/filecomplete.c	Tue Sep 10 14:30:10 2019	(r352136)
+++ stable/12/contrib/libedit/filecomplete.c	Wed Feb 19 14:49:32 2020	(r358113)
@@ -823,3 +823,13 @@ _el_fn_complete(EditLine *el, int ch __attribute__((__
 	    break_chars, NULL, NULL, (size_t)100,
 	    NULL, NULL, NULL, NULL);
 }
+
+/*
+ * el-compatible wrapper around rl_complete; needed for key binding
+ */
+/* ARGSUSED */
+unsigned char
+_el_fn_sh_complete(EditLine *el, int ch)
+{
+	return _el_fn_complete(el, ch);
+}

Modified: stable/12/contrib/libedit/histedit.h
==============================================================================
--- head/contrib/libedit/histedit.h	Tue Sep 10 14:30:10 2019	(r352136)
+++ stable/12/contrib/libedit/histedit.h	Wed Feb 19 14:49:32 2020	(r358113)
@@ -113,6 +113,7 @@ int		 el_parse(EditLine *, int, const char **);
 int		 el_set(EditLine *, int, ...);
 int		 el_get(EditLine *, int, ...);
 unsigned char	_el_fn_complete(EditLine *, int);
+unsigned char	_el_fn_sh_complete(EditLine *, int);
 
 /*
  * el_set/el_get parameters

Modified: stable/12/contrib/libedit/terminal.c
==============================================================================
--- head/contrib/libedit/terminal.c	Tue Sep 10 14:30:10 2019	(r352136)
+++ stable/12/contrib/libedit/terminal.c	Wed Feb 19 14:49:32 2020	(r358113)
@@ -1224,7 +1224,7 @@ terminal__putc(EditLine *el, wint_t c)
 {
 	char buf[MB_LEN_MAX +1];
 	ssize_t i;
-	if (c == (wint_t)MB_FILL_CHAR)
+	if (c == MB_FILL_CHAR)
 		return 0;
 	if (c & EL_LITERAL)
 		return fputs(literal_get(el, c), el->el_outfile);

Modified: stable/12/lib/libedit/Makefile
==============================================================================
--- stable/12/lib/libedit/Makefile	Wed Feb 19 14:42:21 2020	(r358112)
+++ stable/12/lib/libedit/Makefile	Wed Feb 19 14:49:32 2020	(r358113)
@@ -4,6 +4,9 @@
 
 PACKAGE=clibs
 
+EDITDIR=	${SRCTOP}/contrib/libedit
+.PATH: ${EDITDIR}
+
 SHLIB_MAJOR=	7
 SHLIBDIR?= /lib
 
@@ -12,75 +15,83 @@ LIB=	edit
 
 LIBADD=	ncursesw
 
-OSRCS=	chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
-	hist.c keymacro.c map.c chartype.c \
-	parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
+SRCS=	chared.c chartype.c common.c el.c eln.c emacs.c filecomplete.c \
+	hist.c history.c historyn.c keymacro.c literal.c map.c \
+	parse.c prompt.c read.c readline.c refresh.c search.c sig.c \
+	terminal.c tokenizer.c tokenizern.c tty.c vi.c
 
-MAN=	editline.3 editrc.5
 
-MLINKS=	editline.3 el_deletestr.3 editline.3 el_end.3 editline.3 el_init.3 \
-	editline.3 el_get.3 editline.3 el_getc.3 editline.3 el_gets.3 \
-	editline.3 history.3 editline.3 history_end.3 \
-	editline.3 history_init.3 editline.3 el_insertstr.3 \
-	editline.3 el_line.3 editline.3 el_parse.3 editline.3 el_push.3 \
-	editline.3 el_reset.3 editline.3 el_resize.3 editline.3 el_set.3 \
+MAN=	editline.3 editrc.5 editline.7
+
+MLINKS=	\
+	editline.3 el_deletestr.3 \
+	editline.3 el_end.3 \
+	editline.3 el_get.3 \
+	editline.3 el_getc.3 \
+	editline.3 el_gets.3 \
+	editline.3 el_init.3 \
+	editline.3 el_init_fd.3 \
+	editline.3 el_insertstr.3 \
+	editline.3 el_line.3 \
+	editline.3 el_parse.3 \
+	editline.3 el_push.3 \
+	editline.3 el_reset.3 \
+	editline.3 el_resize.3 \
+	editline.3 el_set.3 \
 	editline.3 el_source.3 \
-	editline.3 tok_init.3 editline.3 tok_end.3 editline.3 tok_reset.3 \
-	editline.3 tok_line.3 editline.3 tok_str.3
+	editline.3 history.3 \
+	editline.3 history_end.3 \
+	editline.3 history_init.3 \
+	editline.3 tok_end.3 \
+	editline.3 tok_init.3 \
+	editline.3 tok_line.3 \
+	editline.3 tok_reset.3 \
+	editline.3 tok_str.3 \
+	editline.3 el_wdeletestr.3 \
+	editline.3 el_wget.3 \
+	editline.3 el_wgetc.3 \
+	editline.3 el_wgets.3 \
+	editline.3 el_winsertstr.3 \
+	editline.3 el_wline.3 \
+	editline.3 el_wparse.3 \
+	editline.3 el_wpush.3 \
+	editline.3 el_wset.3 \
+	editline.3 history_w.3 \
+	editline.3 history_wend.3 \
+	editline.3 history_winit.3 \
+	editline.3 tok_wend.3 \
+	editline.3 tok_winit.3 \
+	editline.3 tok_wline.3 \
+	editline.3 tok_wreset.3 \
+	editline.3 tok_wstr.3
 
-# For speed and debugging
-#SRCS=   ${OSRCS} readline.c tokenizer.c history.c
-# For protection
-SRCS=	editline.c readline.c tokenizer.c history.c	
-SRCS+=	common.h emacs.h fcns.h help.h vi.h
-
-# Widechar
-SRCS+=	tokenizern.c historyn.c
-CLEANFILES+=	tokenizern.c historyn.c
-
 INCS=	histedit.h
 
-CLEANFILES+= common.h editline.c emacs.h fcns.c fcns.h help.c help.h vi.h
-CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR
-#CFLAGS+= -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
-#CFLAGS+= -DDEBUG_PASTE -DDEBUG_EDIT
+SRCS+=	common.h emacs.h fcns.h func.h help.h vi.h
+CLEANFILES+= common.h emacs.h fcns.h func.h help.h vi.h
 
+CFLAGS+= -I. -I${EDITDIR} -I${EDITDIR}/readline
+
 AHDR=	vi.h emacs.h common.h
-ASRC=	${.CURDIR}/vi.c ${.CURDIR}/emacs.c ${.CURDIR}/common.c
+ASRC=	${EDITDIR}/vi.c ${EDITDIR}/emacs.c ${EDITDIR}/common.c
 
-SUBDIR= edit/readline
+SUBDIR= readline
 
 .for hdr in vi emacs common
 ${hdr}.h: ${hdr}.c makelist
-	sh ${.CURDIR}/makelist -h ${.CURDIR}/${hdr}.c > ${.TARGET}
+	sh ${EDITDIR}/makelist -h ${EDITDIR}/${hdr}.c > ${.TARGET}
 .endfor
 
 fcns.h: ${AHDR} makelist
-	sh ${.CURDIR}/makelist -fh ${AHDR} > ${.TARGET}
+	sh ${EDITDIR}/makelist -fh ${AHDR} > ${.TARGET}
 
-fcns.c: ${AHDR} fcns.h makelist
-	sh ${.CURDIR}/makelist -fc ${AHDR} > ${.TARGET}
+func.h: ${AHDR} makelist
+	sh ${EDITDIR}/makelist -fc ${AHDR} > ${.TARGET}
 
-help.c: ${ASRC} makelist
-	sh ${.CURDIR}/makelist -bc ${ASRC} > ${.TARGET}
-
 help.h: ${ASRC} makelist
-	sh ${.CURDIR}/makelist -bh ${ASRC} > ${.TARGET}
+	sh ${EDITDIR}/makelist -bh ${ASRC} > ${.TARGET}
 
-editline.c: ${OSRCS}
-	sh ${.CURDIR}/makelist -e ${.ALLSRC:T} > ${.TARGET}
-
-tokenizern.c: makelist Makefile
-	sh ${.CURDIR}/makelist -n tokenizer.c > ${.TARGET}
-
-historyn.c: makelist Makefile
-	sh ${.CURDIR}/makelist -n history.c > ${.TARGET}
-
-# minimal dependency to make "make depend" optional
-editline.o editline.po editline.pico editline.ln:	\
-	common.h emacs.h fcns.c fcns.h help.c help.h vi.h
-
-tc1.o: ${.CURDIR}/TEST/tc1.c
+tc1.o: ${EDITDIR}/TEST/tc1.c
 
 test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP}
 	${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002191449.01JEnXOa097936>