Matthew Booth 00c1a6
commit 7f92c1be2d9b433b08797b81d2971455b4ee2772
Matthew Booth 00c1a6
Author: David Lutterkort <lutter@redhat.com>
Matthew Booth 00c1a6
Date:   Sun Nov 13 19:38:10 2011 -0800
Matthew Booth 00c1a6
Matthew Booth 00c1a6
    Mdadm: use case-insensitive regexps
Matthew Booth 00c1a6
Matthew Booth 00c1a6
diff --git a/lenses/mdadm_conf.aug b/lenses/mdadm_conf.aug
Matthew Booth 00c1a6
index 0cd1ac4..1193c13 100644
Matthew Booth 00c1a6
--- a/lenses/mdadm_conf.aug
Matthew Booth 00c1a6
+++ b/lenses/mdadm_conf.aug
Matthew Booth 00c1a6
@@ -68,16 +68,14 @@ let simplevalue (r:regexp) (lc:string) (uc:string) =
Matthew Booth 00c1a6
  * DEVICES
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let dev_re = /[dD][eE][vV]([iI]([cC][eE]?)?)?/
Matthew Booth 00c1a6
+let dev_re = /dev(i(ce?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let dev_containers_re = /[cC][oO][nN][tT][aA][iI][nN][eE][rR][sS]/
Matthew Booth 00c1a6
-let dev_partitions_re = /[pP][aA][rR][tT][iI][tT][iI][oO][nN][sS]/
Matthew Booth 00c1a6
+let dev_containers_re = /containers/i
Matthew Booth 00c1a6
+let dev_partitions_re = /partitions/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let dev_containers = [ del dev_containers_re "containers" . label "containers" ]
Matthew Booth 00c1a6
 let dev_partitions = [ del dev_partitions_re "partitions" . label "partitions" ]
Matthew Booth 00c1a6
-let dev_device = [ label "name". store ( value
Matthew Booth 00c1a6
-                                         - dev_containers_re
Matthew Booth 00c1a6
-                                         - dev_partitions_re ) ]
Matthew Booth 00c1a6
+let dev_device = [ label "name". store ( value - dev_containers_re) ]
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 (* Strictly there must be at least 1 device, but we err on the side of parsing
Matthew Booth 00c1a6
 *)
Matthew Booth 00c1a6
@@ -92,22 +90,22 @@ let device = [ del dev_re "DEVICE" . label "device" . dev_devices . eol ]
Matthew Booth 00c1a6
  * ARRAY
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let array_re  = /[aA][rR][rR]([aA][yY]?)?/
Matthew Booth 00c1a6
-
Matthew Booth 00c1a6
-let arr_auto_re         = /[aA][uU][tT][oO]/
Matthew Booth 00c1a6
-let arr_bitmap_re       = /[bB][iI][tT][mM][aA][pP]/
Matthew Booth 00c1a6
-let arr_container_re    = /[cC][oO][nN][tT][aA][iI][nN][eE][rR]/
Matthew Booth 00c1a6
-let arr_devices_re      = /[dD][eE][vV][iI][cC][eE][sS]/
Matthew Booth 00c1a6
-let arr_disks_re        = /[dD][iI][sS][kK][sS]/ (* Undocumented *)
Matthew Booth 00c1a6
-let arr_level_re        = /[lL][eE][vV][eE][lL]/
Matthew Booth 00c1a6
-let arr_member_re       = /[mM][eE][mM][bB][eE][rR]/
Matthew Booth 00c1a6
-let arr_metadata_re     = /[mM][eE][tT][aA][dD][aA][tT][aA]/
Matthew Booth 00c1a6
-let arr_name_re         = /[nN][aA][mM][eE]/
Matthew Booth 00c1a6
-let arr_num_devices_re  = /[nN][uU][mM]-[dD][eE][vV][iI][cC][eE][sS]/
Matthew Booth 00c1a6
-let arr_spare_group_re  = /[sS][pP][aA][rR][eE]-[gG][rR][oO][uU][pP]/
Matthew Booth 00c1a6
-let arr_spares_re       = /[sS][pP][aA][rR][eE][sS]/
Matthew Booth 00c1a6
-let arr_super_minor_re  = /[sS][uU][pP][eE][rR]-[mM][iI][nN][oO][rR]/
Matthew Booth 00c1a6
-let arr_uuid_re         = /[uU][uU][iI][dD]/
Matthew Booth 00c1a6
+let array_re  = /arr(ay?)?/i
Matthew Booth 00c1a6
+
Matthew Booth 00c1a6
+let arr_auto_re         = /auto/i
Matthew Booth 00c1a6
+let arr_bitmap_re       = /bitmap/i
Matthew Booth 00c1a6
+let arr_container_re    = /container/i
Matthew Booth 00c1a6
+let arr_devices_re      = /devices/i
Matthew Booth 00c1a6
+let arr_disks_re        = /disks/i (* Undocumented *)
Matthew Booth 00c1a6
+let arr_level_re        = /level/i
Matthew Booth 00c1a6
+let arr_member_re       = /member/i
Matthew Booth 00c1a6
+let arr_metadata_re     = /metadata/i
Matthew Booth 00c1a6
+let arr_name_re         = /name/i
Matthew Booth 00c1a6
+let arr_num_devices_re  = /num-devices/i
Matthew Booth 00c1a6
+let arr_spare_group_re  = /spare-group/i
Matthew Booth 00c1a6
+let arr_spares_re       = /spares/i
Matthew Booth 00c1a6
+let arr_super_minor_re  = /super-minor/i
Matthew Booth 00c1a6
+let arr_uuid_re         = /uuid/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let arr_devicename      = [ store value_no_eq . label "devicename" ]
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
@@ -149,7 +147,7 @@ let array  = [ del array_re "ARRAY" . label "array" . arr_options . eol ]
Matthew Booth 00c1a6
  * MAILADDR
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let mailaddr_re = /[mM][aA][iI]([lL]([aA]([dD]([dD][rR]?)?)?)?)?/
Matthew Booth 00c1a6
+let mailaddr_re = /mai(l(a(d(dr?)?)?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 (* We intentially allow multiple mailaddr values here, even though this is
Matthew Booth 00c1a6
 invalid and would produce a warning. This is better than not parsing the file.
Matthew Booth 00c1a6
@@ -162,7 +160,7 @@ let mailaddr = simplevalue mailaddr_re "mailaddr" "MAILADDR"
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 (* N.B. MAILFROM can only be abbreviated to 5 characters *)
Matthew Booth 00c1a6
-let mailfrom_re = /[mM][aA][iI][lL][fF]([rR]([oO][mM]?)?)?/
Matthew Booth 00c1a6
+let mailfrom_re = /mailf(r(om?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let mailfrom = [ del mailfrom_re "MAILFROM" . label "mailfrom"
Matthew Booth 00c1a6
                  . ( value_sep . [ label "value" . store value ] )* . eol ]
Matthew Booth 00c1a6
@@ -172,7 +170,7 @@ let mailfrom = [ del mailfrom_re "MAILFROM" . label "mailfrom"
Matthew Booth 00c1a6
  * PROGRAM
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let program_re = /[pP][rR][oO]([gG]([rR]([aA][mM]?)?)?)?/
Matthew Booth 00c1a6
+let program_re = /pro(g(r(am?)?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let program = simplevalue program_re "program" "PROGRAM"
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
@@ -181,14 +179,14 @@ let program = simplevalue program_re "program" "PROGRAM"
Matthew Booth 00c1a6
  * CREATE
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let create_re = /[cC][rR][eE]([aA]([tT][eE]?)?)?/
Matthew Booth 00c1a6
+let create_re = /cre(a(te?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let cre_auto_re     = /[aA][uU][tT][oO]/
Matthew Booth 00c1a6
-let cre_owner_re    = /[oO][wW][nN][eE][rR]/
Matthew Booth 00c1a6
-let cre_group_re    = /[gG][rR][oO][uU][pP]/
Matthew Booth 00c1a6
-let cre_mode_re     = /[mM][oO][dD][eE]/
Matthew Booth 00c1a6
-let cre_metadata_re = /[mM][eE][tT][aA][dD][aA][tT][aA]/
Matthew Booth 00c1a6
-let cre_symlinks_re = /[sS][yY][mM][lL][iI][nN][kK][sS]/
Matthew Booth 00c1a6
+let cre_auto_re     = /auto/i
Matthew Booth 00c1a6
+let cre_owner_re    = /owner/i
Matthew Booth 00c1a6
+let cre_group_re    = /group/i
Matthew Booth 00c1a6
+let cre_mode_re     = /mode/i
Matthew Booth 00c1a6
+let cre_metadata_re = /metadata/i
Matthew Booth 00c1a6
+let cre_symlinks_re = /symlinks/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let cre_auto        = keyvalue cre_auto_re "auto" "AUTO"
Matthew Booth 00c1a6
 let cre_group       = keyvalue cre_group_re "group" "GROUP"
Matthew Booth 00c1a6
@@ -211,7 +209,7 @@ let create  = [ del create_re "CREATE" . label "create" . cre_options . eol ]
Matthew Booth 00c1a6
  * HOMEHOST
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let homehost_re = /[hH][oO][mM]([eE]([hH]([oO]([sS][tT]?)?)?)?)?/
Matthew Booth 00c1a6
+let homehost_re = /hom(e(h(o(st?)?)?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let homehost = simplevalue homehost_re "homehost" "HOMEHOST"
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
@@ -220,7 +218,7 @@ let homehost = simplevalue homehost_re "homehost" "HOMEHOST"
Matthew Booth 00c1a6
  * AUTO
Matthew Booth 00c1a6
  ******************************************************************************)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let auto_re = /[aA][uU][tT][oO]?/
Matthew Booth 00c1a6
+let auto_re = /auto?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 let aut_plus        = [ key "+" . store value ]
Matthew Booth 00c1a6
 let aut_minus       = [ key "-" . store value ]
Matthew Booth 00c1a6
@@ -239,9 +237,8 @@ let auto = [ del auto_re "AUTO" . label "auto" . aut_list . eol ]
Matthew Booth 00c1a6
 suggests it's parsed the same way as POLICY, but treated slightly differently
Matthew Booth 00c1a6
 thereafter. *)
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
-let policy_re = /[pP][oO][lL]([iI]([cC][yY]?)?)?/
Matthew Booth 00c1a6
-let part_policy_re =
Matthew Booth 00c1a6
-    /[pP][aA][rR]([tT](-([pP]([oO]([lL]([iI]([cC][yY]?)?)?)?)?)?)?)?/
Matthew Booth 00c1a6
+let policy_re = /pol(i(cy?)?)?/i
Matthew Booth 00c1a6
+let part_policy_re = /par(t(-(p(o(l(i(cy?)?)?)?)?)?)?)?/i
Matthew Booth 00c1a6
 
Matthew Booth 00c1a6
 (* Unlike everything else, policy keys are matched case sensitive. This means we
Matthew Booth 00c1a6
 don't have to mess around with explicit option matching, as the match string is