pkgsrc-Changes archive

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

CVS commit: pkgsrc/finance/ledger32



Module Name:    pkgsrc
Committed By:   riastradh
Date:           Tue Nov 26 23:07:02 UTC 2024

Modified Files:
        pkgsrc/finance/ledger32: distinfo
        pkgsrc/finance/ledger32/patches: patch-src_amount.cc
Added Files:
        pkgsrc/finance/ledger32/patches: patch-src_filters.cc
            patch-src_token.cc patch-src_utils.h

Log Message:
finance/ledger32: Fix build with boost>=1.86, and fix ctype abuse.

1. Boost patch backported from upstream master, since there's been no
   upstream release since the breakage.

2. Ctype abuse adapted afresh -- not sure how I missed this last time
   around!  Almsot all the tests pass now, and the same handful of test
   that fail fail in finance/ledger too (RegressTest_553,
   RegressTest_BF3C1F82-2, RegressTest_BF3C1F82).

No revbump because this has been broken since the revbump last month
for boost 1.86.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/finance/ledger32/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/finance/ledger32/patches/patch-src_amount.cc
cvs rdiff -u -r0 -r1.1 pkgsrc/finance/ledger32/patches/patch-src_filters.cc \
    pkgsrc/finance/ledger32/patches/patch-src_token.cc \
    pkgsrc/finance/ledger32/patches/patch-src_utils.h

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

Modified files:

Index: pkgsrc/finance/ledger32/distinfo
diff -u pkgsrc/finance/ledger32/distinfo:1.3 pkgsrc/finance/ledger32/distinfo:1.4
--- pkgsrc/finance/ledger32/distinfo:1.3        Thu May  2 12:22:13 2024
+++ pkgsrc/finance/ledger32/distinfo    Tue Nov 26 23:07:02 2024
@@ -1,11 +1,12 @@
-$NetBSD: distinfo,v 1.3 2024/05/02 12:22:13 riastradh Exp $
+$NetBSD: distinfo,v 1.4 2024/11/26 23:07:02 riastradh Exp $
 
 BLAKE2s (ledger-3.2.1.tar.gz) = c07ef3f13ef6fa24c3a0d4e1ef91e02c39673f143aa910810d64f00751ab76ff
 SHA512 (ledger-3.2.1.tar.gz) = 526c60cee354c9d2ead38cef3b89b349467e41fa3ec0927b51e7246a3352f19f0f81574211f20ba9bac5915590b870b9f9478a103ab661d3d9a10f41c52f4512
 Size (ledger-3.2.1.tar.gz) = 790959 bytes
 SHA1 (patch-src_CMakeLists.txt) = 8d6a16523554c98c8559702db681af6fb4f413aa
-SHA1 (patch-src_amount.cc) = ddabd294a25d05b7caf85e701817f5a78d28e04a
+SHA1 (patch-src_amount.cc) = 63baa56b38c5f773e66d4e9cde1fe99b3686339f
 SHA1 (patch-src_expr.cc) = e707cbcba58a31534072ed490c9ba95f8dc4005d
+SHA1 (patch-src_filters.cc) = be5a1f382006ae014cea0c028d774f68d4e58ca8
 SHA1 (patch-src_format.cc) = c7fe4821bc86a9126978235fa44859f84ea92989
 SHA1 (patch-src_item.cc) = 5e97a09824a04092161d8a0ca956a43ef084a03d
 SHA1 (patch-src_lookup.cc) = 0140f88386a6a9bbfa82e48fca4f3555f40a03aa
@@ -17,5 +18,7 @@ SHA1 (patch-src_strptime.cc) = 9e5f77e63
 SHA1 (patch-src_system.hh.in) = d96c4bf691868e790110c73473e4a9f81e48d617
 SHA1 (patch-src_textual.cc) = 3b52947bbdf41bbf4181e5c5519df2b105da60ad
 SHA1 (patch-src_times.cc) = 544235432f6811f1a5c73ee72b3011709b606f17
+SHA1 (patch-src_token.cc) = b158a92eed40b632cbcc376936757d5ed82691e5
 SHA1 (patch-src_utils.cc) = 764badb5363a6ab6a98672ff5fde897a477d2fbd
