#180: Segmentation fault with recursive lens
-------------------------+--------------------------------------------------
  Reporter:  fgiraldeau  |       Owner:  lutter  
      Type:  defect      |      Status:  assigned
  Priority:  major       |   Milestone:  next    
 Component:  Augeas      |     Version:  0.7.4   
Resolution:              |    Keywords:          
-------------------------+--------------------------------------------------
Changes (by lutter):

  * status:  new => assigned

Comment:

 Looking into this, the segfault happens in visit_exit(get.c:953)

 The trace of visiting the parse tree looks like this:
 {{{
 { 0..2 0 rec[/tmp/bug.aug:3.16-.39:]R
  { 0..2 0 maybe[/tmp/bug.aug:3.16-.39:]R
   { 0..2 0 subtree[/tmp/bug.aug:3.16-.38:]R
    { 0..2 1 concat[/tmp/bug.aug:3.18-.36:]R
     { 1..2 1 rec[/tmp/bug.aug:3.16-.39:]R
      { 1..2 1 maybe[/tmp/bug.aug:3.16-.39:]R
       { 1..2 1 subtree[/tmp/bug.aug:3.16-.38:]R
        { 1..2 2 concat[/tmp/bug.aug:3.18-.36:]R
         { 2..2 2 rec[/tmp/bug.aug:3.16-.39:]R
          { 2..2 2 maybe[/tmp/bug.aug:3.16-.39:]R
          } 2..2 2 maybe[/tmp/bug.aug:3.16-.39:]R
         } 2..2 2 rec[/tmp/bug.aug:3.16-.39:]R
         T 1..2 2 key[/tmp/bug.aug:3.18-.28:]r
        } 1..2 3 concat[/tmp/bug.aug:3.18-.36:]R
       } 1..2 2 subtree[/tmp/bug.aug:3.16-.38:]R
      } 1..2 1 maybe[/tmp/bug.aug:3.16-.39:]R
     } 1..2 1 rec[/tmp/bug.aug:3.16-.39:]R
     T 0..1 1 key[/tmp/bug.aug:3.18-.28:]r
    } 0..2 2 concat[/tmp/bug.aug:3.18-.36:]R
   } 0..2 1 subtree[/tmp/bug.aug:3.16-.38:]R
 Segmentation Fault
 }}}

 What's happening here is that visit_exit uses a really nasty heuristic to
 determine if an L_MAYBE matched, and then combines the top two stack
 frames into one. This was introduced in commit 410f7bd0 to fix bug #119

 I believe this handling of L_MAYBE causes an L_SUBTREE stackframe to
 disappear during vist_exit of the bottom most L_MAYBE (the one that
 doesn't really match anything)

 Not sure how best to fix this - this whole L_MAYBE business looks highly
 suspicious to me right now. I _think_ one way to fix this would be to (a)
 make the mechanism of detecting whether the stack top corresponds to the
 L_MAYBE's child matching robust, i.e. with an explicit marker and (b)
 revisiting how the stack is manipulated: if the L_MAYBE does match, leave
 the stack alone; if it doesn't match, push an empty stackframe to make
 sure the stack has the right number of frames.

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/180#comment:1>
Augeas <http://augeas.net/>
a configuration API

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to