long transaction causes assertion failure with register format #2174
Closed
Description
I was trying out this example John posted to the mailing list:
ledger -f foo.dat reg assets liabilities --daily -n -F '%(date) %12(total)\n'
But it causes an assertion failure for me:
Error: Assertion failed in "/build/ledger-SR1_DQ/ledger-3.1.3/src/unistring.h", line 72:ledger::unistring::unistring(const string&): len < 1024
I tracked it down to this transaction, which is a stock purchase followed by a bunch of automatic dividend reinvestments (numbers changed for privacy):
2023/01/01 Opening Balances
Assets:Investments:Brokerage 10 ABC @ $1
Assets:Investments:Brokerage 20 DEF @ $150.10
Assets:Investments:Brokerage 20 DEF @ $155.10
Assets:Investments:Brokerage 20 DEF @ $160.10
Assets:Investments:Brokerage 0.555 DEF @ $139.86
Assets:Investments:Brokerage 0.555 DEF @ $105.38
Assets:Investments:Brokerage 0.555 DEF @ $106.03
Assets:Investments:Brokerage 0.555 DEF @ $100.43
Assets:Investments:Brokerage 0.555 DEF @ $110.43
Assets:Investments:Brokerage 0.555 DEF @ $167.84
Assets:Investments:Brokerage 0.555 DEF @ $154.28
Assets:Investments:Brokerage 0.555 DEF @ $137.87
Assets:Investments:Brokerage 0.555 DEF @ $167.62
Assets:Investments:Brokerage 0.555 DEF @ $103.49
Assets:Investments:Brokerage 0.555 DEF @ $183.88
Assets:Investments:Brokerage 0.555 DEF @ $164.78
Assets:Investments:Brokerage 0.555 DEF @ $124.15
Assets:Investments:Brokerage 0.555 DEF @ $189.91
Assets:Investments:Brokerage 0.555 DEF @ $165.80
Assets:Investments:Brokerage 0.555 DEF @ $172.87
Assets:Investments:Brokerage 0.555 DEF @ $152.30
Assets:Investments:Brokerage 0.555 DEF @ $175.06
Assets:Investments:Brokerage 0.555 DEF @ $140.07
Assets:Investments:Brokerage 0.555 DEF @ $321.53
Assets:Investments:Brokerage 0.555 DEF @ $173.77
Assets:Investments:Brokerage 0.555 DEF @ $183.37
Assets:Investments:Brokerage 0.555 DEF @ $159.54
Assets:Investments:Brokerage 0.555 DEF @ $107.77
Assets:Investments:Brokerage 0.555 DEF @ $122.80
Assets:Investments:Brokerage 0.555 DEF @ $139.38
Assets:Investments:Brokerage 0.555 DEF @ $134.81
Assets:Investments:Brokerage 0.555 DEF @ $177.23
Equity:Opening Balances
Reproduce:
$ ledger --file finance.dat reg -F '%12(total)'
Error: Assertion failed in "/build/ledger-SR1_DQ/ledger-3.1.3/src/unistring.h", line 72:ledger::unistring::unistring(const string&): len < 1024