Skip to content

Commit

Permalink
lenses/fstab.aug: Tighten parsing of the vfstype field
Browse files Browse the repository at this point in the history
This can be a list, but there's no evidence in the manual that
vfstype=value is permitted, it's just a simple list of strings.

Signed-off-by: Richard W.M. Jones <[email protected]>
  • Loading branch information
rwmjones committed Feb 4, 2025
1 parent 34442c5 commit 4ac2526
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lenses/fstab.aug
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ module Fstab =

let file = /[^# \t\n]+/

(* An option label can't contain comma, comment, equals, or space *)
let optlabel = /[^,#= \n\t]+/
let spec = /[^,# \n\t][^ \n\t]*/

(* A vfstype, usually just a short string like "ext3" or "fuse.sshfs", but
be generous here *)
let vfslabel = /[^,#= \n\t]+/

let vfstype_list (l:string) =
let lns = [ label l . store vfslabel ] in
Build.opt_list lns comma

(* A mount option label can't contain comma, comment, equals, or space *)
let optlabel = /[^,#= \n\t]+/

let comma_sep_list (l:string) =
let value = [ label "value" . Util.del_str "=" . ( store Rx.neg1 )? ] in
let lns = [ label l . store optlabel . value? ] in
Expand All @@ -26,7 +35,7 @@ module Fstab =
Util.indent .
[ label "spec" . store spec ] . sep_tab .
[ label "file" . store file ] . sep_tab .
comma_sep_list "vfstype" .
vfstype_list "vfstype" .
(sep_tab . comma_sep_list "opt" .
(sep_tab . [ label "dump" . store /[0-9]+/ ] .
( sep_spc . [ label "passno" . store /[0-9]+/ ])? )? )?
Expand Down

0 comments on commit 4ac2526

Please sign in to comment.