* [PATCH] e2scrub: fix systemd escaping again
@ 2018-11-05 17:59 Darrick J. Wong
2018-11-15 19:20 ` Theodore Y. Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2018-11-05 17:59 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: linux-ext4
From: Darrick J. Wong <darrick.wong@oracle.com>
Apparently newer versions of systemd than the one on this author's
laptop <cough> now complain about lack of (path) escaping in unit
instance variable contents:
# e2scrub_all
Scrubbing /home...
Invalid unit name "e2scrub@/home" was escaped as "e2scrub@-home"
(maybe you should use systemd-escape?)
Starting Online ext4 Metadata Check for /home...
So change the escape_path_for_systemd function to escape paths
unconditionally to make the warning go away.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
scrub/e2scrub_all.in | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index 9581dc2c4..23d122d25 100644
--- a/scrub/e2scrub_all.in
+++ b/scrub/e2scrub_all.in
@@ -101,13 +101,18 @@ ls_scrub_targets() {
# systemd doesn't know to do path escaping on the instance variable we pass
# to the e2scrub service, which breaks things if there is a dash in the path
# name. Therefore, do the path escaping ourselves if needed.
+#
+# systemd path escaping also drops the initial slash so we add that back in so
+# that log messages from the service units preserve the full path and users can
+# look up log messages using full paths. However, for "/" the escaping rules
+# do /not/ drop the initial slash, so we have to special-case that here.
escape_path_for_systemd() {
local path="$1"
- if echo "${path}" | grep -q -- "-"; then
+ if [ "${path}" != "/" ]; then
echo "-$(systemd-escape --path "${path}")"
else
- echo "${path}"
+ echo "-"
fi
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] e2scrub: fix systemd escaping again
2018-11-05 17:59 [PATCH] e2scrub: fix systemd escaping again Darrick J. Wong
@ 2018-11-15 19:20 ` Theodore Y. Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Y. Ts'o @ 2018-11-15 19:20 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-ext4
On Mon, Nov 05, 2018 at 09:59:46AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Apparently newer versions of systemd than the one on this author's
> laptop <cough> now complain about lack of (path) escaping in unit
> instance variable contents:
>
> # e2scrub_all
> Scrubbing /home...
> Invalid unit name "e2scrub@/home" was escaped as "e2scrub@-home"
> (maybe you should use systemd-escape?)
> Starting Online ext4 Metadata Check for /home...
>
> So change the escape_path_for_systemd function to escape paths
> unconditionally to make the warning go away.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-16 5:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-05 17:59 [PATCH] e2scrub: fix systemd escaping again Darrick J. Wong
2018-11-15 19:20 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).