git: 34796ebc1db2 - main - sysutils/lnav: attempt to unbreak the build on 32-bit architectures

Alexey Dokuchaev danfe at FreeBSD.org
Sat Jun 19 14:47:19 UTC 2021


The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=34796ebc1db2aecdc58dde0774b7280fe2959543

commit 34796ebc1db2aecdc58dde0774b7280fe2959543
Author:     Alexey Dokuchaev <danfe at FreeBSD.org>
AuthorDate: 2021-06-19 14:44:18 +0000
Commit:     Alexey Dokuchaev <danfe at FreeBSD.org>
CommitDate: 2021-06-19 14:44:52 +0000

    sysutils/lnav: attempt to unbreak the build on 32-bit architectures
    
    Obtained from:  upstream (dfd18a4be5fd5e5378f44bef81bcc6cca4ac4a76)
---
 sysutils/lnav/Makefile                   |  3 ---
 sysutils/lnav/files/patch-src_logfile.cc | 37 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/sysutils/lnav/Makefile b/sysutils/lnav/Makefile
index 49e2f3b8d985..e06fb260aa31 100644
--- a/sysutils/lnav/Makefile
+++ b/sysutils/lnav/Makefile
@@ -10,9 +10,6 @@ COMMENT=	Terminal based log file navigator
 
 LICENSE=	BSD2CLAUSE
 
-BROKEN_i386=	fails to build: error: non-constant-expression cannot be narrowed
-BROKEN_powerpc=	fails to build: error: non-constant-expression cannot be narrowed
-
 LIB_DEPENDS=	libpcrecpp.so:devel/pcre
 
 USES=		autoreconf compiler:c++14-lang gmake ncurses readline sqlite tar:bz2
diff --git a/sysutils/lnav/files/patch-src_logfile.cc b/sysutils/lnav/files/patch-src_logfile.cc
new file mode 100644
index 000000000000..fbad7c3c686e
--- /dev/null
+++ b/sysutils/lnav/files/patch-src_logfile.cc
@@ -0,0 +1,37 @@
+--- src/logfile.cc.orig	2020-09-09 16:17:12 UTC
++++ src/logfile.cc
+@@ -323,10 +323,13 @@ logfile::rebuild_result_t logfile::rebuild_index()
+ 
+             this->lf_line_buffer.clear();
+             if (!this->lf_index.empty()) {
+-                off_t check_line_off = this->lf_index.back().get_offset();
++                auto last_line = this->lf_index.end();
++                --last_line;
++                off_t check_line_off = last_line->get_offset();
++                auto last_length = ssize_t(this->line_length(last_line, false));
+ 
+                 auto read_result = this->lf_line_buffer.read_range({
+-                    check_line_off, this->lf_index_size - check_line_off
++                    check_line_off, last_length
+                 });
+ 
+                 if (read_result.isErr()) {
+@@ -553,7 +556,7 @@ filesystem::path logfile::get_path() const
+ 
+ size_t logfile::line_length(logfile::iterator ll, bool include_continues)
+ {
+-    iterator next_line = ll;
++    auto next_line = ll;
+     size_t retval;
+ 
+     if (!include_continues && this->lf_next_line_cache) {
+@@ -570,6 +573,9 @@ size_t logfile::line_length(logfile::iterator ll, bool
+ 
+     if (next_line == this->end()) {
+         retval = this->lf_index_size - ll->get_offset();
++        if (retval > line_buffer::MAX_LINE_BUFFER_SIZE) {
++            retval = line_buffer::MAX_LINE_BUFFER_SIZE;
++        }
+         if (retval > 0 && !this->lf_partial_line) {
+             retval -= 1;
+         }


More information about the dev-commits-ports-main mailing list