+SHA1 (patch-src_utils.h) = 3bc839a71cb21b1001bdde8c9b5311bfd65abd1c
 SHA1 (patch-src_xact.cc) = 89befd42102146e7a46f92ce458a7f1bc321ce55

Index: pkgsrc/finance/ledger32/patches/patch-src_amount.cc
diff -u pkgsrc/finance/ledger32/patches/patch-src_amount.cc:1.1 pkgsrc/finance/ledger32/patches/patch-src_amount.cc:1.2
--- pkgsrc/finance/ledger32/patches/patch-src_amount.cc:1.1     Thu May  2 12:22:13 2024
+++ pkgsrc/finance/ledger32/patches/patch-src_amount.cc Tue Nov 26 23:07:02 2024
@@ -1,12 +1,16 @@
-$NetBSD: patch-src_amount.cc,v 1.1 2024/05/02 12:22:13 riastradh Exp $
+$NetBSD: patch-src_amount.cc,v 1.2 2024/11/26 23:07:02 riastradh Exp $
 
 Fix ctype abuse.
 https://github.com/ledger/ledger/pull/2341
 
 --- src/amount.cc.orig 2020-05-18 05:30:10.000000000 +0000
 +++ src/amount.cc
-@@ -979,7 +979,8 @@ namespace {
-               std::isdigit(c) || c == '-' || c == '.' || c == ',');
+@@ -976,10 +976,11 @@ namespace {
+     char buf[256];
+     char c = peek_next_nonws(in);
+     READ_INTO(in, buf, 255, c,
+-              std::isdigit(c) || c == '-' || c == '.' || c == ',');
++              std::isdigit(static_cast<unsigned char>(c)) || c == '-' || c == '.' || c == ',');
  
      string::size_type len = std::strlen(buf);
 -    while (len > 0 && ! std::isdigit(buf[len - 1])) {
@@ -15,7 +19,12 @@ https://github.com/ledger/ledger/pull/23
        buf[--len] = '\0';
        in.unget();
      }
