git: 9bdc78861688 - main - sysutils/screen: Update to 4.9.0

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 17 Mar 2022 23:44:41 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9bdc788616889d0a2b3f9c8b8996610cdfe82be7

commit 9bdc788616889d0a2b3f9c8b8996610cdfe82be7
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-03-17 17:54:50 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-03-17 23:44:10 +0000

    sysutils/screen: Update to 4.9.0
    
    Update screen to 4.9.0. From the release announcement:
    
    New in this release:
      * Hardstatus option for used encoding (escape string '%e')
      * Fixes:
        - fix combining char handling that could lead to a segfault
        - CVE-2021-26937: possible denial of service via a crafted UTF-8
          character sequence (bug #60030)
        - make screen exit code be 0 when checking --help
        - session names limit is 80 symbols (bug #61534)
        - option -X ignores specified user in multiuser env (bug #37437)
        - a lot of reformations/fixes/cleanups (man page and source code)
    
    For full list of changes see
    https://git.savannah.gnu.org/cgit/screen.git/log/?h=v.4.9.0
    
    Note that CVE-2021-26937 was fixed in the FreeBSD port in 2021.
---
 sysutils/screen/Makefile                 |  10 +-
 sysutils/screen/distinfo                 |   6 +-
 sysutils/screen/files/patch-Makefile.in  |  48 ---------
 sysutils/screen/files/patch-ansi.c       |  24 -----
 sysutils/screen/files/patch-configure    | 162 -------------------------------
 sysutils/screen/files/patch-configure.ac |  50 ++++++++++
 sysutils/screen/files/patch-encoding.c   |  56 -----------
 sysutils/screen/files/patch-osdef.h.in   |  11 ---
 sysutils/screen/pkg-plist                |   1 +
 9 files changed, 60 insertions(+), 308 deletions(-)

diff --git a/sysutils/screen/Makefile b/sysutils/screen/Makefile
index 205f26d84370..e0cd0e7b650a 100644
--- a/sysutils/screen/Makefile
+++ b/sysutils/screen/Makefile
@@ -1,8 +1,7 @@
 # Created by: Andrey Chernov <ache@FreeBSD.org>
 
 PORTNAME=	screen
-PORTVERSION=	4.8.0
-PORTREVISION=	3
+PORTVERSION=	4.9.0
 CATEGORIES=	sysutils
 MASTER_SITES=	GNU \
 		ftp://ftp.gnu.org/gnu/screen/ \
@@ -34,7 +33,7 @@ NCURSES_DEFAULT_DESC=	Depend on ncurses (ports if installed, otherwise base)
 NCURSES_BASE_DESC=	Depend on ncurses in base
 NCURSES_PORT_DESC=	Depend on devel/ncurses in ports
 
-NCURSES_DEFAULT_USES=	ncurses
+NCURSES_DEFAULT_USES=	autoreconf:build ncurses
 NCURSES_BASE_USES=	ncurses:base
 NCURSES_PORT_USES=	ncurses:port
 
@@ -81,13 +80,16 @@ EXTRA_PATCHES+=	${FILESDIR}/opt-showencoding
 
 post-patch:
 	@${RM} ${WRKSRC}/doc/screen.info*
-	@${REINPLACE_CMD} -e 's|/dev/ptmx|/nonexistent|' ${WRKSRC}/configure
 
 # Bug 191029:	Users can choose whether to use sockets or named pipes.
 #		Choose sockets if you don't know what the difference is.
 #		Choose named pipes if your environment is heterogeneous,
 #		using both screen 4.0.3 and 4.2.1.
 # Bug 191017
+
+pre-configure:
+	cd ${WRKSRC} && ./autogen.sh
+
 post-configure-NAMED_PIPES-on:
 	@${ECHO_CMD} '#define NAMEDPIPE 1' >> ${WRKSRC}/config.h
 	@${ECHO_CMD} User selected named pipes override set.
diff --git a/sysutils/screen/distinfo b/sysutils/screen/distinfo
index 200f8a5cbbb4..203a25ac276f 100644
--- a/sysutils/screen/distinfo
+++ b/sysutils/screen/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1581479972
-SHA256 (screen-4.8.0.tar.gz) = 6e11b13d8489925fde25dfb0935bf6ed71f9eb47eff233a181e078fde5655aa1
-SIZE (screen-4.8.0.tar.gz) = 854854
+TIMESTAMP = 1647532509
+SHA256 (screen-4.9.0.tar.gz) = f9335281bb4d1538ed078df78a20c2f39d3af9a4e91c57d084271e0289c730f4
+SIZE (screen-4.9.0.tar.gz) = 798229
diff --git a/sysutils/screen/files/patch-Makefile.in b/sysutils/screen/files/patch-Makefile.in
deleted file mode 100644
index 101c1703295a..000000000000
--- a/sysutils/screen/files/patch-Makefile.in
+++ /dev/null
@@ -1,48 +0,0 @@
---- Makefile.in.orig	2017-07-10 12:26:25.000000000 -0700
-+++ Makefile.in	2017-08-25 20:19:07.289437000 -0700
-@@ -83,19 +83,13 @@
- 	    $(OPTIONS) $(CFLAGS) $<
- 
- install_bin: .version screen installdirs
--	-if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
--		then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
--	$(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
--	-chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
--# This doesn't work if $(bindir)/screen is a symlink
--	-if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
--	rm -f $(DESTDIR)$(bindir)/screen
--	(cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen)
- 	cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
-+	$(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/screen
-+	-chown root:wheel $(DESTDIR)$(bindir)/screen && chmod 4755 $(DESTDIR)$(bindir)/screen
- 
- ###############################################################################
- install: installdirs install_bin
--	cd doc ; $(MAKE) install
-+	cd doc ; $(MAKE) $(MAKE_ARGS) install
- 	-if [ -d $(DESTDIR)/usr/lib/terminfo ]; then \
- 		PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
- 		chmod 644 $(DESTDIR)/usr/lib/terminfo/s/screen*; \
-@@ -108,7 +102,7 @@
- installdirs:
- # Path leading to ETCSCREENRC and Socketdirectory not checked.
- 	$(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS)
--	cd doc ; $(MAKE) installdirs
-+	cd doc ; $(MAKE) $(MAKE_ARGS) installdirs
- 
- uninstall: .version
- 	rm -f $(DESTDIR)$(bindir)/$(SCREEN)
-@@ -350,7 +344,10 @@
- viewport.o: layout.h viewport.h canvas.h viewport.c config.h screen.h os.h osdef.h ansi.h acls.h \
-  comm.h layer.h term.h image.h display.h window.h extern.h \
-  braille.h
--list_generic.o: list_generic.h list_generic.c layer.h screen.h osdef.h
--list_display.o: list_generic.h list_display.c layer.h screen.h osdef.h
--list_window.o: list_generic.h list_window.c window.h layer.h screen.h osdef.h comm.h
-+list_generic.o: list_generic.h list_generic.c layer.h screen.h os.h osdef.h ansi.h acls.h \
-+ comm.h layer.h term.h image.h display.h window.h
-+list_display.o: list_generic.h list_display.c layer.h screen.h os.h osdef.h ansi.h acls.h \
-+ comm.h layer.h term.h image.h display.h window.h
-+list_window.o: list_generic.h list_window.c window.h layer.h screen.h os.h osdef.h ansi.h acls.h \
-+ comm.h layer.h term.h image.h display.h window.h
- 
diff --git a/sysutils/screen/files/patch-ansi.c b/sysutils/screen/files/patch-ansi.c
deleted file mode 100644
index 74ed96c079cd..000000000000
--- a/sysutils/screen/files/patch-ansi.c
+++ /dev/null
@@ -1,24 +0,0 @@
---- ansi.c.orig	2020-02-05 12:09:38.000000000 -0800
-+++ ansi.c	2021-02-14 11:10:31.759160000 -0800
-@@ -692,10 +692,6 @@
- 		    }
- 		  curr->w_rend.font = 0;
- 		}
--#  ifdef DW_CHARS
--	      if (curr->w_encoding == UTF8 && utf8_isdouble(c))
--		curr->w_mbcs = 0xff;
--#  endif
- 	      if (curr->w_encoding == UTF8 && c >= 0x0300 && utf8_iscomb(c))
- 		{
- 		  int ox, oy;
-@@ -730,6 +726,10 @@
- 		    }
- 		  break;
- 		}
-+#  ifdef DW_CHARS
-+	      if (curr->w_encoding == UTF8 && utf8_isdouble(c))
-+		curr->w_mbcs = 0xff;
-+#  endif
- 	      font = curr->w_rend.font;
- # endif
- # ifdef DW_CHARS
diff --git a/sysutils/screen/files/patch-configure b/sysutils/screen/files/patch-configure
deleted file mode 100644
index 00c34fc77d92..000000000000
--- a/sysutils/screen/files/patch-configure
+++ /dev/null
@@ -1,162 +0,0 @@
---- configure.orig	2019-10-01 15:27:14.000000000 -0700
-+++ configure	2019-10-27 23:29:24.744163000 -0700
-@@ -4756,63 +4756,6 @@
- 
- else
-   olibs="$LIBS"
--LIBS="-lcurses $olibs"
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libcurses..." >&5
--$as_echo "$as_me: checking libcurses..." >&6;}
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h.  */
--
--int
--main ()
--{
--
--#ifdef __hpux
--__sorry_hpux_libcurses_is_totally_broken_in_10_10();
--#else
--tgetent((char *)0, (char *)0);
--#endif
--
--  ;
--  return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
--
--else
--  LIBS="-ltermcap $olibs"
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libtermcap..." >&5
--$as_echo "$as_me: checking libtermcap..." >&6;}
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h.  */
--
--int
--main ()
--{
--tgetent((char *)0, (char *)0);
--  ;
--  return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
--
--else
--  LIBS="-ltermlib $olibs"
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libtermlib..." >&5
--$as_echo "$as_me: checking libtermlib..." >&6;}
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h.  */
--
--int
--main ()
--{
--tgetent((char *)0, (char *)0);
--  ;
--  return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
--
--else
-   LIBS="-lncursesw $olibs"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking libncursesw..." >&5
- $as_echo "$as_me: checking libncursesw..." >&6;}
-@@ -4897,15 +4840,6 @@
- fi
- rm -f core conftest.err conftest.$ac_objext \
-     conftest$ac_exeext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext \
--    conftest$ac_exeext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext \
--    conftest$ac_exeext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext \
--    conftest$ac_exeext conftest.$ac_ext
- 
- if test "$cross_compiling" = yes; then :
-   echo "- skipping check because we are cross compiling; assuming terminfo database is used" 1>&6
-@@ -4917,7 +4851,8 @@
- 
- main()
- {
-- exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
-+ char *tgoto(const char *, int, int);
-+ exit(strcmp(tgoto("%d%d", 0, 1), "1") ? 0 : 1);
- }
- _ACEOF
- if ac_fn_c_try_run "$LINENO"; then :
-@@ -4967,7 +4902,7 @@
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SVR4 ptys..." >&5
- $as_echo "$as_me: checking for SVR4 ptys..." >&6;}
- sysvr4ptys=
--if test -c /dev/ptmx ; then
-+if test -c /nonexistent ; then
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
- 
-@@ -5080,19 +5015,17 @@
- fi
- rm -f conftest*
- 
--if test "$ptys" != "$pdir/pty??" ; then
--p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
--p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
-+# XXX: hardcoded, since port must be devfs and various setups independent
-+
- cat >>confdefs.h <<_ACEOF
--#define PTYRANGE0 "$p0"
-+#define PTYRANGE0 "pqrsPQRSlmnoLMNO"
- _ACEOF
- 
- cat >>confdefs.h <<_ACEOF
--#define PTYRANGE1 "$p1"
-+#define PTYRANGE1 "0123456789abcdefghijklmnopqrstuv"
- _ACEOF
- 
- fi
--fi
- 
- 
- # Check whether --with-pty-mode was given.
-@@ -5315,9 +5248,11 @@
- 
- #include <time.h> /* to get time_t on SCO */
- #include <sys/types.h>
--#if defined(SVR4) && !defined(DGUX)
-+#if (defined(SVR4) && !defined(DGUX)) || defined(__FreeBSD_cc_version)
- #include <utmpx.h>
- #define utmp utmpx
-+#define pututline pututxline
-+#define getutent getutxent
- #else
- #include <utmp.h>
- #endif
-@@ -5346,7 +5281,7 @@
- 
- #include <time.h>
- #include <sys/types.h>
--#if defined(SVR4) && !defined(DGUX)
-+#if (defined(SVR4) && !defined(DGUX)) || defined(__FreeBSD_cc_version)
- #include <utmpx.h>
- #define utmp utmpx
- #else
-@@ -5383,9 +5318,13 @@
- 
- #include <time.h>
- #include <sys/types.h>
--#if defined(SVR4) && !defined(DGUX)
-+#if (defined(SVR4) && !defined(DGUX)) || defined(__FreeBSD_cc_version)
- #include <utmpx.h>
- #define utmp utmpx
-+#define pututline pututxline
-+#define getutent getutxent
-+#define pututline pututxline
-+#define getutent getutxent
- #else
- #include <utmp.h>
- #endif
diff --git a/sysutils/screen/files/patch-configure.ac b/sysutils/screen/files/patch-configure.ac
new file mode 100644
index 000000000000..cee1a130731e
--- /dev/null
+++ b/sysutils/screen/files/patch-configure.ac
@@ -0,0 +1,50 @@
+--- configure.ac.orig	2022-01-28 06:06:02.670611602 -0800
++++ configure.ac	2022-03-17 10:09:55.599298000 -0700
+@@ -811,11 +811,11 @@
+ dnl
+ dnl    ****  utmp handling  ****
+ dnl
+-AC_CHECKING(getutent)
++AC_CHECKING(getutxent)
+ AC_TRY_LINK([
+ #include <time.h> /* to get time_t on SCO */
+ #include <sys/types.h>
+-#if defined(SVR4) && !defined(DGUX)
++#if (defined(SVR4) && !defined(DGUX)) || defined(__FreeBSD__)
+ #include <utmpx.h>
+ #define utmp utmpx
+ #else
+@@ -825,14 +825,14 @@
+ #define pututline _pututline
+ #endif
+ ],
+-[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT),
++[int x = DEAD_PROCESS; pututxline((struct utmp *)0); getutxent();], AC_DEFINE(GETUTENT),
+ olibs="$LIBS"
+ LIBS="$LIBS -lgen"
+-AC_CHECKING(getutent with -lgen)
++AC_CHECKING(getutxent with -lgen)
+ AC_TRY_LINK([
+ #include <time.h>
+ #include <sys/types.h>
+-#if defined(SVR4) && !defined(DGUX)
++#if defined(SVR4) && !defined(DGUX) || defined(__FreeBSD__)
+ #include <utmpx.h>
+ #define utmp utmpx
+ #else
+@@ -842,13 +842,13 @@
+ #define pututline _pututline
+ #endif
+ ],
+-[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
++[int x = DEAD_PROCESS; pututxline((struct utmp *)0); getutxent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
+ )
+ AC_CHECKING(ut_host)
+ AC_TRY_COMPILE([
+ #include <time.h>
+ #include <sys/types.h>
+-#if defined(SVR4) && !defined(DGUX)
++#if defined(SVR4) && !defined(DGUX) || defined(__FreeBSD__)
+ #include <utmpx.h>
+ #define utmp utmpx
+ #else
diff --git a/sysutils/screen/files/patch-encoding.c b/sysutils/screen/files/patch-encoding.c
deleted file mode 100644
index 0702f6b0a05c..000000000000
--- a/sysutils/screen/files/patch-encoding.c
+++ /dev/null
@@ -1,56 +0,0 @@
---- encoding.c.orig	2020-02-05 12:09:38.000000000 -0800
-+++ encoding.c	2021-02-14 11:15:26.074193000 -0800
-@@ -43,7 +43,7 @@
- # ifdef UTF8
- static int   recode_char __P((int, int, int));
- static int   recode_char_to_encoding __P((int, int));
--static void  comb_tofront __P((int, int));
-+static void  comb_tofront __P((int));
- #  ifdef DW_CHARS
- static int   recode_char_dw __P((int, int *, int, int));
- static int   recode_char_dw_to_encoding __P((int, int *, int));
-@@ -1263,6 +1263,8 @@
-     {0x30000, 0x3FFFD},
-   };
- 
-+  if (c >= 0xdf00 && c <= 0xdfff)
-+	return 1;	/* dw comining sequence */
-   return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
-           (cjkwidth &&
-            bisearch(c, ambiguous,
-@@ -1330,11 +1332,12 @@
- }
- 
- static void
--comb_tofront(root, i)
--int root, i;
-+comb_tofront( i)
-+int i;
- {
-   for (;;)
-     {
-+      int root = i >= 0x700 ? 0x801 : 0x800;
-       debug1("bring to front: %x\n", i);
-       combchars[combchars[i]->prev]->next = combchars[i]->next;
-       combchars[combchars[i]->next]->prev = combchars[i]->prev;
-@@ -1396,9 +1399,9 @@
-     {
-       /* full, recycle old entry */
-       if (c1 >= 0xd800 && c1 < 0xe000)
--        comb_tofront(root, c1 - 0xd800);
-+        comb_tofront(c1 - 0xd800);
-       i = combchars[root]->prev;
--      if (c1 == i + 0xd800)
-+      if (i == 0x800 || i == 0x801 || c1 == i + 0xd800)
- 	{
- 	  /* completely full, can't recycle */
- 	  debug("utf8_handle_comp: completely full!\n");
-@@ -1422,7 +1425,7 @@
-   mc->font  = (i >> 8) + 0xd8;
-   mc->fontx = 0;
-   debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800);
--  comb_tofront(root, i);
-+  comb_tofront(i);
- }
- 
- #else /* !UTF8 */
diff --git a/sysutils/screen/files/patch-osdef.h.in b/sysutils/screen/files/patch-osdef.h.in
deleted file mode 100644
index 72435743c0eb..000000000000
--- a/sysutils/screen/files/patch-osdef.h.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- osdef.h.in.orig	Sat Apr 28 22:26:43 2001
-+++ osdef.h.in	Tue Apr  9 10:24:18 2002
-@@ -111,7 +111,7 @@
- extern int   setpgid __P((int, int));
- extern int   tcsetpgrp __P((int, int));
- #endif
--extern int   ioctl __P((int, int, char *));
-+extern int   ioctl __P((int, unsigned long, ...));
- 
- extern int   kill __P((int, int));
- 
diff --git a/sysutils/screen/pkg-plist b/sysutils/screen/pkg-plist
index c76c27110d29..faddf89b1799 100644
--- a/sysutils/screen/pkg-plist
+++ b/sysutils/screen/pkg-plist
@@ -1,4 +1,5 @@
 bin/screen
+bin/screen-4.9.0
 man/man1/screen.1.gz
 %%DATADIR%%/utf8encodings/01
 %%DATADIR%%/utf8encodings/02