pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/sysutils/lnav



Module Name:    pkgsrc
Committed By:   he
Date:           Wed May 24 22:42:53 UTC 2023

Modified Files:
        pkgsrc/sysutils/lnav: Makefile distinfo
Added Files:
        pkgsrc/sysutils/lnav/patches: patch-src_base_strnatcmp.c
            patch-src_command__executor.cc patch-src_lnav__commands.cc
            patch-src_ptimec.hh patch-src_spectro__source.cc
            patch-src_third-party_ArenaAlloc_arenaallocimpl.h
            patch-src_vtab__module.hh

Log Message:
lnav: fix build on NetBSD/macppc and reduce amount of warnings.

 - The program uses alloca() but insists on use of -std=c++14.
   alloca(), however, especially on NetBSD/macppc, needs the
   -std=gnu++14 feature set, so force use of that standard.
 - isdigit() argument nees to be `unsigned char` or EOF. Add cast.
 - On NetBSD, `time_t` isn't a `long`, and there is apparently
   no portable way to supply a printf format for a `time_t`.
   Cast to `long long` and print with %lld.
 - A `role_t` is not the same as `int`, causing -Wformat warning.
   Cast to `int` before printing.
 - Avoid trying to right-shift with 32 on a 32-bit platform.
 - Print `unsigned int` with %u, and not with %ld.

Lots of signedness warnings remain, reported to upstream in
https://github.com/tstack/lnav/issues/1157.  I'll be requesting
pull requests for some of the others above.

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 pkgsrc/sysutils/lnav/Makefile
cvs rdiff -u -r1.7 -r1.8 pkgsrc/sysutils/lnav/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/sysutils/lnav/patches/patch-src_base_strnatcmp.c \
    pkgsrc/sysutils/lnav/patches/patch-src_command__executor.cc \
    pkgsrc/sysutils/lnav/patches/patch-src_lnav__commands.cc \
    pkgsrc/sysutils/lnav/patches/patch-src_ptimec.hh \
    pkgsrc/sysutils/lnav/patches/patch-src_spectro__source.cc \
    pkgsrc/sysutils/lnav/patches/patch-src_third-party_ArenaAlloc_arenaallocimpl.h \
    pkgsrc/sysutils/lnav/patches/patch-src_vtab__module.hh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/lnav/Makefile
diff -u pkgsrc/sysutils/lnav/Makefile:1.25 pkgsrc/sysutils/lnav/Makefile:1.26
--- pkgsrc/sysutils/lnav/Makefile:1.25  Wed Apr 19 08:11:31 2023
+++ pkgsrc/sysutils/lnav/Makefile       Wed May 24 22:42:53 2023
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.25 2023/04/19 08:11:31 adam Exp $
+# $NetBSD: Makefile,v 1.26 2023/05/24 22:42:53 he Exp $
 
 DISTNAME=      lnav-0.11.1
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    sysutils textproc
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=tstack/}
 GITHUB_RELEASE=        v${PKGVERSION_NOREV}
@@ -13,9 +13,13 @@ COMMENT=     Log file navigator, an enhanced
 LICENSE=       2-clause-bsd
 
 GNU_CONFIGURE= yes
-USE_LANGUAGES= c c++
+USE_LANGUAGES= c gnu++14
 USE_TOOLS+=    bash:build gmake
 
+# Force it -- configure thinks it can build with c++14
+# but the program uses alloca() so depends on the gnu feature set
+BUILDLINK_TRANSFORM+=  opt:-std=c++14:-std=gnu++14
+
 GCC_REQD+=     8
 
 .include "../../archivers/bzip2/buildlink3.mk"

