Segfaults on FreeBSD

Marius Schamschula lists at
Thu Jun 24 01:30:26 UTC 2021

I’m a gdb noob, particularly as it relates to Tcl scripts. When I load

gdb /opt/local/libexec/macports/bin/tclsh8.5 ./tclsh8.5.core

And set my breakpoint

(gdb) break mktemp.c:99

And tell gdb to run, I get a tclsh prompt. If I launch /opt/local/bin/portindex

I get

[Detaching after fork from child process 85805]
Creating port index in /opt/local/var/macports/sources/
child killed: segmentation violation

Needless to say, that’s already past the breakpoint.

I also tried running

expect -D 1 /opt/local/bin/portindex

However, expect is compiled against a different version of tcl/tk and has no idea where the MacPorts package is

"can't find package macports"

Marius Schamschula
On Jun 23, 2021, 1:43 PM -0500, Rainer Müller <raimue at>, wrote:
> On 19/06/2021 17.58, wrote:
> > Every now and then I try to get MacPorts to build and run on FreeBSD.
> >
> > Getting it to build requires less than a handful of edits.
> >
> > However, when running portindex I get a Segfault with a Signal 11.
> >
> > Here’s what gdb says (after recompiling with debug symbols enabled)"
> > [...]
> So it is failing at this point inside the Tcl_NewStringObj():
> gdb already tells us that the pointer 0xa51b60 doesn't look good. But
> mktemp() is never supposed to return anything else than either the
> pointer given or NULL [1].
> Could you try to break in gdb here in line 99 (after the call to mktemp)
> and compare the variables sp and template? They must point to the same
> memory address.
> You could even check whether there is a proper C string terminated by
> '\0' in memory... but actually gdb already told us it is not, because it
> cannot access memory at this address. :-/
> Rainer
> [1]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-dev mailing list