Skip to content

Commit

Permalink
lenses: Allow whitespace at the end of kernel commnd line (#798)
Browse files Browse the repository at this point in the history
Reported-by: Yongkui Guo
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2159282

Signed-off-by: Richard W.M. Jones <[email protected]>
  • Loading branch information
rwmjones authored Mar 5, 2023
1 parent 465f58a commit 801aa73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lenses/cmdline.aug
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Cmdline =

let entry = [ key Rx.word . Util.del_str "=" . store Rx.no_spaces ] | [ key Rx.word ]

let lns = (Build.opt_list entry Sep.space)? . del /\n?/ ""
let lns = (Build.opt_list entry Sep.space)? . del /[ \t]*\n?/ ""

let filter = incl "/etc/kernel/cmdline"
. incl "/proc/cmdline"
Expand Down
1 change: 1 addition & 0 deletions lenses/tests/test_cmdline.aug
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let lns = Cmdline.lns

test lns get "foo\nbar" = *
test lns get "foo\n" = { "foo" }
test lns get "foo \n" = { "foo" }
test lns get "foo" = { "foo" }
test lns get "foo bar" = { "foo" } { "bar" }
test lns get "foo bar" = { "foo" } { "bar" }
Expand Down

0 comments on commit 801aa73

Please sign in to comment.