Package: ledger
Version: 3.3.0-3
Tags: upstream
Hi,
according to the manual page, ledger print can be used to reformat a
ledger file. As such I expect it to produce valid ledger syntax. The
following trips it up:
$ printf "bucket X\n2222/11/11 c\n Y 1\n"
bucket X
2222/11/11 c
Y 1
$ printf "bucket X\n2222/11/11 c\n Y 1\n" | ledger -f - print
2222/11/11 c
Y 1
$ printf "bucket X\n2222/11/11 c\n Y 1\n" | ledger -f - print | ledger -f -
print; echo $?
While parsing file "", line 2:
While balancing transaction from streamed input:
Unbalanced remainder is:
1
Amount to balance against:
1
Error: Transaction does not balance
1
$
As you can see in the second command, the bucket stanza is dropped, but
the transaction is not balanced using the X bucket. Thus the third
invocation fails. I think ledger print should either retain the bucket
stanza or balance the transaction using the default bucket.
Please consider adding an autopkgtest or unittest for this issue.
Helmut