[augeas-devel] [Augeas] #245: union

Augeas trac at fedorahosted.org
Tue Dec 27 10:13:55 UTC 2011


#245: union
-----------------------+---------------------
 Reporter:  xamvz      |       Owner:  lutter
     Type:  defect     |      Status:  new
 Priority:  major      |   Milestone:  next
Component:  Augeas     |     Version:  devel
 Keywords:  union.put  |  Blocked By:
 Blocking:             |
-----------------------+---------------------
 I'm trying to make lens for proftpd.
 {{{
 let sep_spc = del /[ \t]+/ " "
 let sep_osp = del /[ \t]*/ ""
 let eol = sep_osp . Util.del_str "\n"
 let del_end = sep_osp . del />[\n]?/ ">\n"
 let word = /[a-zA-Z][a-zA-Z0-9._-]*/
 let value = /[^ =\t\n]+/
 let attributes = [ label "#attribute" . [sep_spc . key word ]+ ]

 let arg_dir = [ seq "key" . store (value) ]
 let argv (l:lens) = counter "key" . l . (sep_spc . l)*
 let key_value = [ sep_osp . key word .
                  (sep_spc . argv arg_dir)? . eol ]

 let stanza (body:lens) =
      let h = attributes? . del_end . body* . sep_osp .
        Util.del_str "</" in
          [ sep_osp . Util.del_str "<" . square word h . del_end ]

 let rec content = stanza (content|key_value)

 let lns = (content|empty|key_value)*
 }}}
 When I test it with augparse there is next error.
 {{{
 Syntax error in lens definition
 /home/maxim/projects/temp/ftp/proftpconflens.aug:30.4-.40:Failed to
 compile lns
 /home/maxim/projects/temp/ftp/proftpconflens.aug:30.14-.38:exception:
 overlapping lenses in tree union.put
     Example matched by both:  { "A" }
     First lens:
 /home/maxim/projects/temp/ftp/proftpconflens.aug:30.14-.28:
     Second lens:
 /home/maxim/projects/temp/ftp/proftpconflens.aug:20.20-21.55:
 }}}
 lens on line 20 is key_value and line 30 is lns.

 When I run this lens with augtool and tests like this
 {{{
 test lns get "ServerName                      FTP Server
 ServerIdent                     on
 Port                    21
 PassivePorts                    55535 65534
 MaxInstances                    500
 <Global>
         RequireValidShell               off
         <Limit LOGIN>
                 DenyGroup               root
         </Limit>
         DefaultRoot                     /mnt
 </Global>\n" = ?
 }}}
 test result is right tree. But in augtool work with tree unavailable.

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/245>
Augeas <http://augeas.net/>
a configuration API




More information about the augeas-devel mailing list