Bug 186518 - finance/ledger: segmentation fault
Summary: finance/ledger: segmentation fault
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Guido Falsi
Depends on:
Reported: 2014-02-06 20:10 UTC by Sebastian Chmielewski
Modified: 2015-02-12 21:51 UTC (History)
6 users (show)

See Also:

Update Ledger to version 3.1 (5.05 KB, patch)
2014-12-23 16:32 UTC, Jan Kokemüller
no flags Details | Diff
Revised diff (5.08 KB, patch)
2015-01-28 08:51 UTC, Guido Falsi
madpilot: maintainer-approval? (woodycarey)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Chmielewski 2014-02-06 20:10:00 UTC
Ledger crashes with segmentation fault message.

Dump from console:

Proceed with upgrading packages [y/N]: y
ledger-2.6.3_1.txz                                                                                        100%  600KB 599.5KB/s 599.5KB/s   00:01    
Checking integrity... done
[1/1] Reinstalling ledger-2.6.3_1... done
This port has installed sample data files, python samples and script samples
for ledger in ${PREFIX}/share/examples/ledger/
Have fun!
$ ledger
[1]    9368 segmentation fault  ledger

How-To-Repeat: Run the command, no arguments are needed.
Comment 1 Edwin Groothuis freebsd_committer 2014-02-06 22:27:45 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer 2014-02-06 22:27:45 UTC
Maintainer of finance/ledger,

Please note that PR ports/186518 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:

Edwin Groothuis via the GNATS Auto Assign Tool
Comment 3 Woody Carey 2014-02-07 00:39:15 UTC
hi Edwin,

Would it be possible for me to get a login on a 10.Current box so I can look at the stack trace from the core file or something?
i don't actually have a 10Current box up and running right now.


Woody Carey
Comment 4 Sebastian Chmielewski 2014-02-14 19:50:16 UTC
stack from binary package is not very interesting

result of make WITH_DEBUG=yes and gdb on my system:

gdb /usr/local/bin/ledger                   
GNU gdb 6.1.1 [FreeBSD]                      
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
gdb$ r
[New LWP 101771]
[New Thread 802406400 (LWP 101771/ledger)]

Program received signal SIGILL, Illegal instruction.
[Switching to Thread 802406400 (LWP 101771/ledger)]
Error while running hook_stop:
Invalid type combination in ordering comparison.
0x000000000042c1fb in ledger::amount_t::parse (this=0x7fffffffb200, str=@0x7fffffffb1c8, flags=0x2) at amount.cc:1226
1226	  parse(stream, flags);
gdb$ bt
#0  0x000000000042c1fb in ledger::amount_t::parse (this=0x7fffffffb200, str=@0x7fffffffb1c8, flags=0x2) at amount.cc:1226
#1  0x000000000042d1a0 in ledger::parse_conversion (larger_str=@0x7fffffffb488, smaller_str=@0x7fffffffb470) at amount.cc:1234
#2  0x0000000000443b25 in _init_amounts (this=0x791e10) at amount.cc:91
#3  0x0000000000433495 in _init_amounts (this=0x791e10) at amount.cc:103
#4  0x0000000000421065 in __cxx_global_var_init3 () at amount.cc:126
#5  0x00000000004333f8 in global constructors keyed to a () at amount.cc:33
#6  0x00000000005516a2 in __do_global_ctors_aux ()
#7  0x0000000000404de6 in _init ()
#8  0x00007fffffffbb90 in ?? ()
#9  0x0000000800794691 in r_debug_state () from /libexec/ld-elf.so.1
#10 0x0000000800793d27 in __tls_get_addr () from /libexec/ld-elf.so.1
#11 0x0000000800792089 in .text () from /libexec/ld-elf.so.1
#12 0x0000000000000000 in ?? ()
Comment 5 y2s1982 2014-06-15 23:50:55 UTC
I would like to get this to work.  For someone inexperienced in programming or porting, what can I do to help fix the issue?
Comment 6 John Marino freebsd_committer 2014-08-07 15:19:33 UTC
Add maintainer back to PR (lost in conversion to buzilla) to give him a chance to answer the last question
Comment 7 Jason E. Hale freebsd_committer 2014-08-31 23:44:33 UTC
As a workaround, USE_GCC=yes could be added to the Makefile.  I have found that it does segfault when built with clang, but runs fine if build with gcc.
Comment 8 Jan Kokemüller 2014-12-23 16:32:48 UTC
Created attachment 150914 [details]
Update Ledger to version 3.1

I've found that updating to Ledger 3.1 solved the segmentation fault for me. I've attached a patch to the ports tree (untested on FreeBSD < 10).
Comment 9 Guido Falsi freebsd_committer 2015-01-28 08:51:59 UTC
Created attachment 152297 [details]
Revised diff


To make this update work on all supported FreeBSD versions I make some tweaks:

- You should not remove USE_LDCONFIG, it is still needed

- Looks like this new version needs a C++11 standard library, so I added the needed USES to achieve this.

- The libedit library needs the .0 number to be attached or it will pick up the one included in base (where present) and fail to compile due to a missing header.

Can you please test and review this new patch and also confirm the segfault really goes away?

I'd like to get maintainer approval for this before committing.

Thanks in advance!
Comment 10 Jan Kokemüller 2015-01-28 19:22:00 UTC
thank you for cleaning up the patch, it looks good! With this revision 'ledger' still works as expected without segmentation faults (on FreeBSD current).
Comment 11 Guido Falsi freebsd_committer 2015-02-12 21:51:20 UTC
Comment 12 commit-hook freebsd_committer 2015-02-12 21:51:32 UTC
A commit references this bug:

Author: madpilot
Date: Thu Feb 12 21:50:55 UTC 2015
New revision: 378899
URL: https://svnweb.freebsd.org/changeset/ports/378899

  - Update to 3.1
  - Get distribution from github

  PR:		186518
  Submitted by:	chmiels@o2.pl
  Approved by:	Maintainer timeout