summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandy Barlow <randy@electronsweatshop.com>2021-05-27 23:49:53 -0400
committerSam James <sam@gentoo.org>2021-07-13 22:49:05 +0100
commit919ec7ae4b3e1bb25a475eb6cd1210c2d4d7c7b4 (patch)
tree10129c3dfa16538cd606cff9b78c303670ce2293 /app-admin/lnav
parentapp-admin/lnav: Backport patches to fix tests (diff)
downloadgentoo-919ec7ae4b3e1bb25a475eb6cd1210c2d4d7c7b4.tar.gz
gentoo-919ec7ae4b3e1bb25a475eb6cd1210c2d4d7c7b4.tar.bz2
gentoo-919ec7ae4b3e1bb25a475eb6cd1210c2d4d7c7b4.zip
app-admin/lnav: Backport to fix a segfault
lnav was segfaulting when the right arrow key was pressed. This commit backports a patch from the main development branch to address the crash. Closes: https://bugs.gentoo.org/792582 Package-Manager: Portage-3.0.18, Repoman-3.0.2 Signed-off-by: Randy Barlow <randy@electronsweatshop.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-admin/lnav')
-rw-r--r--app-admin/lnav/files/lnav-0.9.0-bug792582.patch97
-rw-r--r--app-admin/lnav/lnav-0.9.0-r1.ebuild49
2 files changed, 146 insertions, 0 deletions
diff --git a/app-admin/lnav/files/lnav-0.9.0-bug792582.patch b/app-admin/lnav/files/lnav-0.9.0-bug792582.patch
new file mode 100644
index 000000000000..9059712242a6
--- /dev/null
+++ b/app-admin/lnav/files/lnav-0.9.0-bug792582.patch
@@ -0,0 +1,97 @@
+From 141436933a8d30edfd33aa5fcfb0c93cfa3ae9d5 Mon Sep 17 00:00:00 2001
+From: Timothy Stack <timothyshanestack@gmail.com>
+Date: Wed, 9 Dec 2020 15:35:06 -0800
+Subject: [PATCH] [view_curses] use VC_ROLE instead of VC_STYLE where possible
+ and fix segv in mvwattrline
+
+Fixes #806
+
+Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
+---
+ src/highlighter.cc | 4 +++-
+ src/logfile_sub_source.cc | 17 ++++++++++-------
+ src/view_curses.cc | 9 ++++++---
+ 3 files changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/src/highlighter.cc b/src/highlighter.cc
+index 24aafebd..110ca03f 100644
+--- a/src/highlighter.cc
++++ b/src/highlighter.cc
+@@ -115,7 +115,9 @@ void highlighter::annotate(attr_line_t &al, int start) const
+ vc.match_color(this->h_bg));
+ }
+ if (this->h_role != view_colors::VCR_NONE) {
+- attrs |= vc.attrs_for_role(this->h_role);
++ sa.emplace_back(lr,
++ &view_curses::VC_ROLE,
++ this->h_role);
+ }
+ sa.emplace_back(lr, &view_curses::VC_STYLE, attrs);
+
+diff --git a/src/logfile_sub_source.cc b/src/logfile_sub_source.cc
+index 14e87002..dce0d4ae 100644
+--- a/src/logfile_sub_source.cc
++++ b/src/logfile_sub_source.cc
+@@ -468,25 +468,28 @@ void logfile_sub_source::text_attrs_for_line(textview_curses &lv,
+
+ shift_string_attrs(value_out, 0, time_offset_end);
+
+- attrs = vc.attrs_for_role(view_colors::VCR_OFFSET_TIME);
+- value_out.emplace_back(lr, &view_curses::VC_STYLE, attrs);
++ value_out.emplace_back(lr,
++ &view_curses::VC_ROLE,
++ view_colors::VCR_OFFSET_TIME);
+ value_out.emplace_back(line_range(12, 13),
+ &view_curses::VC_GRAPHIC, ACS_VLINE);
+
+- int bar_attrs = 0;
++ view_colors::role_t bar_role = view_colors::VCR_NONE;
+
+ switch (this->get_line_accel_direction(vis_line_t(row))) {
+ case log_accel::A_STEADY:
+ break;
+ case log_accel::A_DECEL:
+- bar_attrs = vc.attrs_for_role(view_colors::VCR_DIFF_DELETE);
++ bar_role = view_colors::VCR_DIFF_DELETE;
+ break;
+ case log_accel::A_ACCEL:
+- bar_attrs = vc.attrs_for_role(view_colors::VCR_DIFF_ADD);
++ bar_role = view_colors::VCR_DIFF_ADD;
+ break;
+ }
+- value_out.push_back(
+- string_attr(line_range(12, 13), &view_curses::VC_STYLE, bar_attrs));
++ if (bar_role != view_colors::VCR_NONE) {
++ value_out.emplace_back(
++ line_range(12, 13), &view_curses::VC_ROLE, bar_role);
++ }
+ }
+
+ lr.lr_start = 0;
+diff --git a/src/view_curses.cc b/src/view_curses.cc
+index 4a36a3ad..2456d53d 100644
+--- a/src/view_curses.cc
++++ b/src/view_curses.cc
+@@ -402,13 +402,16 @@ void view_curses::mvwattrline(WINDOW *window,
+ }
+ }
+
++ if (attr_range.lr_end == -1) {
++ attr_range.lr_end = line_width_chars;
++ }
++ if (attr_range.lr_end < lr_chars.lr_start) {
++ continue;
++ }
+ attr_range.lr_start = max(0, attr_range.lr_start - lr_chars.lr_start);
+ if (attr_range.lr_start > line_width_chars) {
+ continue;
+ }
+- if (attr_range.lr_end == -1) {
+- attr_range.lr_end = lr_chars.lr_start + line_width_chars;
+- }
+
+ attr_range.lr_end = min(line_width_chars, attr_range.lr_end - lr_chars.lr_start);
+
+--
+2.31.1
+
diff --git a/app-admin/lnav/lnav-0.9.0-r1.ebuild b/app-admin/lnav/lnav-0.9.0-r1.ebuild
new file mode 100644
index 000000000000..dbadbc3f2934
--- /dev/null
+++ b/app-admin/lnav/lnav-0.9.0-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+DESCRIPTION="A curses-based tool for viewing and analyzing log files"
+HOMEPAGE="https://lnav.org"
+SRC_URI="https://github.com/tstack/lnav/releases/download/v${PV}/${P}.tar.gz"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="unicode"
+
+RDEPEND="
+ app-arch/bzip2:0=
+ >=dev-db/sqlite-3.9.0
+ dev-libs/libpcre[cxx]
+ >=net-misc/curl-7.23.0
+ sys-libs/ncurses:0=[unicode?]
+ sys-libs/readline:0=
+ sys-libs/zlib:0="
+DEPEND="${RDEPEND}"
+
+DOCS=( AUTHORS NEWS README )
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.8.4-disable-tests.patch
+ # bug 723242
+ "${FILESDIR}"/${PN}-0.9.0-bug639332-tinfow.patch
+ # bug 713600
+ "${FILESDIR}"/${PN}-0.9.0-bug713600_0.patch
+ "${FILESDIR}"/${PN}-0.9.0-bug713600_1.patch
+ # Fix a segfault when using right arrow
+ # bug 792582
+ "${FILESDIR}"/${PN}-0.9.0-bug792582.patch
+)
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --disable-static \
+ $(use_with unicode ncursesw)
+}