After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 492137 - Lot scrubber doesn't add splits to existing lots correctly
Lot scrubber doesn't add splits to existing lots correctly
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Engine
git-master
Other Mac OS
: Normal normal
: ---
Assigned To: Derek Atkins
Derek Atkins
Depends on:
Blocks: backport
 
 
Reported: 2007-10-31 19:16 UTC by Mike Alexander
Modified: 2018-06-29 21:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix the lot scrubber for signed Timespec (1.03 KB, patch)
2007-10-31 19:19 UTC, Mike Alexander
committed Details | Review

Description Mike Alexander 2007-10-31 19:16:41 UTC
My change in R16370 which made Timespec signed instead of unsigned broke the lot scrubber.  It does not correctly add splits to existing lots.  You can see this by opening a stock account which has a buy transaction in a lot and a corresponding sell transaction that is not in a lot.  If you then open the lot viewer and tell to scrub the account, it will create a new lot with a negative balance rather than adding the split for the sell transaction to the existing lot.

I fixed this and will attach a patch.
Comment 1 Mike Alexander 2007-10-31 19:19:34 UTC
Created attachment 98264 [details] [review]
Patch to fix the lot scrubber for signed Timespec
Comment 2 Christian Stimming 2007-11-01 14:40:53 UTC
Comment on attachment 98264 [details] [review]
Patch to fix the lot scrubber for signed Timespec

Sounds just fine. Should be committed. Thanks a lot.
Comment 3 Andreas Köhler 2007-12-08 14:18:09 UTC
Applied as r16619.
Awaiting backport to branches/2.2.
Comment 4 Andreas Köhler 2007-12-14 20:59:59 UTC
branches/2.2@r16639.

Thanks a lot!
Comment 5 Derek Atkins 2007-12-24 04:26:04 UTC
Unfortunately this patch breaks "make check" for me.  When I run with this changeset in place the test crashes with the error:

* 23:06:40 OTHER <gnc.lots> [xaccSplitAssignToLot()] Failed to split into two!

Program received signal SIGABRT, Aborted.

Thread 1074914560 (LWP 31572)

  • #0 __kernel_vsyscall
  • #1 raise
    from /lib/libc.so.6
  • #2 abort
    from /lib/libc.so.6
  • #3 g_logv
    from /lib/libglib-2.0.so.0
  • #4 g_log
    from /lib/libglib-2.0.so.0
  • #5 xaccSplitAssignToLot
    at cap-gains.c line 515
  • #6 xaccSplitAssign
    at cap-gains.c line 638
  • #7 xaccAccountAssignLots
    at Scrub2.c line 81
  • #8 xaccAccountScrubLots
    at Scrub3.c line 167
  • #9 lot_scrub_cb
    at Scrub3.c line 186
  • #10 gnc_account_foreach_descendant
    at Account.c line 2615
  • #11 xaccAccountTreeScrubLots
    at Scrub3.c line 194
  • #12 run_test
    at test-lots.c line 59
  • #13 main
    at test-lots.c line 91


When I back out this patch the tests pass.  So, I've reopened this bug, and I've backed out this patch in trunk.  I also recommend backing it out of the 2.2 branch until the tests work again.

Note that it's possible that the tests are broken, so please make sure that test-lots doesn't crash when you fix this bug.  If that means fixing the test, too, that's fine.

Thanks.
Comment 6 Derek Atkins 2007-12-24 05:23:20 UTC
Okay, this is very weird.  "make check" works in 2.2, but fails in trunk.  If I back out r16619 from trunk then "make check" works again...  But 16619 was backported to 2.2 and "make check" still works there.  So I'm very confused about what's going on.

Mike, is there any chance you could look into why make check is failing on trunk with this patch installed?

Thanks!
Comment 7 Derek Atkins 2007-12-24 14:34:12 UTC
Strangely, it looks to be a combination of r16619 and r16690.
Comment 8 Derek Atkins 2007-12-24 21:19:08 UTC
Okay, it's just a bug in the tests; the tests were overflowing, and the additional currency just changed the commodity-scu sufficiently to cause the overflow.

I've re-applied this patch along with a patch to the test harness.  The checks now work again.  Mike, sorry to have blamed you; the checks DID pass with your changes and didn't break until r16690 was applied.  My apologies to you.

Anyways, this has been reapplied to trunk as r16716.

I've re-closed this bug.

Happy Holidays.
Comment 9 John Ralls 2018-06-29 21:53:35 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=492137. Please update any external references or bookmarks.