[GNC] Reverse all transactions

Anton Gladky gladky.anton at gmail.com
Mon Feb 15 15:58:33 EST 2021


Dear all,

thanks for all your comments. It helped me to migrate the database
into a proper state.

>If you have a file holding the original transactions, then you should be
> able to import them twice.  Once to reverse the transactions original
> entry.  The second time to get them entered correctly.

*@Stephen, *I was playing with the export-import function (to a CSV) but
did not
succeed. Gnucash crashed during import of transaction-CSV file with
SIGABRT and error "Too many root sets. Aborted".

There is a backtrace. Not sure whether it is useful:

=========
#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff686f537 in __GI_abort () at abort.c:79
#2  0x00007ffff6144158 in  () at /usr/lib/x86_64-linux-gnu/libgc.so.1
#3  0x00007ffff6144191 in GC_add_roots () at
/usr/lib/x86_64-linux-gnu/libgc.so.1
#4  0x00007ffff7db73f3 in  () at /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1
#5  0x00007ffff7d8b639 in  () at /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1
#6  0x00007ffff7e05bfd in scm_c_catch () at
/usr/lib/x86_64-linux-gnu/libguile-3.0.so.1
#7  0x00007ffff7db6065 in  () at /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1
#8  0x00007ffff7db6234 in scm_primitive_load_path () at
/usr/lib/x86_64-linux-gnu/libguile-3.0.so.1
#9  0x00007ffff6fc99ac in gnc_exp_parser_real_init
(addPredefined=addPredefined at entry=0) at
./libgnucash/app-utils/gnc-exp-parser.c:85
#10 0x00007ffff6fc9d7e in gnc_exp_parser_parse_separate_vars    Python
Exception <class 'gdb.error'> There is no member named keys.:
 (expression=expression at entry=0x7fffffffbcd0 "1.0000",
value_p=value_p at entry=0x7fffffffbbb0,
error_loc_p=error_loc_p at entry=0x7fffffffbb98,
varHash=varHash at entry=0x55555676b360)
    at ./libgnucash/app-utils/gnc-exp-parser.c:516
=========

gnucash version is 4.4 and it looks like the  crash comes from the parser
[1].

scm_primitive_load_path(scm_from_utf8_string("gnucash/app-utils/fin"));

I did not investigate it further. I can file a bug report if it does
not exist yet.

[1]
https://sources.debian.org/src/gnucash/1:4.4-1/libgnucash/app-utils/gnc-exp-parser.c/#L85

> one option you have is to go through each transaction in the
> register, by hand, and reverse each split of each transaction by putting
> a "-" character in front of the amount.

*@Jim*, thanks for a very useful tip! It really helped to fix the
database relatively quickly! I employed this trick in a
semi-automatic way. What was necessary is the following combination
of keypresses:



*-key Downkey Left*

It needed to be repeated many times, for each transaction.

I have written a small bash script (I am using Linux), which generated
this combination of keypresses. With its help I could fire about 5000
combinations just in one second.

=============
#!/bin/bash
sleep 1
for i in $(seq "$1")
do
  xte 'str -' && xte 'key Down' && xte 'key Left'
done
=============

So the database is fixed. Thanks all for the help!

Best regards

Anton


More information about the gnucash-user mailing list