[augeas-devel] Segfault in 0.7.0
David Lutterkort
lutter at redhat.com
Thu Jan 28 01:56:05 UTC 2010
On Thu, 2010-01-28 at 12:35 +1100, Matthew Palmer wrote:
> On Thu, Jan 28, 2010 at 12:00:38PM +1100, Matthew Palmer wrote:
> > I'm getting the following backtrace after a segfault in 0.7.0:
> >
> > #0 tree_replace (origin=<value optimized out>, path=<value optimized out>,
> > #sub=0x0) at augeas.c:783
> > #1 0x00007fc539b6a75d in transform_load (aug=0x20c7020, xfm=0x20cc3a0) at
> > #transform.c:435
> > #2 0x00007fc539b51c54 in aug_load (aug=0x20c7020) at augeas.c:458
> > #3 0x00007fc539b52123 in aug_init (root=0x4b52c40 "", loadpath=0x49aaa20
> > #"\002", flags=<value optimized out>) at augeas.c:421
> > #4 0x0000000000403351 in main (argc=1, argv=0x7fff41fb0c88) at
> > #augtool.c:1137
>
> In discussions with David on IRC, he identified the cause of the problem (a
> one-liner fix in tree_replace), and a patch will be in Git shortly. For
> clarity, the cause of the problem is a wonky aptpreferences lens that
> doesn't like a missing or empty /etc/apt/preferences file.
As I like to say: it's never the fault of the lens ;) The aptpreferences
lens is a little special in that it does not produce a tree at all when
the input file is empty; most other lenses produce at least a blank
node.
The bug was really in tree_replace. The patch simply consists of
deleting redundant code and I just pushed it:
> From fe810ca0ed253c003f8d9758aedb48a116469da0 Mon Sep 17 00:00:00 2001
From: David Lutterkort <lutter at redhat.com>
Date: Wed, 27 Jan 2010 17:50:20 -0800
Subject: [PATCH] * src/augeas.c (tree_replace): don't bother marking the
new parent as dirty
We call tree_rm on it earlier, which already marks it as dirty.
This line also triggered a SEGV when sub == NULL; this happened, for
example, when /etc/apt/preferences was an empty file.
Bug reported by Matt Palmer
---
src/augeas.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/augeas.c b/src/augeas.c
index 209f606..c910017 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -780,8 +780,6 @@ int tree_replace(struct tree *origin, const char
*path, struct tree *sub) {
list_for_each(s, sub) {
s->parent = parent;
}
- if (sub->dirty)
- tree_mark_dirty(parent);
free_pathx(p);
return 0;
error:
--
1.6.6
More information about the augeas-devel
mailing list