Browse code

screen update

Hanno Böck authored on06/03/2021 11:09:04
Showing3 changed files
... ...
@@ -1,6 +1,8 @@
1 1
 AUX screen-4.3.0-no-utempter.patch 341 BLAKE2B 3339783b3574f82f093c82a613ad18c5c58c184c082c2c311281cdd57e7176abae0f5935466a4a8b4d931d1d1b93d8f0a4e6b558a268553af4a0170061e6ebfe SHA512 f4191ba1ecac3076f958f56309c0a1d523b455fa4e3388f1cfca59c8ccff0afdfb20ef18d54794ba539b2b6d1511ed599dc44787344dc5ccce2902c9b9848155
2 2
 AUX screen-4.6.2-utmp-exit.patch 1558 BLAKE2B e08e83f8b9f0cd09cd9bad4486a75d71bd899a7917954702ece0837099639079a746138374cbeaf71072cca64ae36a3c2a32250123c6747089e724272227e0dd SHA512 0e7c6c224f6fb8e01650b778cb2b155942752504dc97112d9594b7fa0da1bb8bd828240a2519b1c21f1c162181da89a8daa51ef7f74c8ced0b85cdb3e911a67c
3
+AUX screen-CVE-2021-26937.patch 1864 BLAKE2B 7425a49e003601f21130cf9c42354aaeb5f3cd639dd274971393420ccf45e8273539ae020f8a1a6e4063e741e75dcbf8cecd4e35b26c6d04ffca108ddea7bd32 SHA512 419f4d10b23369fccdadfb024b6ce268794e7f76188b25dd9051ff8cd6080dc0c70f66b9c2480095d655bb63f20ba1fdfa1ce0c681c9b8aff4d4918764018516
3 4
 AUX screenrc 10412 BLAKE2B f4866f4a83b22c37484b66e4c7d52ec479fe12ae3e72e5c9e769b1b543ecf04d14ef4339e1c72064741cbf39502ef82d3beb213326a30889f128e135f60bd528 SHA512 06fbec5e28480a2c369330fac0c94faa47e5d28e037d9fefd0cb3e813002c504866dc8ac86872b7ac6f16059a219e396a9c425b578b8afe882153ddb506158f7
4 5
 DIST screen-4.8.0.tar.gz 854854 BLAKE2B 97ef6f18bf2c63c477260b742ac0b3501f112d380c41ccecc5cf2853db853cc62d4fd6d37edeca35fb41a43b76d98a5cfe160749c992d284f9764b0a0fdcc778 SHA512 770ebaf6ee9be711bcb8a6104b3294f2bf4523dae6683fdc5eac4b3aff7e511be2d922b6b2ad28ec241113c2e4fe0d80f9a482ae1658adc19c8c3a3680caa25c
5 6
 EBUILD screen-4.8.0-r1.ebuild 4072 BLAKE2B 4c1ac6d6807b377d5b648f453ab618195fd20871a4d1fe9bc77c5c64efea0b2548022c78ed079aa2582f1677f96dee7b502d3a6b7e406b0e1b0e1cb458db8b38 SHA512 5f2e18376474a2ab897958da5d7f9ebd09076889cfbf82f9e372c082c73790cc12eb9530d80a8f016861d431b8ce5cc4abe89544ef75cc8047338da6d25010d7
7
+EBUILD screen-4.8.0-r2.ebuild 4115 BLAKE2B e948a011d1ff91a9643efc2df77d1cfee102505bbc47084f30c4eea52d7517bdf8c873ab9a5b5d658ca5a6bdeb18707f3c249e6c6a93503252c741b9cd292ba5 SHA512 ddd2fee4195b06a080d9db19ec471391a013e2febc8d33b626eb5f9afa4fd391090755333b5a415517f09752b54a9053930842acdf64b752ed307361e675108a
6 8
 MISC metadata.xml 1836 BLAKE2B 4625e11b8c3120b23e613e14d03ac88b505b412be97270159c881f56ebf674c78274a8dcf199d69ea91f6438d2661635ebbbf38fdc7ebebe8dd6e2ff88f4c6d7 SHA512 e327b61501e6b496045d552851db574b519a99f56c9203c3376b886808a422f8e4aab23b667bcab0d1388ba7ea781c9c9e9f1d07b1426f113119c60cd70d0bcf
