summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/05prefer-libtinfo-over-libcurses.patch35
-rw-r--r--debian/patches/11replace_doc_paths.patch198
-rw-r--r--debian/patches/13split_info_files.patch17
-rw-r--r--debian/patches/26source_encoding.patch357
-rw-r--r--debian/patches/45suppress_remap.patch15
-rw-r--r--debian/patches/52fix_screen_utf8_nfd.patch39
-rw-r--r--debian/patches/58-show-encoding-hardstatus.patch42
-rw-r--r--debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch57
-rw-r--r--debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch38
-rw-r--r--debian/patches/63-add-utempter-switch.patch24
-rw-r--r--debian/patches/64-fix-manpage-typos-reported-by-lintian.patch82
-rw-r--r--debian/patches/80_session_creation_docs.patch74
-rw-r--r--debian/patches/81_session_creation_util.patch77
-rw-r--r--debian/patches/82_session_creation_core.patch161
-rw-r--r--debian/patches/90_Expand-d_xtermosc-array-in-struct-display.patch30
-rw-r--r--debian/patches/91_TERMCAP_BUF-is-used-in-place-of-TERMCAP_BUFSIZE.patch21
-rw-r--r--debian/patches/99_CVE-2021-26937.patch64
-rw-r--r--debian/patches/series20
18 files changed, 1351 insertions, 0 deletions
diff --git a/debian/patches/05prefer-libtinfo-over-libcurses.patch b/debian/patches/05prefer-libtinfo-over-libcurses.patch
new file mode 100644
index 0000000..db1d6ea
--- /dev/null
+++ b/debian/patches/05prefer-libtinfo-over-libcurses.patch
@@ -0,0 +1,35 @@
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?filename=0001-Prefer-libtinfo-over-libcurses.patch;att=1;msg=14;bug=819789
+From: Sven Joachim <svenjoac@gmx.de>
+Date: Sat, 2 Apr 2016 13:31:00 +0200
+Subject: Prefer libtinfo over libcurses
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819789
+Forwarded: no
+
+Try to link with -ltinfo before -lcurses to avoid a spurious
+dependency on systems where ncurses is built with "--with-termlib".
+---
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -626,6 +626,9 @@
+ AC_CHECKING(for tgetent)
+ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ olibs="$LIBS"
++LIBS="-ltinfo $olibs"
++AC_CHECKING(libtinfo)
++AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ LIBS="-lcurses $olibs"
+ AC_CHECKING(libcurses)
+ AC_TRY_LINK(,[
+@@ -650,9 +653,6 @@
+ LIBS="-lncurses $olibs"
+ AC_CHECKING(libncurses)
+ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+-LIBS="-ltinfo $olibs"
+-AC_CHECKING(libtinfo)
+-AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ AC_MSG_ERROR(!!! no tgetent - no screen)))))))))
+
+ AC_TRY_RUN([
diff --git a/debian/patches/11replace_doc_paths.patch b/debian/patches/11replace_doc_paths.patch
new file mode 100644
index 0000000..1bbe963
--- /dev/null
+++ b/debian/patches/11replace_doc_paths.patch
@@ -0,0 +1,198 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Fix the references to configuration and pipe paths to match the locations Debian uses.
+Forwarded: not-needed
+
+--- a/doc/screen.1
++++ b/doc/screen.1
+@@ -103,7 +103,7 @@
+ the invoking shell to the application (emacs in this case), because it is
+ forked from the parent screen process, not from the invoking shell.
+ .PP
+-If \*Q/etc/utmp\*U is writable by
++If \*Q/run/utmp\*U is writable by
+ .IR screen ,
+ an appropriate record will be written to this file for each window, and
+ removed when the window is terminated.
+@@ -232,7 +232,7 @@
+ The use of this option is discouraged.
+ .TP 5
+ .BR \-l " and " \-ln
+-turns login mode on or off (for /etc/utmp updating).
++turns login mode on or off (for /run/utmp updating).
+ This can also be defined through the \*Qdeflogin\*U .screenrc command.
+ .TP 5
+ .BR \-ls " [" \fImatch ]
+@@ -769,7 +769,7 @@
+
+ .SH CUSTOMIZATION
+ The \*Qsocket directory\*U defaults either to $HOME/.screen or simply to
+-/tmp/screens or preferably to /usr/local/screens chosen at compile-time. If
++/tmp/screens or preferably to /run/screen chosen at compile-time. If
+ .I screen
+ is installed setuid-root, then the administrator
+ should compile
+@@ -782,7 +782,7 @@
+ When
+ .I screen
+ is invoked, it executes initialization commands from the files
+-\*Q/usr/local/etc/screenrc\*U and
++\*Q/etc/screenrc\*U and
+ \*Q.screenrc\*U in the user's home directory. These are the \*Qprogrammer's
+ defaults\*U that can be overridden in the following ways: for the
+ global screenrc file
+@@ -2050,7 +2050,7 @@
+ The echo command may be used to annoy
+ .I screen
+ users with a 'message of the
+-day'. Typically installed in a global /local/etc/screenrc.
++day'. Typically installed in a global /etc/screenrc.
+ The option \*Q\-n\*U may be used to suppress the line feed.
+ See also \*Qsleep\*U.
+ Echo is also useful for online checking of environment variables.
+@@ -5196,14 +5196,14 @@
+ .I screen
+ distribution package for private and global initialization files.
+ .IP $SYSSCREENRC
+-.IP /usr/local/etc/screenrc
++.IP /etc/screenrc
+ .I screen
+ initialization commands
+ .IP $SCREENRC
+ .IP $HOME/.screenrc
+-Read in after /usr/local/etc/screenrc
++Read in after /etc/screenrc
+ .IP $SCREENDIR/S\-<login>
+-.IP /local/screens/S\-<login>
++.IP /run/screen/S\-<login>
+ Socket directories (default)
+ .IP /usr/tmp/screens/S\-<login>
+ Alternate socket directories.
+@@ -5222,7 +5222,7 @@
+ or
+ .IP /etc/termcap
+ Terminal capability databases
+-.IP /etc/utmp
++.IP /run/utmp
+ Login records
+ .IP $LOCKPRG
+ Program that locks a terminal.
+@@ -5349,9 +5349,9 @@
+ must be installed as set-uid with owner root on most systems in order
+ to be able to correctly change the owner of the tty device file for
+ each window.
+-Special permission may also be required to write the file \*Q/etc/utmp\*U.
++Special permission may also be required to write the file \*Q/run/utmp\*U.
+ .IP \(bu
+-Entries in \*Q/etc/utmp\*U are not removed when
++Entries in \*Q/run/utmp\*U are not removed when
+ .I screen
+ is killed with SIGKILL.
+ This will cause some programs (like "w" or "rwho")
+--- a/doc/screen.texinfo
++++ b/doc/screen.texinfo
+@@ -185,7 +185,7 @@
+ the invoking shell to the application (emacs in this case), because it is
+ forked from the parent screen process, not from the invoking shell.
+
+-If @file{/etc/utmp} is writable by @code{screen}, an appropriate record
++If @file{/run/utmp} is writable by @code{screen}, an appropriate record
+ will be written to this file for each window, and removed when the
+ window is closed. This is useful for working with @code{talk},
+ @code{script}, @code{shutdown}, @code{rsend}, @code{sccs} and other
+@@ -314,7 +314,7 @@
+
+ @item -l
+ @itemx -ln
+-Turn login mode on or off (for @file{/etc/utmp} updating). This option
++Turn login mode on or off (for @file{/run/utmp} updating). This option
+ is equivalent to the @code{deflogin} command (@pxref{Login}).
+
+ @item -ls [@var{match}]
+@@ -497,7 +497,7 @@
+ @cindex screenrc
+ When @code{screen} is invoked, it executes initialization commands from
+ the files @file{.screenrc} in the user's home directory and
+-@file{/usr/local/etc/screenrc}. These defaults can be overridden in the
++@file{/etc/screenrc}. These defaults can be overridden in the
+ following ways:
+ For the global screenrc file @code{screen} searches for the environment
+ variable @code{$SYSSCREENRC} (this override feature may be disabled at
+@@ -1089,7 +1089,7 @@
+ @item logfile @var{filename}
+ Place where to collect logfiles. @xref{Log}.
+ @item login [@var{state}]
+-Log the window in @file{/etc/utmp}. @xref{Login}.
++Log the window in @file{/run/utmp}. @xref{Login}.
+ @item logtstamp [@var{state}]
+ Configure logfile time-stamps. @xref{Log}.
+ @item mapdefault
+@@ -2405,7 +2405,7 @@
+ * Naming Windows:: Control the name of the window
+ * Console:: See the host's console messages
+ * Kill:: Destroy an unwanted window
+-* Login:: Control @file{/etc/utmp} logging
++* Login:: Control @file{/run/utmp} logging
+ * Mode:: Control the file mode of the pty
+ * Monitor:: Watch for activity or inactivity in a window
+ * Windows:: List the active windows
+@@ -2614,7 +2614,7 @@
+ @kindex L
+ @deffn Command login [state]
+ (@kbd{C-a L})@*
+-Adds or removes the entry in @file{/etc/utmp} for the current window.
++Adds or removes the entry in @file{/run/utmp} for the current window.
+ This controls whether or not the window is @dfn{logged in}. In addition
+ to this toggle, it is convenient to have ``log in'' and ``log out''
+ keys. For instance, @code{bind I login on} and @code{bind O
+@@ -5802,17 +5802,17 @@
+ global initialization files.
+
+ @item @code{$SYSSCREENRC}
+-@itemx /local/etc/screenrc
++@itemx /etc/screenrc
+ @code{screen} initialization commands
+
+ @item @code{$SCREENRC}
+ @itemx @code{$HOME}/.iscreenrc
+ @itemx @code{$HOME}/.screenrc
+-Read in after /local/etc/screenrc
++Read in after /etc/screenrc
+
+ @item @code{$SCREENDIR}/S-@var{login}
+
+-@item /local/screens/S-@var{login}
++@item /run/screen/S-@var{login}
+ Socket directories (default)
+
+ @item /usr/tmp/screens/S-@var{login}
+@@ -5835,7 +5835,7 @@
+ @itemx /etc/termcap
+ Terminal capability databases
+
+-@item /etc/utmp
++@item /run/utmp
+ Login records
+
+ @item @code{$LOCKPRG}
+@@ -5947,10 +5947,10 @@
+ in order to be able to
+ correctly change the owner of the tty device file for each window.
+ Special permission may also be required to write the file
+-@file{/etc/utmp}.
++@file{/run/utmp}.
+
+ @item
+-Entries in @file{/etc/utmp} are not removed when @code{screen} is killed
++Entries in @file{/run/utmp} are not removed when @code{screen} is killed
+ with SIGKILL. This will cause some programs (like "w" or "rwho") to
+ advertise that a user is logged on who really isn't.
+
+@@ -6030,7 +6030,7 @@
+ @cindex socket directory
+
+ The socket directory defaults either to @file{$HOME/.screen} or simply to
+-@file{/tmp/screens} or preferably to @file{/usr/local/screens} chosen at
++@file{/tmp/screens} or preferably to @file{/run/screen} chosen at
+ compile-time. If @code{screen} is installed
+ setuid root, then the administrator should compile screen with an
+ adequate (not NFS mounted) @code{SOCKDIR}. If @code{screen} is not
diff --git a/debian/patches/13split_info_files.patch b/debian/patches/13split_info_files.patch
new file mode 100644
index 0000000..c2f0d83
--- /dev/null
+++ b/debian/patches/13split_info_files.patch
@@ -0,0 +1,17 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Split the info files at 50k
+ This matches the distribution style of the orig tarball.
+Last-Revised: 2013-05-16 by Axel Beckert <abe@debian.org>
+Bug-Debian: https://bugs.debian.org/707530
+
+--- a/doc/Makefile.in
++++ b/doc/Makefile.in
+@@ -28,7 +28,7 @@
+
+ info screen.info: screen.texinfo
+ @rm -f screen.info*
+- $(MAKEINFO) $(srcdir)/screen.texinfo -o screen.info
++ $(MAKEINFO) --split-size=50000 $(srcdir)/screen.texinfo -o screen.info
+
+ install: installdirs
+ $(INSTALL_DATA) $(srcdir)/screen.1 $(DESTDIR)$(mandir)/man1/screen.1
diff --git a/debian/patches/26source_encoding.patch b/debian/patches/26source_encoding.patch
new file mode 100644
index 0000000..5ede1cd
--- /dev/null
+++ b/debian/patches/26source_encoding.patch
@@ -0,0 +1,357 @@
+Author: Ben Finney <ben@benfinney.id.au>
+Description: Replace the composed characters with their respective description.
+Bugs-Debian: https://bugs.debian.org/437024
+
+Index: screen/process.c
+===================================================================
+--- screen.orig/process.c 2015-06-13 23:33:02.469345223 +0200
++++ screen/process.c 2015-06-13 23:33:02.469345223 +0200
+@@ -252,177 +252,177 @@
+
+ /* digraph table taken from old vim and rfc1345 */
+ static struct digraph digraphs[MAX_DIGRAPH + 1] = {
+- {{' ', ' '}, 160}, /* */
+- {{'N', 'S'}, 160}, /* */
+- {{'~', '!'}, 161}, /* */
+- {{'!', '!'}, 161}, /* */
+- {{'!', 'I'}, 161}, /* */
+- {{'c', '|'}, 162}, /* */
+- {{'c', 't'}, 162}, /* */
+- {{'$', '$'}, 163}, /* */
+- {{'P', 'd'}, 163}, /* */
+- {{'o', 'x'}, 164}, /* */
+- {{'C', 'u'}, 164}, /* */
+- {{'C', 'u'}, 164}, /* */
+- {{'E', 'u'}, 164}, /* */
+- {{'Y', '-'}, 165}, /* */
+- {{'Y', 'e'}, 165}, /* */
+- {{'|', '|'}, 166}, /* */
+- {{'B', 'B'}, 166}, /* */
+- {{'p', 'a'}, 167}, /* */
+- {{'S', 'E'}, 167}, /* */
+- {{'"', '"'}, 168}, /* */
+- {{'\'', ':'}, 168}, /* */
+- {{'c', 'O'}, 169}, /* */
+- {{'C', 'o'}, 169}, /* */
+- {{'a', '-'}, 170}, /* */
+- {{'<', '<'}, 171}, /* */
+- {{'-', ','}, 172}, /* */
+- {{'N', 'O'}, 172}, /* */
+- {{'-', '-'}, 173}, /* */
+- {{'r', 'O'}, 174}, /* */
+- {{'R', 'g'}, 174}, /* */
+- {{'-', '='}, 175}, /* */
+- {{'\'', 'm'}, 175}, /* */
+- {{'~', 'o'}, 176}, /* */
+- {{'D', 'G'}, 176}, /* */
+- {{'+', '-'}, 177}, /* */
+- {{'2', '2'}, 178}, /* */
+- {{'2', 'S'}, 178}, /* */
+- {{'3', '3'}, 179}, /* */
+- {{'3', 'S'}, 179}, /* */
+- {{'\'', '\''}, 180}, /* */
+- {{'j', 'u'}, 181}, /* */
+- {{'M', 'y'}, 181}, /* */
+- {{'p', 'p'}, 182}, /* */
+- {{'P', 'I'}, 182}, /* */
+- {{'~', '.'}, 183}, /* */
+- {{'.', 'M'}, 183}, /* */
+- {{',', ','}, 184}, /* */
+- {{'\'', ','}, 184}, /* */
+- {{'1', '1'}, 185}, /* */
+- {{'1', 'S'}, 185}, /* */
+- {{'o', '-'}, 186}, /* */
+- {{'>', '>'}, 187}, /* */
+- {{'1', '4'}, 188}, /* */
+- {{'1', '2'}, 189}, /* */
+- {{'3', '4'}, 190}, /* */
+- {{'~', '?'}, 191}, /* */
+- {{'?', '?'}, 191}, /* */
+- {{'?', 'I'}, 191}, /* */
+- {{'A', '`'}, 192}, /* */
+- {{'A', '!'}, 192}, /* */
+- {{'A', '\''}, 193}, /* */
+- {{'A', '^'}, 194}, /* */
+- {{'A', '>'}, 194}, /* */
+- {{'A', '~'}, 195}, /* */
+- {{'A', '?'}, 195}, /* */
+- {{'A', '"'}, 196}, /* */
+- {{'A', ':'}, 196}, /* */
+- {{'A', '@'}, 197}, /* */
+- {{'A', 'A'}, 197}, /* */
+- {{'A', 'E'}, 198}, /* */
+- {{'C', ','}, 199}, /* */
+- {{'E', '`'}, 200}, /* */
+- {{'E', '!'}, 200}, /* */
+- {{'E', '\''}, 201}, /* */
+- {{'E', '^'}, 202}, /* */
+- {{'E', '>'}, 202}, /* */
+- {{'E', '"'}, 203}, /* */
+- {{'E', ':'}, 203}, /* */
+- {{'I', '`'}, 204}, /* */
+- {{'I', '!'}, 204}, /* */
+- {{'I', '\''}, 205}, /* */
+- {{'I', '^'}, 206}, /* */
+- {{'I', '>'}, 206}, /* */
+- {{'I', '"'}, 207}, /* */
+- {{'I', ':'}, 207}, /* */
+- {{'D', '-'}, 208}, /* */
+- {{'N', '~'}, 209}, /* */
+- {{'N', '?'}, 209}, /* */
+- {{'O', '`'}, 210}, /* */
+- {{'O', '!'}, 210}, /* */
+- {{'O', '\''}, 211}, /* */
+- {{'O', '^'}, 212}, /* */
+- {{'O', '>'}, 212}, /* */
+- {{'O', '~'}, 213}, /* */
+- {{'O', '?'}, 213}, /* */
+- {{'O', '"'}, 214}, /* */
+- {{'O', ':'}, 214}, /* */
+- {{'/', '\\'}, 215}, /* */
+- {{'*', 'x'}, 215}, /* */
+- {{'O', '/'}, 216}, /* */
+- {{'U', '`'}, 217}, /* */
+- {{'U', '!'}, 217}, /* */
+- {{'U', '\''}, 218}, /* */
+- {{'U', '^'}, 219}, /* */
+- {{'U', '>'}, 219}, /* */
+- {{'U', '"'}, 220}, /* */
+- {{'U', ':'}, 220}, /* */
+- {{'Y', '\''}, 221}, /* */
+- {{'I', 'p'}, 222}, /* */
+- {{'T', 'H'}, 222}, /* */
+- {{'s', 's'}, 223}, /* */
+- {{'s', '"'}, 223}, /* */
+- {{'a', '`'}, 224}, /* */
+- {{'a', '!'}, 224}, /* */
+- {{'a', '\''}, 225}, /* */
+- {{'a', '^'}, 226}, /* */
+- {{'a', '>'}, 226}, /* */
+- {{'a', '~'}, 227}, /* */
+- {{'a', '?'}, 227}, /* */
+- {{'a', '"'}, 228}, /* */
+- {{'a', ':'}, 228}, /* */
+- {{'a', 'a'}, 229}, /* */
+- {{'a', 'e'}, 230}, /* */
+- {{'c', ','}, 231}, /* */
+- {{'e', '`'}, 232}, /* */
+- {{'e', '!'}, 232}, /* */
+- {{'e', '\''}, 233}, /* */
+- {{'e', '^'}, 234}, /* */
+- {{'e', '>'}, 234}, /* */
+- {{'e', '"'}, 235}, /* */
+- {{'e', ':'}, 235}, /* */
+- {{'i', '`'}, 236}, /* */
+- {{'i', '!'}, 236}, /* */
+- {{'i', '\''}, 237}, /* */
+- {{'i', '^'}, 238}, /* */
+- {{'i', '>'}, 238}, /* */
+- {{'i', '"'}, 239}, /* */
+- {{'i', ':'}, 239}, /* */
+- {{'d', '-'}, 240}, /* */
+- {{'n', '~'}, 241}, /* */
+- {{'n', '?'}, 241}, /* */
+- {{'o', '`'}, 242}, /* */
+- {{'o', '!'}, 242}, /* */
+- {{'o', '\''}, 243}, /* */
+- {{'o', '^'}, 244}, /* */
+- {{'o', '>'}, 244}, /* */
+- {{'o', '~'}, 245}, /* */
+- {{'o', '?'}, 245}, /* */
+- {{'o', '"'}, 246}, /* */
+- {{'o', ':'}, 246}, /* */
+- {{':', '-'}, 247}, /* */
+- {{'o', '/'}, 248}, /* */
+- {{'u', '`'}, 249}, /* */
+- {{'u', '!'}, 249}, /* */
+- {{'u', '\''}, 250}, /* */
+- {{'u', '^'}, 251}, /* */
+- {{'u', '>'}, 251}, /* */
+- {{'u', '"'}, 252}, /* */
+- {{'u', ':'}, 252}, /* */
+- {{'y', '\''}, 253}, /* */
+- {{'i', 'p'}, 254}, /* */
+- {{'t', 'h'}, 254}, /* */
+- {{'y', '"'}, 255}, /* */
+- {{'y', ':'}, 255}, /* */
+- {{'"', '['}, 196}, /* */
+- {{'"', '\\'}, 214}, /* */
+- {{'"', ']'}, 220}, /* */
+- {{'"', '{'}, 228}, /* */
+- {{'"', '|'}, 246}, /* */
+- {{'"', '}'}, 252}, /* */
+- {{'"', '~'}, 223} /* */
++ {{' ', ' '}, 0x00a0}, /* NO-BREAK SPACE */
++ {{'N', 'S'}, 0x00a0}, /* NO-BREAK SPACE */
++ {{'~', '!'}, 0x00a1}, /* INVERTED EXCLAMATION MARK */
++ {{'!', '!'}, 0x00a1}, /* INVERTED EXCLAMATION MARK */
++ {{'!', 'I'}, 0x00a1}, /* INVERTED EXCLAMATION MARK */
++ {{'c', '|'}, 0x00a2}, /* CENT SIGN */
++ {{'c', 't'}, 0x00a2}, /* CENT SIGN */
++ {{'$', '$'}, 0x00a3}, /* POUND SIGN */
++ {{'P', 'd'}, 0x00a3}, /* POUND SIGN */
++ {{'o', 'x'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'C', 'u'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'C', 'u'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'E', 'u'}, 0x00a4}, /* CURRENCY SIGN */
++ {{'Y', '-'}, 0x00a5}, /* YEN SIGN */
++ {{'Y', 'e'}, 0x00a5}, /* YEN SIGN */
++ {{'|', '|'}, 0x00a6}, /* BROKEN BAR */
++ {{'B', 'B'}, 0x00a6}, /* BROKEN BAR */
++ {{'p', 'a'}, 0x00a7}, /* SECTION SIGN */
++ {{'S', 'E'}, 0x00a7}, /* SECTION SIGN */
++ {{'"', '"'}, 0x00a8}, /* DIAERESIS */
++ {{'\'', ':'}, 0x00a8}, /* DIAERESIS */
++ {{'c', 'O'}, 0x00a9}, /* COPYRIGHT SIGN */
++ {{'C', 'o'}, 0x00a9}, /* COPYRIGHT SIGN */
++ {{'-', 'a'}, 0x00aa}, /* FEMININE ORDINAL INDICATOR */
++ {{'<', '<'}, 0x00ab}, /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
++ {{'-', ','}, 0x00ac}, /* NOT SIGN */
++ {{'N', 'O'}, 0x00ac}, /* NOT SIGN */
++ {{'-', '-'}, 0x00ad}, /* SOFT HYPHEN */
++ {{'r', 'O'}, 0x00ae}, /* REGISTERED SIGN */
++ {{'R', 'g'}, 0x00ae}, /* REGISTERED SIGN */
++ {{'-', '='}, 0x00af}, /* MACRON */
++ {{'\'', 'm'}, 0x00af}, /* MACRON */
++ {{'~', 'o'}, 0x00b0}, /* DEGREE SIGN */
++ {{'D', 'G'}, 0x00b0}, /* DEGREE SIGN */
++ {{'+', '-'}, 0x00b1}, /* PLUS-MINUS SIGN */
++ {{'2', '2'}, 0x00b2}, /* SUPERSCRIPT TWO */
++ {{'2', 'S'}, 0x00b2}, /* SUPERSCRIPT TWO */
++ {{'3', '3'}, 0x00b3}, /* SUPERSCRIPT THREE */
++ {{'3', 'S'}, 0x00b3}, /* SUPERSCRIPT THREE */
++ {{'\'', '\''}, 0x00b4}, /* ACUTE ACCENT */
++ {{'j', 'u'}, 0x00b5}, /* MICRO SIGN */
++ {{'M', 'y'}, 0x00b5}, /* MICRO SIGN */
++ {{'p', 'p'}, 0x00b6}, /* PILCROW SIGN */
++ {{'P', 'I'}, 0x00b6}, /* PILCROW SIGN */
++ {{'~', '.'}, 0x00b7}, /* MIDDLE DOT */
++ {{'.', 'M'}, 0x00b7}, /* MIDDLE DOT */
++ {{',', ','}, 0x00b8}, /* CEDILLA */
++ {{'\'', ','}, 0x00b8}, /* CEDILLA */
++ {{'1', '1'}, 0x00b9}, /* SUPERSCRIPT ONE */
++ {{'1', 'S'}, 0x00b9}, /* SUPERSCRIPT ONE */
++ {{'-', 'o'}, 0x00ba}, /* MASCULINE ORDINAL INDICATOR */
++ {{'>', '>'}, 0x00bb}, /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
++ {{'1', '4'}, 0x00bc}, /* VULGAR FRACTION ONE QUARTER */
++ {{'1', '2'}, 0x00bd}, /* VULGAR FRACTION ONE HALF */
++ {{'3', '4'}, 0x00be}, /* VULGAR FRACTION THREE QUARTERS */
++ {{'~', '?'}, 0x00bf}, /* INVERTED QUESTION MARK */
++ {{'?', '?'}, 0x00bf}, /* INVERTED QUESTION MARK */
++ {{'?', 'I'}, 0x00bf}, /* INVERTED QUESTION MARK */
++ {{'A', '`'}, 0x00c0}, /* LATIN CAPITAL LETTER A WITH GRAVE */
++ {{'A', '!'}, 0x00c0}, /* LATIN CAPITAL LETTER A WITH GRAVE */
++ {{'A', '\''}, 0x00c1}, /* LATIN CAPITAL LETTER A WITH ACUTE */
++ {{'A', '^'}, 0x00c2}, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
++ {{'A', '>'}, 0x00c2}, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
++ {{'A', '~'}, 0x00c3}, /* LATIN CAPITAL LETTER A WITH TILDE */
++ {{'A', '?'}, 0x00c3}, /* LATIN CAPITAL LETTER A WITH TILDE */
++ {{'A', '"'}, 0x00c4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
++ {{'A', ':'}, 0x00c4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
++ {{'A', '@'}, 0x00c5}, /* LATIN CAPITAL LETTER A WITH RING ABOVE */
++ {{'A', 'A'}, 0x00c5}, /* LATIN CAPITAL LETTER A WITH RING ABOVE */
++ {{'A', 'E'}, 0x00c6}, /* LATIN CAPITAL LETTER AE */
++ {{'C', ','}, 0x00c7}, /* LATIN CAPITAL LETTER C WITH CEDILLA */
++ {{'E', '`'}, 0x00c8}, /* LATIN CAPITAL LETTER E WITH GRAVE */
++ {{'E', '!'}, 0x00c8}, /* LATIN CAPITAL LETTER E WITH GRAVE */
++ {{'E', '\''}, 0x00c9}, /* LATIN CAPITAL LETTER E WITH ACUTE */
++ {{'E', '^'}, 0x00ca}, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
++ {{'E', '>'}, 0x00ca}, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
++ {{'E', '"'}, 0x00cb}, /* LATIN CAPITAL LETTER E WITH DIAERESIS */
++ {{'E', ':'}, 0x00cb}, /* LATIN CAPITAL LETTER E WITH DIAERESIS */
++ {{'I', '`'}, 0x00cc}, /* LATIN CAPITAL LETTER I WITH GRAVE */
++ {{'I', '!'}, 0x00cc}, /* LATIN CAPITAL LETTER I WITH GRAVE */
++ {{'I', '\''}, 0x00cd}, /* LATIN CAPITAL LETTER I WITH ACUTE */
++ {{'I', '^'}, 0x00ce}, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
++ {{'I', '>'}, 0x00ce}, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
++ {{'I', '"'}, 0x00cf}, /* LATIN CAPITAL LETTER I WITH DIAERESIS */
++ {{'I', ':'}, 0x00cf}, /* LATIN CAPITAL LETTER I WITH DIAERESIS */
++ {{'D', '-'}, 0x00d0}, /* LATIN CAPITAL LETTER ETH */
++ {{'N', '~'}, 0x00d1}, /* LATIN CAPITAL LETTER N WITH TILDE */
++ {{'N', '?'}, 0x00d1}, /* LATIN CAPITAL LETTER N WITH TILDE */
++ {{'O', '`'}, 0x00d2}, /* LATIN CAPITAL LETTER O WITH GRAVE */
++ {{'O', '!'}, 0x00d2}, /* LATIN CAPITAL LETTER O WITH GRAVE */
++ {{'O', '\''}, 0x00d3}, /* LATIN CAPITAL LETTER O WITH ACUTE */
++ {{'O', '^'}, 0x00d4}, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
++ {{'O', '>'}, 0x00d4}, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
++ {{'O', '~'}, 0x00d5}, /* LATIN CAPITAL LETTER O WITH TILDE */
++ {{'O', '?'}, 0x00d5}, /* LATIN CAPITAL LETTER O WITH TILDE */
++ {{'O', '"'}, 0x00d6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
++ {{'O', ':'}, 0x00d6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
++ {{'/', '\\'}, 0x00d7}, /* MULTIPLICATION SIGN */
++ {{'*', 'x'}, 0x00d7}, /* MULTIPLICATION SIGN */
++ {{'O', '/'}, 0x00d8}, /* LATIN CAPITAL LETTER O WITH STROKE */
++ {{'U', '`'}, 0x00d9}, /* LATIN CAPITAL LETTER U WITH GRAVE */
++ {{'U', '!'}, 0x00d9}, /* LATIN CAPITAL LETTER U WITH GRAVE */
++ {{'U', '\''}, 0x00da}, /* LATIN CAPITAL LETTER U WITH ACUTE */
++ {{'U', '^'}, 0x00db}, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
++ {{'U', '>'}, 0x00db}, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
++ {{'U', '"'}, 0x00dc}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
++ {{'U', ':'}, 0x00dc}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
++ {{'Y', '\''}, 0x00dd}, /* LATIN CAPITAL LETTER Y WITH ACUTE */
++ {{'I', 'p'}, 0x00de}, /* LATIN CAPITAL LETTER THORN */
++ {{'T', 'H'}, 0x00de}, /* LATIN CAPITAL LETTER THORN */
++ {{'s', 's'}, 0x00df}, /* LATIN SMALL LETTER SHARP S */
++ {{'s', '"'}, 0x00df}, /* LATIN SMALL LETTER SHARP S */
++ {{'a', '`'}, 0x00e0}, /* LATIN SMALL LETTER A WITH GRAVE */
++ {{'a', '!'}, 0x00e0}, /* LATIN SMALL LETTER A WITH GRAVE */
++ {{'a', '\''}, 0x00e1}, /* LATIN SMALL LETTER A WITH ACUTE */
++ {{'a', '^'}, 0x00e2}, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */
++ {{'a', '>'}, 0x00e2}, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */
++ {{'a', '~'}, 0x00e3}, /* LATIN SMALL LETTER A WITH TILDE */
++ {{'a', '?'}, 0x00e3}, /* LATIN SMALL LETTER A WITH TILDE */
++ {{'a', '"'}, 0x00e4}, /* LATIN SMALL LETTER A WITH DIAERESIS */
++ {{'a', ':'}, 0x00e4}, /* LATIN SMALL LETTER A WITH DIAERESIS */
++ {{'a', 'a'}, 0x00e5}, /* LATIN SMALL LETTER A WITH RING ABOVE */
++ {{'a', 'e'}, 0x00e6}, /* LATIN SMALL LETTER AE */
++ {{'c', ','}, 0x00e7}, /* LATIN SMALL LETTER C WITH CEDILLA */
++ {{'e', '`'}, 0x00e8}, /* LATIN SMALL LETTER E WITH GRAVE */
++ {{'e', '!'}, 0x00e8}, /* LATIN SMALL LETTER E WITH GRAVE */
++ {{'e', '\''}, 0x00e9}, /* LATIN SMALL LETTER E WITH ACUTE */
++ {{'e', '^'}, 0x00ea}, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */
++ {{'e', '>'}, 0x00ea}, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */
++ {{'e', '"'}, 0x00eb}, /* LATIN SMALL LETTER E WITH DIAERESIS */
++ {{'e', ':'}, 0x00eb}, /* LATIN SMALL LETTER E WITH DIAERESIS */
++ {{'i', '`'}, 0x00ec}, /* LATIN SMALL LETTER I WITH GRAVE */
++ {{'i', '!'}, 0x00ec}, /* LATIN SMALL LETTER I WITH GRAVE */
++ {{'i', '\''}, 0x00ed}, /* LATIN SMALL LETTER I WITH ACUTE */
++ {{'i', '^'}, 0x00ee}, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */
++ {{'i', '>'}, 0x00ee}, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */
++ {{'i', '"'}, 0x00ef}, /* LATIN SMALL LETTER I WITH DIAERESIS */
++ {{'i', ':'}, 0x00ef}, /* LATIN SMALL LETTER I WITH DIAERESIS */
++ {{'d', '-'}, 0x00f0}, /* LATIN SMALL LETTER ETH */
++ {{'n', '~'}, 0x00f1}, /* LATIN SMALL LETTER N WITH TILDE */
++ {{'n', '?'}, 0x00f1}, /* LATIN SMALL LETTER N WITH TILDE */
++ {{'o', '`'}, 0x00f2}, /* LATIN SMALL LETTER O WITH GRAVE */
++ {{'o', '!'}, 0x00f2}, /* LATIN SMALL LETTER O WITH GRAVE */
++ {{'o', '\''}, 0x00f3}, /* LATIN SMALL LETTER O WITH ACUTE */
++ {{'o', '^'}, 0x00f4}, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */
++ {{'o', '>'}, 0x00f4}, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */
++ {{'o', '~'}, 0x00f5}, /* LATIN SMALL LETTER O WITH TILDE */
++ {{'o', '?'}, 0x00f5}, /* LATIN SMALL LETTER O WITH TILDE */
++ {{'o', '"'}, 0x00f6}, /* LATIN SMALL LETTER O WITH DIAERESIS */
++ {{'o', ':'}, 0x00f6}, /* LATIN SMALL LETTER O WITH DIAERESIS */
++ {{'-', ':'}, 0x00f7}, /* DIVISION SIGN */
++ {{'o', '/'}, 0x00f8}, /* LATIN SMALL LETTER O WITH STROKE */
++ {{'u', '`'}, 0x00f9}, /* LATIN SMALL LETTER U WITH GRAVE */
++ {{'u', '!'}, 0x00f9}, /* LATIN SMALL LETTER U WITH GRAVE */
++ {{'u', '\''}, 0x00fa}, /* LATIN SMALL LETTER U WITH ACUTE */
++ {{'u', '^'}, 0x00fb}, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */
++ {{'u', '>'}, 0x00fb}, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */
++ {{'u', '"'}, 0x00fc}, /* LATIN SMALL LETTER U WITH DIAERESIS */
++ {{'u', ':'}, 0x00fc}, /* LATIN SMALL LETTER U WITH DIAERESIS */
++ {{'y', '\''}, 0x00fd}, /* LATIN SMALL LETTER Y WITH ACUTE */
++ {{'i', 'p'}, 0x00fe}, /* LATIN SMALL LETTER THORN */
++ {{'t', 'h'}, 0x00fe}, /* LATIN SMALL LETTER THORN */
++ {{'y', '"'}, 0x00ff}, /* LATIN SMALL LETTER Y WITH DIAERESIS */
++ {{'y', ':'}, 0x00ff}, /* LATIN SMALL LETTER Y WITH DIAERESIS */
++ {{'"', '['}, 0x00c4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */
++ {{'"', '\\'}, 0x00d6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */
++ {{'"', ']'}, 0x00dc}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */
++ {{'"', '{'}, 0x00e4}, /* LATIN SMALL LETTER A WITH DIAERESIS */
++ {{'"', '|'}, 0x00f6}, /* LATIN SMALL LETTER O WITH DIAERESIS */
++ {{'"', '}'}, 0x00fc}, /* LATIN SMALL LETTER U WITH DIAERESIS */
++ {{'"', '~'}, 0x00df}, /* LATIN SMALL LETTER SHARP S */
+ };
+
+ #define RESIZE_FLAG_H 1
diff --git a/debian/patches/45suppress_remap.patch b/debian/patches/45suppress_remap.patch
new file mode 100644
index 0000000..d705c59
--- /dev/null
+++ b/debian/patches/45suppress_remap.patch
@@ -0,0 +1,15 @@
+Author: Loic Minier <lool@dooz.org>
+Description: Unbreak several useful keybindings.
+Bugs-Debian: https://bugs.debian.org/484647
+
+--- a/termcap.c
++++ b/termcap.c
+@@ -553,8 +553,6 @@
+ else
+ break;
+ }
+- if (n < KMAP_KEYS)
+- domap = 1;
+ if (map == 0 && domap)
+ return 0;
+ if (map && !domap)
diff --git a/debian/patches/52fix_screen_utf8_nfd.patch b/debian/patches/52fix_screen_utf8_nfd.patch
new file mode 100644
index 0000000..00a070d
--- /dev/null
+++ b/debian/patches/52fix_screen_utf8_nfd.patch
@@ -0,0 +1,39 @@
+Author: Michael Schröder <mls@suse.de>
+Reviewed-By: Axel Beckert <abe@debian.org>
+Description: screen outputs screen "ÿ" after a connected character.
+ This is a character without the need.
+ This happens in UTF-8 environment.
+ Before : screen$ ruby1.9.1 -e 'puts "\u304b\u3099.."'
+ がÿ...
+ patch applied : screen $ ruby1.9.1 -e 'puts "\u304b\u3099.."'
+ が..
+Origin: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00012.html
+Bugs-Debian: https://bugs.debian.org/600246
+Bugs-Debian: https://bugs.debian.org/677512
+
+diff --git a/ansi.c b/ansi.c
+index 2a52edd..83b266d 100644
+--- a/ansi.c
++++ b/ansi.c
+@@ -692,10 +692,6 @@ register int len;
+ }
+ 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 @@ register int len;
+ }
+ 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/debian/patches/58-show-encoding-hardstatus.patch b/debian/patches/58-show-encoding-hardstatus.patch
new file mode 100644
index 0000000..54e9fff
--- /dev/null
+++ b/debian/patches/58-show-encoding-hardstatus.patch
@@ -0,0 +1,42 @@
+Description: show encoding in hardstatus
+Author: Yi-Jheng Lin <yzlin@cs.nctu.edu.tw>
+Origin: https://svnweb.freebsd.org/ports/head/sysutils/screen/files/opt-showencoding?view=markup
+Reviewed-By: rascov <rascov@rascov.tw>
+Reviewed-By: Dustin Kirkland <kirkland@ubuntu.com>
+Last-Update: Wed Feb 11 05:51:31 CST 2009
+Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=124492
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/screen/+bug/286810
+Bug-Debian: https://bugs.debian.org/533498
+
+--- a/screen.c
++++ b/screen.c
+@@ -2755,6 +2755,19 @@
+ p += strlen(p) - 1;
+ break;
+
++ #ifdef ENCODINGS
++ case 'e':
++ *p = 0;
++ D_encoding = nwin_options.encoding > 0 ? nwin_options.encoding : 0;
++ if (win && win->w_encoding)
++ {
++ *p++ = ' ';
++ strcpy(p, EncodingName(win->w_encoding));
++ }
++ p += strlen(p) - 1;
++ break;
++ #endif
++
+ case '{':
+ {
+ char rbuf[128];
+--- a/process.c
++++ b/process.c
+@@ -3784,6 +3784,7 @@
+ {
+ WinSwitchEncoding(fore, n);
+ ResetCharsets(fore);
++ RedisplayDisplays(0);
+ }
+ else if (i && display)
+ D_encoding = n;
diff --git a/debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch b/debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch
new file mode 100644
index 0000000..77efa80
--- /dev/null
+++ b/debian/patches/60-screen-4.2.1-debian4.1.0-compatibility.patch
@@ -0,0 +1,57 @@
+Description: Patch to make 4.2.1 compatible with Debian's 4.1.0 and
+ 4.2.0 packages 4.2.1 includes the Debian patches to extend the login
+ name and $TERM length, but uses even larger values. This causes
+ screen clients to no more be able to talk to older screen
+ servers. See #644788 for a discussion of the same issue with earlier
+ release combinations (4.1.0 vs 4.0.3).
+ .
+ For now this patch sets the mentioned values back to those which
+ werew in use in Debian before (and seemed to be large enough for use
+ in Debian).
+Author: Axel Beckert <abe@debian.org>
+Forwarded: no
+
+--- a/os.h
++++ b/os.h
+@@ -524,6 +524,6 @@
+ /* Changing those you won't be able to attach to your old sessions
+ * when changing those values in official tree don't forget to bump
+ * MSG_VERSION */
+-#define MAXTERMLEN 32
+-#define MAXLOGINLEN 256
++#define MAXTERMLEN 40
++#define MAXLOGINLEN 50
+
+--- a/screen.h
++++ b/screen.h
+@@ -186,7 +186,7 @@
+ * 4: screen version 4.2.1 (bumped once again due to changed terminal and login length)
+ * 5: screen version 4.4.0 (fix screenterm size)
+ */
+-#define MSG_VERSION 5
++#define MSG_VERSION 2
+
+ #define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION)
+ struct msg
+@@ -205,7 +205,7 @@
+ int nargs;
+ char line[MAXPATHLEN];
+ char dir[MAXPATHLEN];
+- char screenterm[MAXTERMLEN + 1]; /* is screen really "screen" ? */
++ char screenterm[20]; /* is screen really "screen" ? */
+ }
+ create;
+ struct
+--- a/socket.c
++++ b/socket.c
+@@ -723,8 +723,8 @@
+ goto end;
+ }
+ if (nwin->term != nwin_undef.term)
+- strncpy(m.m.create.screenterm, nwin->term, MAXTERMLEN);
+- m.m.create.screenterm[MAXTERMLEN] = '\0';
++ strncpy(m.m.create.screenterm, nwin->term, 20-1);
++ m.m.create.screenterm[20-1] = '\0';
+ m.protocol_revision = MSG_REVISION;
+ debug1("SendCreateMsg writing '%s'\n", m.m.create.line);
+ if (write(s, (char *) &m, sizeof m) != sizeof m)
diff --git a/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch b/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch
new file mode 100644
index 0000000..4f81703
--- /dev/null
+++ b/debian/patches/61-default-PATH_MAX-if-undefined-for-hurd.patch
@@ -0,0 +1,38 @@
+Description: Set PATH_MAX to 4096 if undefined
+ Fixes FTBFS since 4.4.0 on GNU/Hurd. Updated to add one more occurrence for 4.5.0.
+Author: Axel Beckert <abe@debian.org>
+Bug: https://savannah.gnu.org/bugs/?50089
+Last-Updated: 2017-01-18
+
+--- a/tty.sh
++++ b/tty.sh
+@@ -1478,6 +1478,13 @@
+ return 0;
+ }
+
++/*
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd
++ */
++
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
+
+ int CheckTtyname (char *tty)
+ {
+--- a/screen.h
++++ b/screen.h
+@@ -109,6 +109,13 @@
+ # define DEFAULT_BUFFERFILE "/tmp/screen-exchange"
+ #endif
+
++/*
++ * Define PATH_MAX to 4096 if it's not defined, like on GNU/Hurd
++ */
++
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
+
+ #if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT))
+ # define HPUX_LTCHARS_HACK
diff --git a/debian/patches/63-add-utempter-switch.patch b/debian/patches/63-add-utempter-switch.patch
new file mode 100644
index 0000000..3f65c2a
--- /dev/null
+++ b/debian/patches/63-add-utempter-switch.patch
@@ -0,0 +1,24 @@
+Description: Add guarding commandline option around libutempter check
+Author: Axel Beckert <abe@debian.org>
+Forwarded: not-yet
+Bug-Debian: https://bugs.debian.org/819781
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -844,6 +844,8 @@
+ ],
+ [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
+ )
++AC_ARG_ENABLE(utempter, [ --enable-utempter enable utempter support])
++if test "$enable_pam" = "yes"; then
+ AC_CHECKING(ut_host)
+ AC_TRY_COMPILE([
+ #include <time.h>
+@@ -860,6 +862,7 @@
+ AC_DEFINE(HAVE_UTEMPTER)
+ LIBS="$LIBS -lutempter"
+ fi
++fi
+
+ dnl
+ dnl **** loadav ****
diff --git a/debian/patches/64-fix-manpage-typos-reported-by-lintian.patch b/debian/patches/64-fix-manpage-typos-reported-by-lintian.patch
new file mode 100644
index 0000000..bbba598
--- /dev/null
+++ b/debian/patches/64-fix-manpage-typos-reported-by-lintian.patch
@@ -0,0 +1,82 @@
+Description: Fix spelling errors found by Lintian
+Author: Axel Beckert <abe@debian.org>
+Forwarded: not-yet
+
+--- a/NEWS.3.5
++++ b/NEWS.3.5
+@@ -27,7 +27,7 @@
+ Please run the 'newsyntax' script on your old screenrc files!
+
+ * Emacs style isearch added to copy mode. Try ^A ESC ^R screen ^R ^R
+- to locate the last three occurences of the word 'screen' in the
++ to locate the last three occurrences of the word 'screen' in the
+ history buffer.
+
+ * New command 'silence'. Alarms the user whenever there was inactivity
+--- a/doc/screen.1
++++ b/doc/screen.1
+@@ -1511,7 +1511,7 @@
+ \fBB\fP, \fBE\fP@move the cursor WORD by WORD (as in vi).
+ _
+ \fBf/F\fP, \fBt/T\fP@T{
+-move the cursor forward/backward to the next occurence of the
++move the cursor forward/backward to the next occurrence of the
+ target. (eg, '3fy' will move the cursor to the 3rd 'y' to the right.)
+ T}
+ _
+@@ -1533,7 +1533,7 @@
+ _
+ .TE
+ .\"\fBf\fP,\fBt\fP, \fBF\fP, \fBT\fP@T{
+-.\"move the cursor forward/backward to the next occurence of the target.
++.\"move the cursor forward/backward to the next occurrence of the target.
+ .\"T}
+
+ .PP
+@@ -1565,7 +1565,7 @@
+ Example: \*QC-a C-[ H 10 j 5 Y\*U will copy lines
+ 11 to 15 into the paste buffer.
+ .PP
+-The folllowing search keys are defined:
++The following search keys are defined:
+ .IP
+ \fB/\fP \fIVi\fP-like search forward.
+ .IP
+@@ -2258,7 +2258,7 @@
+ This forces any currently selected region to be automatically
+ resized at least a certain \fIwidth\fP and \fIheight\fP. All
+ other surrounding regions will be resized in order to accommodate.
+-This constraint follows everytime the \*Qfocus\*U command is
++This constraint follows every time the \*Qfocus\*U command is
+ used. The \*Qresize\*U command can be used to increase either
+ dimension of a region, but never below what is set with
+ \*Qfocusminsize\*U. The underscore `_' is a synonym for
+@@ -3191,7 +3191,7 @@
+ .I screen
+ will prompt for how you would like to resize the current region.
+
+-See \*Qfocusminsize\*U if you want to restrict the minimun size a region
++See \*Qfocusminsize\*U if you want to restrict the minimum size a region
+ can have.
+ .RE
+ .RE
+--- a/doc/screen.texinfo
++++ b/doc/screen.texinfo
+@@ -2212,7 +2212,7 @@
+ Without any arguments, @code{screen} will prompt for how you would
+ like to resize the current region.
+
+-See @code{focusminsize} if you want to restrict the minimun size a region can have.
++See @code{focusminsize} if you want to restrict the minimum size a region can have.
+
+ @end deffn
+
+@@ -3689,7 +3689,7 @@
+
+ @noindent
+ @kbd{f}/@kbd{F}, @kbd{t}/@kbd{T} move the cursor forward/backward to the
+-next occurence of the target. (eg, '3fy' will move the cursor to the 3rd
++next occurrence of the target. (eg, '3fy' will move the cursor to the 3rd
+ 'y' to the right.)
+
+ @noindent
diff --git a/debian/patches/80_session_creation_docs.patch b/debian/patches/80_session_creation_docs.patch
new file mode 100644
index 0000000..c707dd0
--- /dev/null
+++ b/debian/patches/80_session_creation_docs.patch
@@ -0,0 +1,74 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Add lookup code for the creation time of each session.
+ Requires digging in /proc/$pid and /proc/uptime, though, so it's
+ definitely no candidate for the Beautiful C contest.
+ .
+ Affects screen's behaviour in the following situations:
+ .
+ * 'screen -ls' lists available sessions sorted chronologically
+ * 'screen -RR' now picks the youngest session instead of an
+ arbitrary one
+ .
+ Patch 1/3: documentation
+Bug-Debian: https://bugs.debian.org/206572
+Forwarded: not-yet
+
+--- a/doc/screen.1
++++ b/doc/screen.1
+@@ -244,7 +244,7 @@
+ .IR screen ,
+ but prints a list of
+ .I pid.tty.host
+-strings identifying your
++strings and creation timestamps identifying your
+ .I screen
+ sessions.
+ Sessions marked `detached' can be resumed with \*Qscreen \-r\*U. Those marked
+@@ -351,7 +351,7 @@
+ .I screen
+ is detached. Otherwise lists available sessions.
+ .B \-RR
+-attempts to resume the first detached
++attempts to resume the youngest (in terms of creation time) detached
+ .I screen
+ session it finds. If successful, all other command-line options are ignored.
+ If no detached session exists, starts a new session using the specified
+@@ -361,6 +361,8 @@
+ .I screen
+ is run as a login-shell (actually screen uses \*Q\-xRR\*U in that case).
+ For combinations with the \fB\-d\fP/\fB\-D\fP option see there.
++.B Note:
++Time-based session selection is a Debian addition.
+ .TP 5
+ .BI "\-s " program
+ sets the default shell to the program specified, instead of the value
+--- a/doc/screen.texinfo
++++ b/doc/screen.texinfo
+@@ -321,7 +321,8 @@
+ @itemx -list [@var{match}]
+ Do not start @code{screen}, but instead print a list of session
+ identification strings (usually of the form @var{pid.tty.host};
+-@pxref{Session Name}). Sessions marked @samp{detached} can be resumed
++@pxref{Session Name}) and the corresponding creation timestamps.
++Sessions marked @samp{detached} can be resumed
+ with @code{screen -r}. Those marked @samp{attached} are running and
+ have a controlling terminal. If the session runs in multiuser mode,
+ it is marked @samp{multi}. Sessions marked as @samp{unreachable} either
+@@ -415,14 +416,15 @@
+ when only one @code{screen} is detached. Otherwise lists available sessions.
+
+ @item -RR
+-Resume the first appropriate detached @code{screen} session. If
+-successful, all other command-line options are ignored. If no detached
++Resume the most-recently created appropriate detached @code{screen} session.
++If successful, all other command-line options are ignored. If no detached
+ session exists, start a new session using the specified options, just as
+ if @samp{-R} had not been specified. This option is set by default if
+ screen is run as a login-shell (actually screen uses @samp{-xRR} in
+ that case).
+ For combinations with the
+ @samp{-D}/@samp{-d} option see there.
++@samp{Note:} Time-based session selection is a Debian addition.
+
+ @item -s @var{program}
+ Set the default shell to be @var{program}. By default, @code{screen}
diff --git a/debian/patches/81_session_creation_util.patch b/debian/patches/81_session_creation_util.patch
new file mode 100644
index 0000000..318d3b0
--- /dev/null
+++ b/debian/patches/81_session_creation_util.patch
@@ -0,0 +1,77 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Add lookup code for the creation time of each session.
+ Requires digging in /proc/$pid and /proc/uptime, though, so it's
+ definitely no candidate for the Beautiful C contest.
+ .
+ Affects screen's behaviour in the following situations:
+ .
+ * 'screen -ls' lists available sessions sorted chronologically
+ * 'screen -RR' now picks the youngest session instead of an
+ arbitrary one
+ .
+ Patch 2/3: new utility functions
+Bug-Debian: https://bugs.debian.org/206572
+Forwarded: not-yet
+
+--- a/extern.h
++++ b/extern.h
+@@ -395,6 +395,8 @@
+ #else
+ extern int xsnprintf __P(());
+ #endif
++extern time_t SessionCreationTime __P((const char *));
++extern time_t GetUptime __P((void));
+
+
+ /* acl.c */
+--- a/misc.c
++++ b/misc.c
+@@ -30,6 +30,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h> /* mkdir() declaration */
+ #include <signal.h>
++#include <fcntl.h>
+
+ #include "config.h"
+ #include "screen.h"
+@@ -796,3 +797,40 @@
+ }
+
+ #endif
++
++time_t SessionCreationTime(const char *fifo) {
++ char ppath[20];
++ int pfd;
++ char pdata[512];
++ char *jiffies;
++
++ int pid = atoi(fifo);
++ if (pid <= 0) return 0;
++ sprintf(ppath, "/proc/%u/stat", pid);
++ pfd = open(ppath, O_RDONLY);
++ if (pfd < 0) return 0;
++ while (1) {
++ int R=0, RR;
++ RR = read(pfd, pdata + R, 512-R);
++ if (RR < 0) {close(pfd); return 0;}
++ else if (RR == 0) break;
++ }
++ close(pfd);
++
++ for (pfd=21, jiffies=pdata; pfd; --pfd) {
++ jiffies = strchr(jiffies, ' ');
++ if (!jiffies) break; else ++jiffies;
++ }
++ if (!jiffies) return 0;
++
++ return atol(jiffies) / 100;
++}
++
++time_t GetUptime(void) {
++ char uptimestr[32];
++ int fd = open("/proc/uptime", O_RDONLY);
++ if (fd < 0) return 0;
++ (void)read(fd, uptimestr, 32);
++ close(fd);
++ return atol(uptimestr);
++}
diff --git a/debian/patches/82_session_creation_core.patch b/debian/patches/82_session_creation_core.patch
new file mode 100644
index 0000000..72fa1f3
--- /dev/null
+++ b/debian/patches/82_session_creation_core.patch
@@ -0,0 +1,161 @@
+Author: Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>
+Description: Add lookup code for the creation time of each session.
+ Requires digging in /proc/$pid and /proc/uptime, though, so it's
+ definitely no candidate for the Beautiful C contest.
+ .
+ Affects screen's behaviour in the following situations:
+ .
+ * 'screen -ls' lists available sessions sorted chronologically
+ * 'screen -RR' now picks the youngest session instead of an
+ arbitrary one
+ .
+ Patch 3/3: implementation of actual new feature
+Bug-Debian: https://bugs.debian.org/206572
+Bug-Debian: https://bugs.debian.org/507817
+Forwarded: not-yet
+
+--- a/socket.c
++++ b/socket.c
+@@ -137,16 +137,18 @@
+ int sdirlen;
+ int matchlen = 0;
+ char *name, *n;
+- int firsts = -1, sockfd;
+- char *firstn = NULL;
++ int sockfd;
+ int nfound = 0, ngood = 0, ndead = 0, nwipe = 0, npriv = 0;
+ int nperfect = 0;
++ time_t time_sysboot = time(NULL) - GetUptime();
+ struct sent
+ {
+ struct sent *next;
+ int mode;
++ int fd;
+ char *name;
+- } *slist, **slisttail, *sent, *nsent;
++ time_t time_created;
++ } *slist, **slisttail, *sent, *nsent, *schosen;
+
+ if (match)
+ {
+@@ -172,7 +174,7 @@
+ if ((dirp = opendir(SockPath)) == 0)
+ Panic(errno, "Cannot opendir %s", SockPath);
+
+- slist = 0;
++ slist = schosen = NULL;
+ slisttail = &slist;
+ while ((dp = readdir(dirp)))
+ {
+@@ -255,13 +257,16 @@
+ debug(" store it.\n");
+ if ((sent = (struct sent *)malloc(sizeof(struct sent))) == 0)
+ continue;
+- sent->next = 0;
+ sent->name = SaveStr(name);
+ sent->mode = mode;
++ sent->time_created = time_sysboot + SessionCreationTime(name);
++ for (slisttail = &slist; *slisttail; slisttail = &((*slisttail)->next)) {
++ if ((*slisttail)->time_created < sent->time_created) break;
++ }
++ sent->next = *slisttail;
+ *slisttail = sent;
+- slisttail = &sent->next;
+ nfound++;
+- sockfd = MakeClientSocket(0, *is_sock);
++ sent->fd = sockfd = MakeClientSocket(0, *is_sock);
+ #ifdef USE_SETEUID
+ /* MakeClientSocket sets ids back to eff */
+ xseteuid(real_uid);
+@@ -326,12 +331,17 @@
+ ngood++;
+ if (cmatch)
+ nperfect++;
+- if (fdp && (firsts == -1 || (cmatch && nperfect == 1)))
++ // prefer the current one if one of the following is true:
++ // - we had no previous hit
++ // - the current one has a later timestamp than our previous one, and we haven't found a perfect match yet
++ // - this one is the first perfect match
++ if (fdp && (!schosen ||
++ (schosen && schosen->time_created < sent->time_created && nperfect == 0) ||
++ (cmatch && nperfect == 1)))
+ {
+- if (firsts != -1)
+- close(firsts);
+- firsts = sockfd;
+- firstn = sent->name;
++ if (schosen)
++ close(schosen->fd);
++ schosen = sent;
+ debug(" taken.\n");
+ }
+ else
+@@ -359,36 +369,27 @@
+ }
+ for (sent = slist; sent; sent = sent->next)
+ {
+- switch (sent->mode)
++ char timestr[64];
++ if (sent->time_created == 0)
+ {
+- case 0700:
+- printf("\t%s\t(Attached)\n", sent->name);
+- break;
+- case 0600:
+- printf("\t%s\t(Detached)\n", sent->name);
+- break;
++ sprintf(timestr, "??" "?");
++ }
++ else
++ {
++ strftime(timestr, 64, "%x %X", localtime(&sent->time_created));
++ }
++ printf("\t%s\t(%s)\t(%s)\n", sent->name, timestr,
++ (sent->mode == 0700) ? "Attached" :
++ (sent->mode == 0600) ? "Detached" :
+ #ifdef MULTIUSER
+- case 0701:
+- printf("\t%s\t(Multi, attached)\n", sent->name);
+- break;
+- case 0601:
+- printf("\t%s\t(Multi, detached)\n", sent->name);
+- break;
++ (sent->mode == 0701) ? "Multi, attached" :
++ (sent->mode == 0601) ? "Multi, detached" :
+ #endif
+- case -1:
+- /* No trigraphs here! */
+- printf("\t%s\t(Dead ?%c?)\n", sent->name, '?');
+- break;
+- case -2:
+- printf("\t%s\t(Removed)\n", sent->name);
+- break;
+- case -3:
+- printf("\t%s\t(Remote or dead)\n", sent->name);
+- break;
+- case -4:
+- printf("\t%s\t(Private)\n", sent->name);
+- break;
+- }
++ (sent->mode == -1) ? "Dead ??" "?" :
++ (sent->mode == -2) ? "Removed" :
++ (sent->mode == -3) ? "Remote or dead" :
++ (sent->mode == -4) ? "Private" :
++ "Unknown");
+ }
+ }
+ if (ndead && !quietflag)
+@@ -399,10 +400,10 @@
+ else
+ Msg(0, m, ndead > 1 ? "s" : "", ndead > 1 ? "" : "es"); /* other args for nethack */
+ }
+- if (firsts != -1)
++ if (schosen)
+ {
+- sprintf(SockPath + sdirlen, "/%s", firstn);
+- *fdp = firsts;
++ sprintf(SockPath + sdirlen, "/%s", schosen->name);
++ *fdp = schosen->fd;
+ }
+ else
+ SockPath[sdirlen] = 0;
diff --git a/debian/patches/90_Expand-d_xtermosc-array-in-struct-display.patch b/debian/patches/90_Expand-d_xtermosc-array-in-struct-display.patch
new file mode 100644
index 0000000..863af93
--- /dev/null
+++ b/debian/patches/90_Expand-d_xtermosc-array-in-struct-display.patch
@@ -0,0 +1,30 @@
+Origin: 92e86ba5787c42df8a057bdeac4560ca127535a4
+From: Václav Doležal <vdolezal@redhat.com>
+Date: Fri, 21 Feb 2020 14:02:51 +0100
+Bug: https://lists.gnu.org/archive/html/screen-devel/2020-02/msg00011.html
+Description: Expand d_xtermosc array in struct display
+
+Commit c5db181 expands index range of "typ2" by one without expanding
+affected arrays. d_xtermosc in struct display is one of these.
+
+Related: c5db181b6e017cfccb8d7842ce140e59294d9f62
+ (ansi: add support for xterm OSC 11)
+Related: 68386dfb1fa33471372a8cd2e74686758a2f527b
+ (Fix out of bounds access when setting w_xtermosc after OSC 49)
+
+Signed-off-by: Václav Doležal <vdolezal@redhat.com>
+---
+ src/display.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/display.h
++++ b/display.h
+@@ -112,7 +112,7 @@
+ int d_mousetrack; /* set when user wants to use mouse even when the window
+ does not */
+ #ifdef RXVT_OSC
+- int d_xtermosc[4]; /* osc used */
++ int d_xtermosc[5]; /* osc used */
+ #endif
+ struct mchar d_lpchar; /* missing char */
+ struct timeval d_status_time; /* time of status display */
diff --git a/debian/patches/91_TERMCAP_BUF-is-used-in-place-of-TERMCAP_BUFSIZE.patch b/debian/patches/91_TERMCAP_BUF-is-used-in-place-of-TERMCAP_BUFSIZE.patch
new file mode 100644
index 0000000..bbe1bc6
--- /dev/null
+++ b/debian/patches/91_TERMCAP_BUF-is-used-in-place-of-TERMCAP_BUFSIZE.patch
@@ -0,0 +1,21 @@
+Description: TERMCAP_BUF is used in place of TERMCAP_BUFSIZE.
+Origin: 30c9a2a6c190647e35d1ce7b4758de9081f06d10
+Author: Victor Dmitriev <mrvvitek@gmail.com>
+Date: Mon, 27 Apr 2020 18:12:56 +0200
+Bug: https://savannah.gnu.org/bugs/?58258
+
+---
+ src/termcap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/termcap.c
++++ b/termcap.c
+@@ -1066,7 +1066,7 @@
+ {
+ if (i >= T_KEYPAD) /* don't put keypad codes in TERMCAP */
+ continue; /* - makes it too big */
+-#if (TERMCAP_BUF < 1024)
++#if (TERMCAP_BUFSIZE < 1024)
+ if (i >= T_FEXTRA && i < T_BACKTAB) /* also skip extra vt220 keys */
+ continue;
+ if (i > T_BACKTAB && i < T_NAVIGATE) /* more vt220 keys */
diff --git a/debian/patches/99_CVE-2021-26937.patch b/debian/patches/99_CVE-2021-26937.patch
new file mode 100644
index 0000000..8878a79
--- /dev/null
+++ b/debian/patches/99_CVE-2021-26937.patch
@@ -0,0 +1,64 @@
+Description: [CVE-2021-26937] Fix out of bounds array access
+Author: Michael Schröder <mls@suse.de>
+Bug-Debian: https://bugs.debian.org/982435
+Bug: https://savannah.gnu.org/bugs/?60030
+Bug: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00000.html
+Bug-OSS-Security: https://www.openwall.com/lists/oss-security/2021/02/09/3
+Origin: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00010.html
+
+--- a/encoding.c
++++ b/encoding.c
+@@ -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 combining 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/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..c5cba56
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,20 @@
+# 01-08: fixes to configure, altering preprocessor macros etc.
+05prefer-libtinfo-over-libcurses.patch
+# 10-79: "regular" code and documentation fixes
+11replace_doc_paths.patch
+13split_info_files.patch
+26source_encoding.patch
+45suppress_remap.patch
+52fix_screen_utf8_nfd.patch
+58-show-encoding-hardstatus.patch
+60-screen-4.2.1-debian4.1.0-compatibility.patch
+61-default-PATH_MAX-if-undefined-for-hurd.patch
+63-add-utempter-switch.patch
+64-fix-manpage-typos-reported-by-lintian.patch
+# 80-89: experimental patches, new features etc.
+80_session_creation_docs.patch
+81_session_creation_util.patch
+82_session_creation_core.patch
+90_Expand-d_xtermosc-array-in-struct-display.patch
+91_TERMCAP_BUF-is-used-in-place-of-TERMCAP_BUFSIZE.patch
+99_CVE-2021-26937.patch