Last entry in a file misread if not followed by whitespace

30 views
Skip to first unread message

ed

unread,
Oct 21, 2012, 3:37:09 PM10/21/12
to ledge...@googlegroups.com
The last lines of my data file look like this (the intent is to maintain a carried forward contingency in a virtual account)

21/11 CF
    (CF)        £56

If I have no line feed at the end so that the file data is

21/11 CF
    (CF)        £56<EOF>

then the transaction is read as £5. If I have a space or a linefeed after the '6' it is read as £56

John Wiegley

unread,
Oct 21, 2012, 4:16:24 PM10/21/12
to ledge...@googlegroups.com
Definite major bug. Can you add as a priority 1 to Bugzilla?

Thanks,
John

Craig Earls

unread,
Oct 21, 2012, 11:23:45 PM10/21/12
to ledge...@googlegroups.com
I was testing this to enter it into Bugzilla, but I cannot duplicate it.

--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

ed

unread,
Oct 22, 2012, 6:24:39 AM10/22/12
to ledge...@googlegroups.com
Erm, data entered as shown in my post, using OS X and Sublime Text 2. Still does it now that the file is differently sized. od shows that there is no trailing whitespace after the number in the error case, ledger version Ledger 3.0.0-20120518

ed

unread,
Oct 22, 2012, 6:36:19 AM10/22/12
to ledge...@googlegroups.com
For completeness, here is my .ledgerrc in full
<begin>
;
--strict
--date-format=%d/%m/%Y
; Use Y 2011 to set the current year
;--input-date-format=%d/%m/%Y
--input-date-format=%d/%m
<end>
and here is a minimal data file
<begin>
N £
year 2011

account Virtual:CF
    alias CF

22/10 CF
    (CF)    £56<end>


With (EOF) directly after 56 as shown I get an error, with whitespace after 56 I don't.

Jesse Rosenthal

unread,
Oct 22, 2012, 8:26:00 AM10/22/12
to Craig Earls, ledge...@googlegroups.com
On Sun, 21 Oct 2012 20:23:45 -0700, Craig Earls <ende...@gmail.com> wrote:
> I was testing this to enter it into Bugzilla, but I cannot duplicate it.

Problem is present here as well. Some editors always add a new line, but
it's easy (on my version at least) to produce a minimal example from the
shell:

$ ledger --version
Ledger 3.0.0-20120518, the command-line accounting tool

Copyright (c) 2003-2012, John Wiegley. All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.

$ echo "2012/10/10 FOO\n (Foo:Bar) \$56" | ledger -f - bal
$56 Foo:Bar

$ echo -n "2012/10/10 FOO\n (Foo:Bar) \$56" | ledger -f - bal
$5 Foo:Bar

Best,
Jesse

ed

unread,
Oct 23, 2012, 6:18:07 AM10/23/12
to ledge...@googlegroups.com, Craig Earls
Excellent minimal test case, I forgot about using ledger in a pipe, well played.
Reply all
Reply to author
Forward
0 new messages