7 9
new file mode 100644
... ...
@@ -0,0 +1,61 @@
1
+ encoding.c | 15 +++++++++------
2
+ 1 file changed, 9 insertions(+), 6 deletions(-)
3
+
4
+diff --git i/encoding.c w/encoding.c
5
+index e5db3e7..79f5d14 100644
6
+--- i/encoding.c
7
+@@ -43,7 +43,7 @@ static int  encmatch __P((char *, char *));
8
+ # ifdef UTF8
9
+ static int   recode_char __P((int, int, int));
10
+ static int   recode_char_to_encoding __P((int, int));
11
+-static void  comb_tofront __P((int, int));
12
++static void  comb_tofront __P((int));
13
+ #  ifdef DW_CHARS
14
+ static int   recode_char_dw __P((int, int *, int, int));
15
+ static int   recode_char_dw_to_encoding __P((int, int *, int));
16
+@@ -1263,6 +1263,8 @@ int c;
17
+     {0x30000, 0x3FFFD},
18
+   };
19
+ 
20
++  if (c >= 0xdf00 && c <= 0xdfff)
21
++    return 1;          /* dw combining sequence */
22
+   return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
23
+           (cjkwidth &&
24
+            bisearch(c, ambiguous,
25
+@@ -1330,11 +1332,12 @@ int c;
26
+ }
27
+ 
28
+ static void
29
+-comb_tofront(root, i)
30
+-int root, i;
31
++comb_tofront(i)
32
++int i;
33
+ {
34
+   for (;;)
35
+     {
36
++      int root = i >= 0x700 ? 0x801 : 0x800;
37
+       debug1("bring to front: %x\n", i);
38
+       combchars[combchars[i]->prev]->next = combchars[i]->next;
39
+       combchars[combchars[i]->next]->prev = combchars[i]->prev;
40
+@@ -1396,9 +1399,9 @@ struct mchar *mc;
41
+     {
42
+       /* full, recycle old entry */
43
+       if (c1 >= 0xd800 && c1 < 0xe000)
44
+-        comb_tofront(root, c1 - 0xd800);
45
++        comb_tofront(c1 - 0xd800);
46
+       i = combchars[root]->prev;
47
+-      if (c1 == i + 0xd800)
48
++      if (i == 0x800 || i == 0x801 || c1 == i + 0xd800)
49
+ 	{
50
+ 	  /* completely full, can't recycle */
51
+ 	  debug("utf8_handle_comp: completely full!\n");
52
+@@ -1422,7 +1425,7 @@ struct mchar *mc;
53
+   mc->font  = (i >> 8) + 0xd8;
54
+   mc->fontx = 0;
55
+   debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800);
56
+-  comb_tofront(root, i);
57
++  comb_tofront(i);
58
+ }
59
+ 
60
+ #else /* !UTF8 */
0 61
new file mode 100644
... ...
@@ -0,0 +1,158 @@
1
+# Copyright 1999-2021 Gentoo Authors
2
+# Distributed under the terms of the GNU General Public License v2
3
+
4
+EAPI=7
5
+
6
+inherit autotools flag-o-matic pam tmpfiles toolchain-funcs
7
+
8
+DESCRIPTION="screen manager with VT100/ANSI terminal emulation"
9
+HOMEPAGE="https://www.gnu.org/software/screen/"
10
+
11
+if [[ "${PV}" != 9999 ]] ; then
12
+	SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
13
+	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
14
+else
15
+	inherit git-r3
16
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/screen.git"
17
+	EGIT_CHECKOUT_DIR="${WORKDIR}/${P}" # needed for setting S later on
18
+	S="${WORKDIR}"/${P}/src
19
+fi
20
+
21
+LICENSE="GPL-2"
22
+SLOT="0"
23
+IUSE="debug nethack pam selinux multiuser"
24
+
25
+CDEPEND="
26
+	>=sys-libs/ncurses-5.2:0=
27
+	pam? ( sys-libs/pam )"
28
+RDEPEND="${CDEPEND}
29
+	acct-group/utmp
30
+	selinux? ( sec-policy/selinux-screen )"
31
+DEPEND="${CDEPEND}
32
+	sys-apps/texinfo"
33
+
34
+PATCHES=(
35
+	# Don't use utempter even if it is found on the system.
36
+	"${FILESDIR}"/${PN}-4.3.0-no-utempter.patch
37
+	"${FILESDIR}"/${PN}-4.6.2-utmp-exit.patch
38
+	"${FILESDIR}"/${PN}-CVE-2021-26937.patch
39
+)
40
+
41
+src_prepare() {
42
+	default
43
+
44
+	# sched.h is a system header and causes problems with some C libraries
45
+	mv sched.h _sched.h || die
46
+	sed -i '/include/ s:sched.h:_sched.h:' screen.h || die
47
+
48
+	# Fix manpage.
49
+	sed -i \
50
+		-e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
51
+		-e "s:/usr/local/screens:${EPREFIX}/tmp/screen:g" \
52
+		-e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
53
+		-e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \
54
+		-e "s:/local/screens/S\\\-:${EPREFIX}/tmp/screen/S\\\-:g" \
55
+		doc/screen.1 || die
56
+
57
+	if [[ ${CHOST} == *-darwin* ]] || use elibc_musl ; then
58
+		sed -i -e '/^#define UTMPOK/s/define/undef/' acconfig.h || die
59
+	fi
60
+
61
+	# disable musl dummy headers for utmp[x]
62
+	use elibc_musl && append-cppflags "-D_UTMP_H -D_UTMPX_H"
63
+
64
+	# reconfigure
65
+	eautoreconf
66
+}
67
+
68
+src_configure() {
69
+	append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}"
70
+
71
+	if [[ ${CHOST} == *-solaris* ]] ; then
72
+		# enable msg_header by upping the feature standard compatible
73
+		# with c99 mode
74
+		append-cppflags -D_XOPEN_SOURCE=600
75
+	fi
76
+
77
+	use nethack || append-cppflags "-DNONETHACK"
78
+	use debug && append-cppflags "-DDEBUG"
79
+
80
+	local myeconfargs=(
81
+		--with-sys-screenrc="${EPREFIX}/etc/screenrc"
82
+		--with-pty-mode=0620
83
+		--with-pty-group=5
84
+		--enable-rxvt_osc
85
+		--enable-telnet
86
+		--enable-colors256
87
+		$(use_enable pam)
88
+	)
89
+	econf "${myeconfargs[@]}"
90
+}
91
+
92
+src_compile() {
93
+	LC_ALL=POSIX emake comm.h term.h
94
+	emake osdef.h
95
+
96
+	emake -C doc screen.info
97
+	default
98
+}
99
+
100
+src_install() {
101
+	local DOCS=(
102
+		README ChangeLog INSTALL TODO NEWS* patchlevel.h
103
+		doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps}
104
+	)
105
+
106
+	emake DESTDIR="${D}" SCREEN="${P}" install
107
+
108
+	local tmpfiles_perms tmpfiles_group
109
+
110
+	if use multiuser || use prefix ; then
111
+		fperms 4755 /usr/bin/${P}
112
+		tmpfiles_perms="0755"
113
+		tmpfiles_group="root"
114
+	else
115
+		fowners root:utmp /usr/bin/${P}
116
+		fperms 2755 /usr/bin/${P}
117
+		tmpfiles_perms="0775"
118
+		tmpfiles_group="utmp"
119
+	fi
120
+
121
+	newtmpfiles - screen.conf <<<"d /tmp/screen ${tmpfiles_perms} root ${tmpfiles_group}"
122
+
123
+	insinto /usr/share/${PN}
124
+	doins terminfo/{screencap,screeninfo.src}
125
+
126
+	insinto /etc
127
+	doins "${FILESDIR}"/screenrc
128
+
129
+	if use pam; then
130
+		pamd_mimic_system screen auth
131
+	fi
132
+
133
+	dodoc "${DOCS[@]}"
134
+}
135
+
136
+pkg_postinst() {
137
+	if [[ -z ${REPLACING_VERSIONS} ]]
138
+	then
139
+		elog "Some dangerous key bindings have been removed or changed to more safe values."
140
+		elog "We enable some xterm hacks in our default screenrc, which might break some"
141
+		elog "applications. Please check /etc/screenrc for information on these changes."
142
+	fi
143
+
144
+	# Add /tmp/screen in case it doesn't exist yet. This should solve
145
+	# problems like bug #508634 where tmpfiles.d isn't in effect.
146
+	local rundir="${EROOT}/tmp/${PN}"
147
+	if [[ ! -d ${rundir} ]] ; then
148
+		if use multiuser || use prefix ; then
149
+			tmpfiles_group="root"
150
+		else
151
+			tmpfiles_group="utmp"
152
+		fi
153
+		mkdir -m 0775 "${rundir}"
154
+		chgrp ${tmpfiles_group} "${rundir}"
155
+	fi
156
+
157
+	ewarn "This revision changes the screen socket location to ${rundir}"
158
+}