]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_scrub: fix pathname escaping across all service definitions
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:07:05 +0000 (18:07 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:08:46 +0000 (18:08 -0800)
commit595874f26b6d8f989d4258faacbe9309ad65d80e
tree6316cc4805dc5d477ade6487d19dfbba4fbe1988
parent7c4b91c5c119ea4b1e4d7640a64aac7671de36ff
xfs_scrub: 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
xfs_scrub, 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
exist 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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/Makefile
scrub/xfs_scrub@.service.in
scrub/xfs_scrub_all.in
scrub/xfs_scrub_fail.in [moved from scrub/xfs_scrub_fail with 75% similarity]
scrub/xfs_scrub_fail@.service.in