Index: pkgsrc/sysutils/lnav/distinfo
diff -u pkgsrc/sysutils/lnav/distinfo:1.7 pkgsrc/sysutils/lnav/distinfo:1.8
--- pkgsrc/sysutils/lnav/distinfo:1.7   Tue Jan 17 10:18:33 2023
+++ pkgsrc/sysutils/lnav/distinfo       Wed May 24 22:42:53 2023
@@ -1,7 +1,14 @@
-$NetBSD: distinfo,v 1.7 2023/01/17 10:18:33 wiz Exp $
+$NetBSD: distinfo,v 1.8 2023/05/24 22:42:53 he Exp $
 
 BLAKE2s (lnav-0.11.1.tar.bz2) = c58a9823d4a50704cad901eb5be99c13c97a605a22db87eb0ebdea7ca283ae6a
 SHA512 (lnav-0.11.1.tar.bz2) = b0db44b02f8b98e9b383e258c1ab228f9c704b5e345583b2ce2d2f68b0519926779d798dc2e61a17af112a371a437c6766b2644fbb92b5f77938f9015ea31fe8
 Size (lnav-0.11.1.tar.bz2) = 2268080 bytes
+SHA1 (patch-src_base_strnatcmp.c) = 8a258fa07e9b6d495edfd239d7ab6ef0bcfbe1da
+SHA1 (patch-src_command__executor.cc) = baf8ad475826c8c93d1280ce2cd921ceab7b3a6f
+SHA1 (patch-src_lnav__commands.cc) = 597c3e23b4b2998b3c001ff5511288269c3bf4b3
+SHA1 (patch-src_ptimec.hh) = f9f10f0c5156907bb4d993d9e51ba20c4fcd83ff
+SHA1 (patch-src_spectro__source.cc) = 66ca4eb992a0c8aec433245bd6faab622c82f2d2
 SHA1 (patch-src_test__override.c) = ea392929f3874ff6ef0eea0002139acb14ad9166
+SHA1 (patch-src_third-party_ArenaAlloc_arenaallocimpl.h) = cdd8c1d6c5c1c39bf7f00770101163080019bf7a
 SHA1 (patch-src_third-party_rapidyaml_ryml__all.hpp) = 9d9a5dee02d7da42841d3fec7021c6de8f352e4a
+SHA1 (patch-src_vtab__module.hh) = c14c3439e63f0a4be0ba581712d052669a509a52

Added files:

