1 |
commit: ea2c3fc6deedb313f1c6aaa49d4e9b87e1b3c805 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 3 08:08:55 2021 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 3 08:09:41 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea2c3fc6 |
7 |
|
8 |
app-misc/mc: fix shadow render on ncurses |
9 |
|
10 |
Reported-by: Thomas Deutschmann |
11 |
Closes: https://bugs.gentoo.org/768285 |
12 |
Package-Manager: Portage-3.0.14, Repoman-3.0.2 |
13 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
14 |
|
15 |
app-misc/mc/files/mc-4.8.26-shadow-crash.patch | 39 +++++++++ |
16 |
app-misc/mc/mc-4.8.26-r1.ebuild | 108 +++++++++++++++++++++++++ |
17 |
2 files changed, 147 insertions(+) |
18 |
|
19 |
diff --git a/app-misc/mc/files/mc-4.8.26-shadow-crash.patch b/app-misc/mc/files/mc-4.8.26-shadow-crash.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..4eeee45bc8e |
22 |
--- /dev/null |
23 |
+++ b/app-misc/mc/files/mc-4.8.26-shadow-crash.patch |
24 |
@@ -0,0 +1,39 @@ |
25 |
+https://bugs.gentoo.org/768285 |
26 |
+https://midnight-commander.org/ticket/4192 |
27 |
+ |
28 |
+From 6394547dbffbad44ea50c64c282de4b610ca07bf Mon Sep 17 00:00:00 2001 |
29 |
+From: Sergei Trofimovich <slyfox@g.o> |
30 |
+Date: Wed, 3 Feb 2021 09:47:13 +0300 |
31 |
+Subject: [PATCH] Ticket #4192: fix crash if shadow is out of screen. |
32 |
+ |
33 |
+(tty_clip): add extra tests for area boundaries. |
34 |
+ |
35 |
+Signed-off-by: Andrew Borodin <aborodin@×××××.ru> |
36 |
+--- |
37 |
+ lib/tty/tty-ncurses.c | 7 +++++++ |
38 |
+ 1 file changed, 7 insertions(+) |
39 |
+ |
40 |
+diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c |
41 |
+index 03235cd5b..5cddf5059 100644 |
42 |
+--- a/lib/tty/tty-ncurses.c |
43 |
++++ b/lib/tty/tty-ncurses.c |
44 |
+@@ -152,9 +152,16 @@ tty_clip (int *y, int *x, int *rows, int *cols) |
45 |
+ |
46 |
+ if (*y + *rows > LINES) |
47 |
+ *rows = LINES - *y; |
48 |
++ |
49 |
++ if (*rows <= 0) |
50 |
++ return FALSE; |
51 |
++ |
52 |
+ if (*x + *cols > COLS) |
53 |
+ *cols = COLS - *x; |
54 |
+ |
55 |
++ if (*cols <= 0) |
56 |
++ return FALSE; |
57 |
++ |
58 |
+ return TRUE; |
59 |
+ } |
60 |
+ |
61 |
+-- |
62 |
+2.30.0 |
63 |
+ |
64 |
|
65 |
diff --git a/app-misc/mc/mc-4.8.26-r1.ebuild b/app-misc/mc/mc-4.8.26-r1.ebuild |
66 |
new file mode 100644 |
67 |
index 00000000000..222451104a3 |
68 |
--- /dev/null |
69 |
+++ b/app-misc/mc/mc-4.8.26-r1.ebuild |
70 |
@@ -0,0 +1,108 @@ |
71 |
+# Copyright 1999-2021 Gentoo Authors |
72 |
+# Distributed under the terms of the GNU General Public License v2 |
73 |
+ |
74 |
+EAPI=7 |
75 |
+ |
76 |
+inherit flag-o-matic |
77 |
+ |
78 |
+MY_P=${P/_/-} |
79 |
+ |
80 |
+DESCRIPTION="GNU Midnight Commander is a text based file manager" |
81 |
+HOMEPAGE="https://www.midnight-commander.org" |
82 |
+SRC_URI="http://ftp.midnight-commander.org/${MY_P}.tar.xz" |
83 |
+ |
84 |
+LICENSE="GPL-3" |
85 |
+SLOT="0" |
86 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris" |
87 |
+IUSE="+edit gpm nls samba sftp +slang spell test unicode X +xdg" |
88 |
+ |
89 |
+REQUIRED_USE="spell? ( edit )" |
90 |
+ |
91 |
+RDEPEND=">=dev-libs/glib-2.26.0:2 |
92 |
+ gpm? ( sys-libs/gpm ) |
93 |
+ kernel_linux? ( sys-fs/e2fsprogs ) |
94 |
+ samba? ( net-fs/samba ) |
95 |
+ sftp? ( net-libs/libssh2 ) |
96 |
+ slang? ( >=sys-libs/slang-2 ) |
97 |
+ !slang? ( sys-libs/ncurses:0=[unicode?] ) |
98 |
+ spell? ( app-text/aspell ) |
99 |
+ X? ( x11-libs/libX11 |
100 |
+ x11-libs/libICE |
101 |
+ x11-libs/libXau |
102 |
+ x11-libs/libXdmcp |
103 |
+ x11-libs/libSM )" |
104 |
+DEPEND="${RDEPEND} |
105 |
+ app-arch/xz-utils |
106 |
+ virtual/pkgconfig |
107 |
+ nls? ( sys-devel/gettext ) |
108 |
+ test? ( dev-libs/check ) |
109 |
+ " |
110 |
+ |
111 |
+PATCHES=("${FILESDIR}"/${P}-shadow-crash.patch) |
112 |
+ |
113 |
+RESTRICT="!test? ( test )" |
114 |
+ |
115 |
+S="${WORKDIR}/${MY_P}" |
116 |
+ |
117 |
+pkg_pretend() { |
118 |
+ if use slang && use unicode ; then |
119 |
+ ewarn "\"unicode\" USE flag only takes effect when the \"slang\" USE flag is disabled." |
120 |
+ fi |
121 |
+} |
122 |
+ |
123 |
+src_configure() { |
124 |
+ [[ ${CHOST} == *-solaris* ]] && append-ldflags "-lnsl -lsocket" |
125 |
+ |
126 |
+ local myeconfargs=( |
127 |
+ --enable-charset |
128 |
+ --enable-vfs |
129 |
+ --with-homedir=$(usex xdg 'XDG' '.mc') |
130 |
+ --with-screen=$(usex slang 'slang' "ncurses$(usex unicode 'w' '')") |
131 |
+ $(use_enable kernel_linux vfs-undelfs) |
132 |
+ # Today mclib does not expose any headers and is linked to |
133 |
+ # single 'mc' binary. Thus there is no advantage of having |
134 |
+ # a library. Let's avoid shared library altogether |
135 |
+ # as it also conflicts with sci-libs/mc: bug #685938 |
136 |
+ --disable-mclib |
137 |
+ $(use_enable nls) |
138 |
+ $(use_enable samba vfs-smb) |
139 |
+ $(use_enable sftp vfs-sftp) |
140 |
+ $(use_enable spell aspell) |
141 |
+ $(use_enable test tests) |
142 |
+ $(use_with gpm gpm-mouse) |
143 |
+ $(use_with X x) |
144 |
+ $(use_with edit internal-edit) |
145 |
+ ) |
146 |
+ econf "${myeconfargs[@]}" |
147 |
+} |
148 |
+ |
149 |
+src_test() { |
150 |
+ # CK_FORK=no to avoid using fork() in check library |
151 |
+ # as mc mocks fork() itself: bug #644462. |
152 |
+ # |
153 |
+ # VERBOSE=1 to make test failures contain detailed |
154 |
+ # information. |
155 |
+ CK_FORK=no emake check VERBOSE=1 |
156 |
+} |
157 |
+ |
158 |
+src_install() { |
159 |
+ emake DESTDIR="${D}" install |
160 |
+ dodoc AUTHORS README NEWS |
161 |
+ |
162 |
+ # fix bug #334383 |
163 |
+ if use kernel_linux && [[ ${EUID} == 0 ]] ; then |
164 |
+ fowners root:tty /usr/libexec/mc/cons.saver |
165 |
+ fperms g+s /usr/libexec/mc/cons.saver |
166 |
+ fi |
167 |
+ |
168 |
+ if ! use xdg ; then |
169 |
+ sed 's@MC_XDG_OPEN="xdg-open"@MC_XDG_OPEN="/bin/false"@' \ |
170 |
+ -i "${ED}"/usr/libexec/mc/ext.d/*.sh || die |
171 |
+ fi |
172 |
+} |
173 |
+ |
174 |
+pkg_postinst() { |
175 |
+ elog "To enable exiting to latest working directory," |
176 |
+ elog "put this into your ~/.bashrc:" |
177 |
+ elog ". ${EPREFIX}/usr/libexec/mc/mc.sh" |
178 |
+} |