Whamcloud - gitweb
e2scrub: fix pathname escaping across all service definitions
authorDarrick J. Wong <djwong@kernel.org>
Fri, 17 Mar 2023 18:19:11 +0000 (11:19 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 15 Dec 2023 20:24:25 +0000 (12:24 -0800)
commitc45ca2925b031df1a85b8b35c8429fd4bf67c14d
tree3ba63eab5abde4a995aa2ba5027d4b31fc4461c7
parent260dfea450e387cbd2c8de79a7c2eeacc26f74e9
e2scrub: fix pathname escaping across all service definitions

systemd services provide an "instance name" that can be associated with
a particular invocation of a service.  This allows service users to
invoke multiple copies of a service, each with a unique string.  For
e2scrub, we pass the mountpoint of the filesystem as the instance name.
However, systemd services aren't supposed to have slashes in them, so
we're supposed to escape them.

The canonical escaping scheme for pathnames is defined by the
systemd-escape --path command.  Unfortunately, we've been adding our own
opinionated sauce for years, to work around the fact that --path didn't
quite work right in systemd before January 2017.  The special sauce is
incorrect, and we no longer care about systemd of 7 years past.

Clean up this mess by following the systemd escaping scheme throughout
the service units.  Now we can use the '%f' specifier in them, which
makes things a lot less complicated.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
scrub/e2scrub@.service.in
scrub/e2scrub_all.in
scrub/e2scrub_fail.in
scrub/e2scrub_fail@.service.in