parent
adcc4c4bcb
commit
3f60f556a1
@ -0,0 +1,164 @@
|
|||||||
|
From 34749f9ea1af8e3fad9e60891beda0fe786cb0f2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pino Toscano <ptoscano@redhat.com>
|
||||||
|
Date: Fri, 24 Mar 2023 11:26:46 +0100
|
||||||
|
Subject: [PATCH 4/5] Tmpfiles: allow '=', '~', '^' for letter types, allow ":"
|
||||||
|
as prefix for the mode
|
||||||
|
|
||||||
|
* Tmpfiles: allow '=', '~', '^' for letter types
|
||||||
|
|
||||||
|
Allow an equal sign, a tilde character and/or a caret for the type
|
||||||
|
specification:
|
||||||
|
- equal: strict file type enforcing
|
||||||
|
- tilde: base64-encoded content in the argument
|
||||||
|
- caret: credential name in the argument
|
||||||
|
|
||||||
|
Fixes: #795
|
||||||
|
|
||||||
|
* Tmpfiles: allow ":" as prefix for the mode
|
||||||
|
|
||||||
|
Represents a mode to be set only for new inodes.
|
||||||
|
|
||||||
|
(cherry picked from commit 41b2a33ff02687fa53d69a012a1d47141b196a86)
|
||||||
|
---
|
||||||
|
lenses/tests/test_tmpfiles.aug | 78 ++++++++++++++++++++++++++++++++++
|
||||||
|
lenses/tmpfiles.aug | 9 ++--
|
||||||
|
2 files changed, 83 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lenses/tests/test_tmpfiles.aug b/lenses/tests/test_tmpfiles.aug
|
||||||
|
index 6ced069f..4bbd06a2 100644
|
||||||
|
--- a/lenses/tests/test_tmpfiles.aug
|
||||||
|
+++ b/lenses/tests/test_tmpfiles.aug
|
||||||
|
@@ -97,6 +97,60 @@ Tree for <minus_tree> *)
|
||||||
|
{ "argument" = "-" }
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (* Variable: equal
|
||||||
|
+Example with an equal sign in the type *)
|
||||||
|
+ let equal = "d= /tmp/foo 0755 root root - -\n"
|
||||||
|
+
|
||||||
|
+ (* Variable: equal_tree
|
||||||
|
+Tree for <equal> *)
|
||||||
|
+ let equal_tree =
|
||||||
|
+ {
|
||||||
|
+ "1"
|
||||||
|
+ { "type" = "d=" }
|
||||||
|
+ { "path" = "/tmp/foo" }
|
||||||
|
+ { "mode" = "0755" }
|
||||||
|
+ { "uid" = "root" }
|
||||||
|
+ { "gid" = "root" }
|
||||||
|
+ { "age" = "-" }
|
||||||
|
+ { "argument" = "-" }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ (* Variable: tilde
|
||||||
|
+Example with a tilde character in the type *)
|
||||||
|
+ let tilde = "w~ /tmp/foo 0755 root root - dGVzdAo=\n"
|
||||||
|
+
|
||||||
|
+ (* Variable: tilde_tree
|
||||||
|
+Tree for <tilde> *)
|
||||||
|
+ let tilde_tree =
|
||||||
|
+ {
|
||||||
|
+ "1"
|
||||||
|
+ { "type" = "w~" }
|
||||||
|
+ { "path" = "/tmp/foo" }
|
||||||
|
+ { "mode" = "0755" }
|
||||||
|
+ { "uid" = "root" }
|
||||||
|
+ { "gid" = "root" }
|
||||||
|
+ { "age" = "-" }
|
||||||
|
+ { "argument" = "dGVzdAo=" }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ (* Variable: caret
|
||||||
|
+Example with a caret in the type *)
|
||||||
|
+ let caret = "f^ /etc/motd.d/50-provision.conf - - - - login.motd\n"
|
||||||
|
+
|
||||||
|
+ (* Variable: caret_tree
|
||||||
|
+Tree for <caret> *)
|
||||||
|
+ let caret_tree =
|
||||||
|
+ {
|
||||||
|
+ "1"
|
||||||
|
+ { "type" = "f^" }
|
||||||
|
+ { "path" = "/etc/motd.d/50-provision.conf" }
|
||||||
|
+ { "mode" = "-" }
|
||||||
|
+ { "uid" = "-" }
|
||||||
|
+ { "gid" = "-" }
|
||||||
|
+ { "age" = "-" }
|
||||||
|
+ { "argument" = "login.motd" }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
(* Variable: short
|
||||||
|
Example with only type and path *)
|
||||||
|
let short = "A+ /tmp/foo\n"
|
||||||
|
@@ -337,6 +391,22 @@ Tree for <mode3> *)
|
||||||
|
{ "mode" = "755" }
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (* Variable: mode_colon
|
||||||
|
+Mode field with colon prefix *)
|
||||||
|
+ let mode_colon = "d- /root :0700 root :root\n"
|
||||||
|
+
|
||||||
|
+ (* Variable: mode_colon_tree
|
||||||
|
+Tree for <mode_colon> *)
|
||||||
|
+ let mode_colon_tree =
|
||||||
|
+ {
|
||||||
|
+ "1"
|
||||||
|
+ { "type" = "d-" }
|
||||||
|
+ { "path" = "/root" }
|
||||||
|
+ { "mode" = ":0700" }
|
||||||
|
+ { "uid" = "root" }
|
||||||
|
+ { "gid" = ":root" }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
(************************************************************************
|
||||||
|
* Group: INVALID EXAMPLES
|
||||||
|
*************************************************************************)
|
||||||
|
@@ -377,6 +447,12 @@ Invalid example that contain invalid mode (letter) *)
|
||||||
|
|
||||||
|
test Tmpfiles.lns get minus = minus_tree
|
||||||
|
|
||||||
|
+ test Tmpfiles.lns get equal = equal_tree
|
||||||
|
+
|
||||||
|
+ test Tmpfiles.lns get tilde = tilde_tree
|
||||||
|
+
|
||||||
|
+ test Tmpfiles.lns get caret = caret_tree
|
||||||
|
+
|
||||||
|
test Tmpfiles.lns get short = short_tree
|
||||||
|
|
||||||
|
test Tmpfiles.lns get short_mode = short_mode_tree
|
||||||
|
@@ -405,6 +481,8 @@ Invalid example that contain invalid mode (letter) *)
|
||||||
|
|
||||||
|
test Tmpfiles.lns get mode3 = mode3_tree
|
||||||
|
|
||||||
|
+ test Tmpfiles.lns get mode_colon = mode_colon_tree
|
||||||
|
+
|
||||||
|
|
||||||
|
(* failure cases *)
|
||||||
|
|
||||||
|
diff --git a/lenses/tmpfiles.aug b/lenses/tmpfiles.aug
|
||||||
|
index 01b3003a..1163c84a 100644
|
||||||
|
--- a/lenses/tmpfiles.aug
|
||||||
|
+++ b/lenses/tmpfiles.aug
|
||||||
|
@@ -50,15 +50,16 @@ Empty lines *)
|
||||||
|
|
||||||
|
(* View: type
|
||||||
|
One letter. Some of them can have a "+" and all can have an
|
||||||
|
-exclamation mark ("!") and/or minus sign ("-").
|
||||||
|
+exclamation mark ("!"), a minus sign ("-"), an equal sign ("="),
|
||||||
|
+a tilde character ("~") and/or a caret ("^").
|
||||||
|
|
||||||
|
Not all letters are valid.
|
||||||
|
*)
|
||||||
|
- let type = /([fFwdDevqQpLcbCxXrRzZtThHaAm]|[fFwpLcbaA]\+)!?-?/
|
||||||
|
+ let type = /([fFwdDevqQpLcbCxXrRzZtThHaAm]|[fFwpLcbaA]\+)[-!=~^]*/
|
||||||
|
|
||||||
|
(* View: mode
|
||||||
|
-"-", or 3-4 bytes. Optionally starts with a "~". *)
|
||||||
|
- let mode = /(-|~?[0-7]{3,4})/
|
||||||
|
+"-", or 3-4 bytes. Optionally starts with a "~" or a ":". *)
|
||||||
|
+ let mode = /(-|(~|:)?[0-7]{3,4})/
|
||||||
|
|
||||||
|
(* View: age
|
||||||
|
"-", or one of the formats seen in the manpage: 10d, 5seconds, 1y5days.
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From f4a9ca77e5dba3659cfadd9e12ba96b32befdaab Mon Sep 17 00:00:00 2001
|
||||||
|
From: rwmjones <rjones@redhat.com>
|
||||||
|
Date: Sun, 5 Mar 2023 10:30:43 +0000
|
||||||
|
Subject: [PATCH 5/5] lenses: Allow whitespace at the end of kernel commnd line
|
||||||
|
(#798)
|
||||||
|
|
||||||
|
Reported-by: Yongkui Guo
|
||||||
|
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2159282
|
||||||
|
|
||||||
|
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
(cherry picked from commit 801aa73db3c356378467622a7e02dea21ccf4332)
|
||||||
|
---
|
||||||
|
lenses/cmdline.aug | 2 +-
|
||||||
|
lenses/tests/test_cmdline.aug | 1 +
|
||||||
|
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lenses/cmdline.aug b/lenses/cmdline.aug
|
||||||
|
index b8b5176d..30e9aac7 100644
|
||||||
|
--- a/lenses/cmdline.aug
|
||||||
|
+++ b/lenses/cmdline.aug
|
||||||
|
@@ -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"
|
||||||
|
diff --git a/lenses/tests/test_cmdline.aug b/lenses/tests/test_cmdline.aug
|
||||||
|
index 0624a0b2..77a429d8 100644
|
||||||
|
--- a/lenses/tests/test_cmdline.aug
|
||||||
|
+++ b/lenses/tests/test_cmdline.aug
|
||||||
|
@@ -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" }
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
Loading…
Reference in new issue