[augeas-devel] Fix segfault with bug_on
David Lutterkort
lutter at redhat.com
Thu Jan 12 23:21:04 UTC 2012
On Wed, 2012-01-11 at 22:24 -0500, Francis Giraldeau wrote:
> > On Thu, 2011-12-29 at 15:50 -0500, Francis Giraldeau wrote:
> > > While working on an updated square lens, the old bug_on error came back. This
> > > patch is some proposal to get it fixed. Adding this flag is not pretty, but it
> > > works.
> >
> > I don't recall the details of that problem - what exactly in bug_on is
> > causing segfaults ?
>
> Yeah, well, the problem is not bug_on. In lens_get, when lns_get returns
> with an error, the function make_exn_lns_error() is called, which
> returns either a normaly allocated value, or a static value with
> exn_error(). The error comes from this static value which is modified at
> various places and produces a segfault.
Aaah, yes, that is nasty.
> I think it was done to report error in case of ENOMEM error. The flag
> solution is not quite exciting. What about allocating this struct in
> advance, say on aug_init?
Yes, I like that solution much better; we'd allocate it early in
aug_init, reset it in api_entry, and do not need to worry about SIGSEGV
because of modifications.
David
More information about the augeas-devel
mailing list