-@@ -1014,7 +1015,7 @@ bool amount_t::parse(std::istream& in, c
+@@ -1010,11 +1011,11 @@ bool amount_t::parse(std::istream& in, c
+   }
+ 
+   char n;
+-  if (std::isdigit(c)) {
++  if (std::isdigit(static_cast<unsigned char>(c))) {
      parse_quantity(in, quant);
  
      if (! in.eof() && ((n = static_cast<char>(in.peek())) != '\n')) {

Added files:

Index: pkgsrc/finance/ledger32/patches/patch-src_filters.cc
diff -u /dev/null pkgsrc/finance/ledger32/patches/patch-src_filters.cc:1.1
--- /dev/null   Tue Nov 26 23:07:02 2024
+++ pkgsrc/finance/ledger32/patches/patch-src_filters.cc        Tue Nov 26 23:07:02 2024
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_filters.cc,v 1.1 2024/11/26 23:07:02 riastradh Exp $
+
+Fix build with boost>=1.86, which broke API compatibility.
+https://github.com/ledger/ledger/issues/2378
+
+--- src/filters.cc.orig        2023-03-30 07:40:48.000000000 +0000
++++ src/filters.cc
+@@ -238,7 +238,7 @@ void anonymize_posts::render_commodity(a
+ void anonymize_posts::operator()(post_t& post)
+ {
+       boost::uuids::detail::sha1  sha;
+-  unsigned int message_digest[5];
++  unsigned char message_digest[20];
+   bool         copy_xact_details = false;
+ 
+   if (last_xact != post.xact) {
+@@ -1268,7 +1268,7 @@ void budget_posts::report_budget_items(c
+     foreach (pending_posts_list::iterator& i, posts_to_erase)
+       pending_posts.erase(i);
+   }
+-  
++
+   if (pending_posts.size() == 0)
+     return;
+ 
Index: pkgsrc/finance/ledger32/patches/patch-src_token.cc
diff -u /dev/null pkgsrc/finance/ledger32/patches/patch-src_token.cc:1.1
--- /dev/null   Tue Nov 26 23:07:02 2024
+++ pkgsrc/finance/ledger32/patches/patch-src_token.cc  Tue Nov 26 23:07:02 2024
@@ -0,0 +1,43 @@
+$NetBSD: patch-src_token.cc,v 1.1 2024/11/26 23:07:02 riastradh Exp $
+
+Fix ctype abuse.
+https://github.com/ledger/ledger/pull/2341
+
+--- src/token.cc.orig  2020-05-18 05:30:10.000000000 +0000
++++ src/token.cc
+@@ -45,7 +45,7 @@ int expr_t::token_t::parse_reserved_word
+     length = 0;
+ 
+     char buf[6];
+-    READ_INTO_(in, buf, 5, c, length, std::isalpha(c));
++    READ_INTO_(in, buf, 5, c, length, std::isalpha(static_cast<unsigned char>(c)));
+ 
+     switch (buf[0]) {
+     case 'a':
+@@ -132,7 +132,7 @@ void expr_t::token_t::parse_ident(std::i
+   length = 0;
+ 
+   char c, buf[256];
+-  READ_INTO_(in, buf, 255, c, length, std::isalnum(c) || c == '_');
++  READ_INTO_(in, buf, 255, c, length, std::isalnum(static_cast<unsigned char>(c)) || c == '_');
+ 
+   value.set_string(buf);
+ }
+@@ -384,7 +384,7 @@ void expr_t::token_t::next(std::istream&
+ 
+     // First, check to see if it's a reserved word, such as: and or not
+     int result = parse_reserved_word(in);
+-    if (std::isalpha(c) && result == 1)
++    if (std::isalpha(static_cast<unsigned char>(c)) && result == 1)
+       break;
+ 
+     // If not, rewind back to the beginning of the word to scan it
+@@ -422,7 +422,7 @@ void expr_t::token_t::next(std::istream&
+ 
+         c = static_cast<char>(in.peek());
+         if (c != -1) {
+-          if (! std::isalpha(c) && c != '_')
++          if (! std::isalpha(static_cast<unsigned char>(c)) && c != '_')
+             expected('\0', c);
+ 
+           parse_ident(in);
Index: pkgsrc/finance/ledger32/patches/patch-src_utils.h
diff -u /dev/null pkgsrc/finance/ledger32/patches/patch-src_utils.h:1.1
--- /dev/null   Tue Nov 26 23:07:02 2024
+++ pkgsrc/finance/ledger32/patches/patch-src_utils.h   Tue Nov 26 23:07:02 2024
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_utils.h,v 1.1 2024/11/26 23:07:02 riastradh Exp $
+
+Fix ctype abuse.
+https://github.com/ledger/ledger/pull/2341
+
+Fix build with boost>=1.86, which broke API compatibility.
+https://github.com/ledger/ledger/issues/2378
+
+--- src/utils.h.orig   2020-05-18 05:30:10.000000000 +0000
++++ src/utils.h
+@@ -542,7 +542,7 @@ inline char * next_element(char * buf, b
+ 
+ inline char peek_next_nonws(std::istream& in) {
+   char c = static_cast<char>(in.peek());
+-  while (in.good() && ! in.eof() && std::isspace(c)) {
++  while (in.good() && ! in.eof() && std::isspace(static_cast<unsigned char>(c))) {
+     in.get(c);
+     c = static_cast<char>(in.peek());
+   }
+@@ -607,14 +607,14 @@ inline char peek_next_nonws(std::istream
+     *_p = '\0';                                         \
+   }
+ 
+-inline string to_hex(unsigned int * message_digest, const int len = 1)
++inline string to_hex(unsigned char * message_digest, const int len = 4)
+ {
+   std::ostringstream buf;
+ 
+-  for(int i = 0; i < 5 ; i++) {
+-    buf.width(8);
++  for(int i = 0; i < 20 ; i++) {
++    buf.width(2);
+     buf.fill('0');
+-    buf << std::hex << message_digest[i];
++    buf << std::hex << (int)message_digest[i];
+     if (i + 1 >= len)
+       break;                    // only output the first LEN dwords
+   }
+@@ -627,9 +627,9 @@ inline string sha1sum(const string& str)
+ 
+   sha.process_bytes(str.c_str(), str.length());
+ 
+-  unsigned int message_digest[5];
++  unsigned char message_digest[20];
+   sha.get_digest(message_digest);
+-  return to_hex(message_digest, 5);
++  return to_hex(message_digest, 20);
+ }
+ 
+ extern const string version;



Home | Main Index | Thread Index | Old Index