Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmpfiles: few improvements to the types specification #694

Merged
merged 2 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lenses/tests/test_tmpfiles.aug
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ Tree for <exclamation_mark> *)
{ "argument" = "-" }
}

(* Variable: minus
Example with an minus mark in the type *)
let minus = "D- /tmp/foo - - - - -\n"

(* Variable: minus_tree
Tree for <minus_tree> *)
let minus_tree =
{
"1"
{ "type" = "D-" }
{ "path" = "/tmp/foo" }
{ "mode" = "-" }
{ "uid" = "-" }
{ "gid" = "-" }
{ "age" = "-" }
{ "argument" = "-" }
}

(* Variable: short
Example with only type and path *)
let short = "A+ /tmp/foo\n"
Expand Down Expand Up @@ -333,7 +351,7 @@ Invalid example that contain invalid age *)

(* Variable: invalid_type
Invalid example that contain invalid type (bad letter) *)
let invalid_type = "e /var/tmp/js 0000 jonhsmith 60 1s foo\n"
let invalid_type = "i /var/tmp/js 0000 jonhsmith 60 1s foo\n"

(* Variable: invalid_type_num
Invalid example that contain invalid type (numeric) *)
Expand All @@ -357,6 +375,8 @@ Invalid example that contain invalid mode (letter) *)

test Tmpfiles.lns get exclamation_mark = exclamation_mark_tree

test Tmpfiles.lns get minus = minus_tree

test Tmpfiles.lns get short = short_tree

test Tmpfiles.lns get short_mode = short_mode_tree
Expand Down
5 changes: 3 additions & 2 deletions lenses/tmpfiles.aug
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ Empty lines *)
(* Group: Lense-specific primitives *)

(* View: type
One letter. Some of them can have a "+" and all can have a "!".
One letter. Some of them can have a "+" and all can have an
exclamation mark ("!") and/or minus sign ("-").

Not all letters are valid.
*)
let type = /([fFwdDvqQpLcbCxXrRzZtThHaAm]|[AabcLp]\+)!?/
let type = /([fFwdDevqQpLcbCxXrRzZtThHaAm]|[fFwpLcbaA]\+)!?-?/

(* View: mode
"-", or 3-4 bytes. Optionally starts with a "~". *)
Expand Down