diff --git a/sysutils/lnav/Makefile b/sysutils/lnav/Makefile index 49e2f3b8d985..e06fb260aa31 100644 --- a/sysutils/lnav/Makefile +++ b/sysutils/lnav/Makefile @@ -1,36 +1,33 @@ # Created by: Thomas Hurst PORTNAME= lnav PORTVERSION= 0.9.0 CATEGORIES= sysutils MASTER_SITES= https://github.com/tstack/${PORTNAME}/releases/download/v${PORTVERSION}/ MAINTAINER= tom@hur.st 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 GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-static PLIST_FILES= bin/lnav man/man1/lnav.1.gz OPTIONS_DEFINE= CURL OPTIONS_DEFAULT=CURL CURL_DESC= Use libcurl for remote log file support CURL_LIB_DEPENDS= libcurl.so:ftp/curl CURL_CONFIGURE_WITH= libcurl do-install: ${INSTALL_PROGRAM} ${WRKSRC}/src/lnav ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/lnav.1 ${STAGEDIR}${MAN1PREFIX}/man/man1 .include 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; + }