Index: pkgsrc/sysutils/lnav/patches/patch-src_base_strnatcmp.c
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_base_strnatcmp.c:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_base_strnatcmp.c     Wed May 24 22:42:53 2023
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_base_strnatcmp.c,v 1.1 2023/05/24 22:42:53 he Exp $
+
+Ensure argument to isdigit is either "unsigned char" or EOF by casting,
+so as to avoid possibly undefined behaviour.
+
+--- ./src/base/strnatcmp.c.orig        2021-08-09 16:59:46.000000000 +0000
++++ ./src/base/strnatcmp.c
+@@ -275,13 +275,13 @@ int ipv4cmp(int a_len, nat_char const *a
+     }
+ 
+     for (; ai < a_len; ai++) {
+-        if (!isdigit(a[ai]) || a[ai] != '.') {
++        if (!isdigit((unsigned char)a[ai]) || a[ai] != '.') {
+             return 0;
+         }
+     }
+ 
+     for (; bi < b_len; bi++) {
+-        if (!isdigit(b[bi]) || b[bi] != '.') {
++        if (!isdigit((unsigned char)b[bi]) || b[bi] != '.') {
+             return 0;
+         }
+     }
Index: pkgsrc/sysutils/lnav/patches/patch-src_command__executor.cc
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_command__executor.cc:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_command__executor.cc Wed May 24 22:42:53 2023
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_command__executor.cc,v 1.1 2023/05/24 22:42:53 he Exp $
+
+Allow time_t to be long long, and adapt formats and casts accordingly.
+Also, cast a size_t before printing; unknown size so difficult to match
+format appropriately.
+
+--- src/command_executor.cc.orig       2022-09-23 13:13:41.000000000 +0000
++++ src/command_executor.cc
+@@ -478,10 +478,10 @@ execute_sql(exec_context& ec, const std:
+                 snprintf(row_count_buf,
+                          sizeof(row_count_buf),
+                          ANSI_BOLD("%'d") " row%s matched in " ANSI_BOLD(
+-                             "%ld.%03ld") " seconds",
++                             "%lld.%03ld") " seconds",
+                          row_count,
+                          row_count == 1 ? "" : "s",
+-                         diff_tv.tv_sec,
++                         (long long)diff_tv.tv_sec,
+                          std::max((long) diff_tv.tv_usec / 1000, 1L));
+                 retval = row_count_buf;
+                 if (dls.has_log_time_column()) {
+@@ -624,7 +624,7 @@ execute_file(exec_context& ec, const std
+ 
+     vars["#"] = env_arg_name;
+     for (size_t lpc = 0; lpc < split_args.size(); lpc++) {
+-        snprintf(env_arg_name, sizeof(env_arg_name), "%lu", lpc);
++        snprintf(env_arg_name, sizeof(env_arg_name), "%lu", (long unsigned int)lpc);
+         vars[env_arg_name] = split_args[lpc];
+     }
+     for (size_t lpc = 1; lpc < split_args.size(); lpc++) {
Index: pkgsrc/sysutils/lnav/patches/patch-src_lnav__commands.cc
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_lnav__commands.cc:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_lnav__commands.cc    Wed May 24 22:42:53 2023
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_lnav__commands.cc,v 1.1 2023/05/24 22:42:53 he Exp $
+
+`time_t` may not be a `long int`, but may be `long long`, so cast
+and adapt format accordingly.
+
+--- src/lnav_commands.cc.orig  2022-10-06 17:08:45.000000000 +0000
++++ src/lnav_commands.cc
+@@ -226,8 +226,8 @@ com_adjust_log_time(exec_context& ec,
+             snprintf(
+                 buffer,
+                 sizeof(buffer),
+-                "info: log timestamps will be adjusted by %ld.%06ld seconds",
+-                time_diff.tv_sec,
++                "info: log timestamps will be adjusted by %lld.%06ld seconds",
++                (long long)time_diff.tv_sec,
+                 (long) time_diff.tv_usec);
+ 
+             retval = buffer;
+@@ -295,7 +295,7 @@ com_unix_time(exec_context& ec,
+                      "%a %b %d %H:%M:%S %Y  %z %Z",
+                      localtime(&u_time));
+             len = strlen(ftime);
+-            snprintf(ftime + len, sizeof(ftime) - len, " -- %ld", u_time);
++            snprintf(ftime + len, sizeof(ftime) - len, " -- %lld", (long long)u_time);
+             retval = std::string(ftime);
+         } else {
+             return ec.make_error("invalid unix time -- {}", args[1]);
Index: pkgsrc/sysutils/lnav/patches/patch-src_ptimec.hh
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_ptimec.hh:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_ptimec.hh    Wed May 24 22:42:53 2023
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_ptimec.hh,v 1.1 2023/05/24 22:42:53 he Exp $
+
+Don't print time_t as if it's a long; it doesn't have to be
+and may be a long long (as on NetBSD).
+
+--- src/ptimec.hh.orig 2022-08-30 20:33:38.000000000 +0000
++++ src/ptimec.hh
+@@ -333,7 +333,7 @@ ftime_s(char* dst, off_t& off_inout, ssi
+ {
+     time_t t = tm2sec(&tm.et_tm);
+ 
+-    snprintf(&dst[off_inout], len - off_inout, "%ld", t);
++    snprintf(&dst[off_inout], len - off_inout, "%lld", (long long)t);
+     off_inout = strlen(dst);
+ }
+ 
+@@ -391,7 +391,7 @@ ftime_q(char* dst, off_t& off_inout, ssi
+ {
+     time_t t = tm2sec(&tm.et_tm);
+ 
+-    snprintf(&dst[off_inout], len - off_inout, "%lx", t);
++    snprintf(&dst[off_inout], len - off_inout, "%llx", (long long)t);
+     off_inout = strlen(dst);
+ }
+ 
Index: pkgsrc/sysutils/lnav/patches/patch-src_spectro__source.cc
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_spectro__source.cc:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_spectro__source.cc   Wed May 24 22:42:53 2023
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_spectro__source.cc,v 1.1 2023/05/24 22:42:53 he Exp $
+
+`role_t` isn't exactly the same as `int`, causing -Wformat
+warnings.  Cast to `int` before printing with %d.
+
+--- ./src/spectro_source.cc.orig       2022-08-11 14:19:16.000000000 +0000
++++ ./src/spectro_source.cc
+@@ -294,12 +294,12 @@ spectrogram_source::list_value_for_overl
+              sizeof(buf),
+              ANSI_ROLE("  ") " 1-%'d " ANSI_ROLE("  ") " %'d-%'d " ANSI_ROLE(
+                  "  ") " %'d+",
+-             role_t::VCR_LOW_THRESHOLD,
++             (int)role_t::VCR_LOW_THRESHOLD,
+              st.st_green_threshold - 1,
+-             role_t::VCR_MED_THRESHOLD,
++             (int)role_t::VCR_MED_THRESHOLD,
+              st.st_green_threshold,
+              st.st_yellow_threshold - 1,
+-             role_t::VCR_HIGH_THRESHOLD,
++             (int)role_t::VCR_HIGH_THRESHOLD,
+              st.st_yellow_threshold);
+     auto buflen = strlen(buf);
+     if (line.length() + buflen + 20 < width) {
Index: pkgsrc/sysutils/lnav/patches/patch-src_third-party_ArenaAlloc_arenaallocimpl.h
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_third-party_ArenaAlloc_arenaallocimpl.h:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_third-party_ArenaAlloc_arenaallocimpl.h      Wed May 24 22:42:53 2023
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_third-party_ArenaAlloc_arenaallocimpl.h,v 1.1 2023/05/24 22:42:53 he Exp $
+
+Don't try to right-shift by 32 bits on a 32-bit host.
+
+--- ./src/third-party/ArenaAlloc/arenaallocimpl.h.orig 2022-07-29 17:43:50.000000000 +0000
++++ ./src/third-party/ArenaAlloc/arenaallocimpl.h
+@@ -13,6 +13,8 @@
+ #include <stdio.h>
+ #endif
+ 
++#include <stdint.h>
++
+ namespace ArenaAlloc
+ {
+ 
+@@ -108,7 +110,9 @@ namespace ArenaAlloc
+       value |= value >> 4;
+       value |= value >> 8;
+       value |= value >> 16;
++#if SIZE_MAX > UINT32_MAX
+       value |= value >> 32;
++#endif
+ 
+       return value + 1;            
+     }
Index: pkgsrc/sysutils/lnav/patches/patch-src_vtab__module.hh
diff -u /dev/null pkgsrc/sysutils/lnav/patches/patch-src_vtab__module.hh:1.1
--- /dev/null   Wed May 24 22:42:53 2023
+++ pkgsrc/sysutils/lnav/patches/patch-src_vtab__module.hh      Wed May 24 22:42:53 2023
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_vtab__module.hh,v 1.1 2023/05/24 22:42:53 he Exp $
+
+Fix mismatch between format and data type.
+
+--- src/vtab_module.hh.orig    2022-09-20 04:05:51.000000000 +0000
++++ src/vtab_module.hh
+@@ -456,14 +456,14 @@ struct sqlite_func_adapter<Return (*)(Ar
+             if (OPT_COUNT == 0) {
+                 snprintf(buffer,
+                          sizeof(buffer),
+-                         "%s() expects exactly %ld argument%s",
++                         "%s() expects exactly %u argument%s",
+                          fd->fd_help.ht_name,
+                          REQ_COUNT,
+                          REQ_COUNT == 1 ? "s" : "");
+             } else {
+                 snprintf(buffer,
+                          sizeof(buffer),
+-                         "%s() expects between %ld and %ld arguments",
++                         "%s() expects between %u and %u arguments",
+                          fd->fd_help.ht_name,
+                          REQ_COUNT,
+                          REQ_COUNT + OPT_COUNT);



Home | Main Index | Thread Index | Old Index