Assertion failure in unistring

14 views
Skip to first unread message

Tavis Ormandy

unread,
Jan 25, 2023, 2:00:05 AM1/25/23
to ledge...@googlegroups.com
Hello! I've been hitting an assertion when experimenting with register formats:

$ 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

It is probably because I was trying to record the purchase of some stock,
followed by some automatic dividend reinvestments, like this (numbers made up):

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

Maybe this is not the intended solution, should I just average the cost basis and record it as one big lot?

Thanks, Tavis.

--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Martin Michlmayr

unread,
Jan 25, 2023, 2:16:16 AM1/25/23
to ledge...@googlegroups.com
* Tavis Ormandy <tav...@gmail.com> [2023-01-25 06:56]:
> Hello! I've been hitting an assertion when experimenting with register formats:

Can you please report this at https://github.com/ledger/ledger/issues

> Maybe this is not the intended solution, should I just average the cost basis and record it as one big lot?

The transaction looks ok to me, but ledger has had some problems with long
transactions; I guess you hit one such problem.

--
Martin Michlmayr
https://www.cyrius.com/

John Wiegley

unread,
Jan 25, 2023, 5:10:38 PM1/25/23
to Tavis Ormandy, ledge...@googlegroups.com
>>>>> "TO" == Tavis Ormandy <tav...@gmail.com> writes:

TO> Hello! I've been hitting an assertion when experimenting with register
TO> formats: $ ledger --file finance.dat reg -F '%12(total)' Error: Assertion
TO> failed in "/build/ledger-SR1_DQ/ledger-3.1.3/src/unistring.h", line
TO> 72:ledger::unistring::unistring(const string&): len < 1024

Hi Tavis, the example data in your message doesn't abort on my machine. Do you
have a reproducible example I could use for debugging?

John

Martin Michlmayr

unread,
Jan 25, 2023, 8:33:49 PM1/25/23
to Tavis Ormandy, ledge...@googlegroups.com
* John Wiegley <jwie...@gmail.com> [2023-01-25 14:10]:
> TO> Hello! I've been hitting an assertion when experimenting with register
> TO> formats: $ ledger --file finance.dat reg -F '%12(total)' Error: Assertion
> TO> failed in "/build/ledger-SR1_DQ/ledger-3.1.3/src/unistring.h", line
> TO> 72:ledger::unistring::unistring(const string&): len < 1024
>
> Hi Tavis, the example data in your message doesn't abort on my machine. Do you
> have a reproducible example I could use for debugging?

Did you run the command he mentioned:
ledger --file finance.dat reg -F '%12(total)'

It fails for me with ledger from Git:

Error: Assertion failed in "ledger/src/unistring.h", line 72:ledger::unistring::unistring(const string&): len < 1024

Tavis Ormandy

unread,
Jan 26, 2023, 11:15:05 AM1/26/23
to ledge...@googlegroups.com
On 2023-01-25, Martin Michlmayr wrote:
> * Tavis Ormandy [2023-01-25 06:56]:
>> Hello! I've been hitting an assertion when experimenting with register formats:
>
> Can you please report this at https://github.com/ledger/ledger/issues
>

Done, thanks Martin!

https://github.com/ledger/ledger/issues/2174
Reply all
Reply to author
Forward
0 new messages