diff mbox series

[3/2] e2scrub_fail: move executable script to /usr/libexec

Message ID 20231231203903.GC36164@frogsfrogsfrogs
State Accepted
Headers show
Series [1/2] e2scrub: fix pathname escaping across all service definitions | expand

Commit Message

Darrick J. Wong Dec. 31, 2023, 8:39 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Per FHS 3.0, non-PATH executable binaries are supposed to live under
/usr/libexec, not /usr/lib.  e2scrub_fail is an executable script, so
move it to libexec in case some distro some day tries to mount /usr/lib
as noexec or something.  Also, there's no reason why these scripts need
to be put under an arch-dependent path.

Cc: Neal Gompa <neal@gompa.dev>
Link: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 MCONFIG.in                     |    2 +-
 debian/e2fsprogs.install       |    4 ++--
 scrub/Makefile.in              |   10 +++++-----
 scrub/e2scrub_all.cron.in      |    2 +-
 scrub/e2scrub_fail@.service.in |    2 +-
 util/subst.conf.in             |    2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

Comments

Neal Gompa Dec. 31, 2023, 9:37 p.m. UTC | #1
On Sun, Dec 31, 2023 at 3:39 PM Darrick J. Wong <djwong@kernel.org> wrote:
>
> From: Darrick J. Wong <djwong@kernel.org>
>
> Per FHS 3.0, non-PATH executable binaries are supposed to live under
> /usr/libexec, not /usr/lib.  e2scrub_fail is an executable script, so
> move it to libexec in case some distro some day tries to mount /usr/lib
> as noexec or something.  Also, there's no reason why these scripts need
> to be put under an arch-dependent path.
>
> Cc: Neal Gompa <neal@gompa.dev>
> Link: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  MCONFIG.in                     |    2 +-
>  debian/e2fsprogs.install       |    4 ++--
>  scrub/Makefile.in              |   10 +++++-----
>  scrub/e2scrub_all.cron.in      |    2 +-
>  scrub/e2scrub_fail@.service.in |    2 +-
>  util/subst.conf.in             |    2 +-
>  6 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/MCONFIG.in b/MCONFIG.in
> index 82c75a28..2b1872fa 100644
> --- a/MCONFIG.in
> +++ b/MCONFIG.in
> @@ -34,7 +34,7 @@ man8dir = $(mandir)/man8
>  infodir = @infodir@
>  datadir = @datadir@
>  pkgconfigdir = $(libdir)/pkgconfig
> -pkglibdir = $(libdir)/e2fsprogs
> +pkglibexecdir = @libexecdir@/e2fsprogs
>
>  HAVE_UDEV = @have_udev@
>  UDEV_RULES_DIR = @pkg_udev_rules_dir@
> diff --git a/debian/e2fsprogs.install b/debian/e2fsprogs.install
> index 8cf07a6f..b50078d3 100755
> --- a/debian/e2fsprogs.install
> +++ b/debian/e2fsprogs.install
> @@ -16,8 +16,8 @@ sbin/resize2fs
>  sbin/tune2fs
>  usr/bin/chattr
>  usr/bin/lsattr
> -[linux-any] usr/lib/*/e2fsprogs/e2scrub_all_cron
> -[linux-any] usr/lib/*/e2fsprogs/e2scrub_fail
> +[linux-any] usr/libexec/e2fsprogs/e2scrub_all_cron
> +[linux-any] usr/libexec/e2fsprogs/e2scrub_fail
>  usr/sbin/e2freefrag
>  [linux-any] usr/sbin/e4crypt
>  [linux-any] usr/sbin/e4defrag
> diff --git a/scrub/Makefile.in b/scrub/Makefile.in
> index d0c5c11b..c97a1dd5 100644
> --- a/scrub/Makefile.in
> +++ b/scrub/Makefile.in
> @@ -95,8 +95,8 @@ installdirs-crond:
>         $(Q) $(MKDIR_P) $(DESTDIR)$(CROND_DIR)
>
>  installdirs-libprogs:
> -       $(E) "  MKDIR_P $(pkglibdir)"
> -       $(Q) $(MKDIR_P) $(DESTDIR)$(pkglibdir)
> +       $(E) "  MKDIR_P $(pkglibexecdir)"
> +       $(Q) $(MKDIR_P) $(DESTDIR)$(pkglibexecdir)
>
>  installdirs-systemd:
>         $(E) "  MKDIR_P $(SYSTEMD_SYSTEM_UNIT_DIR)"
> @@ -125,8 +125,8 @@ install-crond: installdirs-crond
>
>  install-libprogs: $(LIBPROGS) installdirs-libprogs
>         $(Q) for i in $(LIBPROGS); do \
> -               $(ES) " INSTALL $(pkglibdir)/$$i"; \
> -               $(INSTALL_PROGRAM) $$i $(DESTDIR)$(pkglibdir)/$$i; \
> +               $(ES) " INSTALL $(pkglibexecdir)/$$i"; \
> +               $(INSTALL_PROGRAM) $$i $(DESTDIR)$(pkglibexecdir)/$$i; \
>         done
>
>  install-systemd: $(SERVICE_FILES) installdirs-systemd
> @@ -169,7 +169,7 @@ uninstall-crond:
>
>  uninstall-libprogs:
>         for i in $(LIBPROGS); do \
> -               $(RM) -f $(DESTDIR)$(pkglibdir)/$$i; \
> +               $(RM) -f $(DESTDIR)$(pkglibexecdir)/$$i; \
>         done
>
>  uninstall-systemd:
> diff --git a/scrub/e2scrub_all.cron.in b/scrub/e2scrub_all.cron.in
> index 395fb2ab..8e2640d4 100644
> --- a/scrub/e2scrub_all.cron.in
> +++ b/scrub/e2scrub_all.cron.in
> @@ -1,2 +1,2 @@
> -30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 @pkglibdir@/e2scrub_all_cron
> +30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 @pkglibexecdir@/e2scrub_all_cron
>  10 3 * * * root test -e /run/systemd/system || SERVICE_MODE=1 @root_sbindir@/e2scrub_all -A -r
> diff --git a/scrub/e2scrub_fail@.service.in b/scrub/e2scrub_fail@.service.in
> index ae65a1da..462daee2 100644
> --- a/scrub/e2scrub_fail@.service.in
> +++ b/scrub/e2scrub_fail@.service.in
> @@ -4,7 +4,7 @@ Documentation=man:e2scrub(8)
>
>  [Service]
>  Type=oneshot
> -ExecStart=@pkglibdir@/e2scrub_fail "%f"
> +ExecStart=@pkglibexecdir@/e2scrub_fail "%f"
>  User=mail
>  Group=mail
>  SupplementaryGroups=systemd-journal
> diff --git a/util/subst.conf.in b/util/subst.conf.in
> index 0da45541..5af5e356 100644
> --- a/util/subst.conf.in
> +++ b/util/subst.conf.in
> @@ -23,4 +23,4 @@ root_sbindir          @root_sbindir@
>  root_bindir            @root_bindir@
>  libdir                 @libdir@
>  $exec_prefix           @exec_prefix@
> -pkglibdir              @libdir@/e2fsprogs
> +pkglibexecdir          @libexecdir@/e2fsprogs

Looks great to me.

Reviewed-by: Neal Gompa <neal@gompa.dev>
diff mbox series

Patch

diff --git a/MCONFIG.in b/MCONFIG.in
index 82c75a28..2b1872fa 100644
--- a/MCONFIG.in
+++ b/MCONFIG.in
@@ -34,7 +34,7 @@  man8dir = $(mandir)/man8
 infodir = @infodir@
 datadir = @datadir@
 pkgconfigdir = $(libdir)/pkgconfig
-pkglibdir = $(libdir)/e2fsprogs
+pkglibexecdir = @libexecdir@/e2fsprogs
 
 HAVE_UDEV = @have_udev@
 UDEV_RULES_DIR = @pkg_udev_rules_dir@
diff --git a/debian/e2fsprogs.install b/debian/e2fsprogs.install
index 8cf07a6f..b50078d3 100755
--- a/debian/e2fsprogs.install
+++ b/debian/e2fsprogs.install
@@ -16,8 +16,8 @@  sbin/resize2fs
 sbin/tune2fs
 usr/bin/chattr
 usr/bin/lsattr
-[linux-any] usr/lib/*/e2fsprogs/e2scrub_all_cron
-[linux-any] usr/lib/*/e2fsprogs/e2scrub_fail
+[linux-any] usr/libexec/e2fsprogs/e2scrub_all_cron
+[linux-any] usr/libexec/e2fsprogs/e2scrub_fail
 usr/sbin/e2freefrag
 [linux-any] usr/sbin/e4crypt
 [linux-any] usr/sbin/e4defrag
diff --git a/scrub/Makefile.in b/scrub/Makefile.in
index d0c5c11b..c97a1dd5 100644
--- a/scrub/Makefile.in
+++ b/scrub/Makefile.in
@@ -95,8 +95,8 @@  installdirs-crond:
 	$(Q) $(MKDIR_P) $(DESTDIR)$(CROND_DIR)
 
 installdirs-libprogs:
-	$(E) "	MKDIR_P $(pkglibdir)"
-	$(Q) $(MKDIR_P) $(DESTDIR)$(pkglibdir)
+	$(E) "	MKDIR_P $(pkglibexecdir)"
+	$(Q) $(MKDIR_P) $(DESTDIR)$(pkglibexecdir)
 
 installdirs-systemd:
 	$(E) "	MKDIR_P $(SYSTEMD_SYSTEM_UNIT_DIR)"
@@ -125,8 +125,8 @@  install-crond: installdirs-crond
 
 install-libprogs: $(LIBPROGS) installdirs-libprogs
 	$(Q) for i in $(LIBPROGS); do \
-		$(ES) "	INSTALL $(pkglibdir)/$$i"; \
-		$(INSTALL_PROGRAM) $$i $(DESTDIR)$(pkglibdir)/$$i; \
+		$(ES) "	INSTALL $(pkglibexecdir)/$$i"; \
+		$(INSTALL_PROGRAM) $$i $(DESTDIR)$(pkglibexecdir)/$$i; \
 	done
 
 install-systemd: $(SERVICE_FILES) installdirs-systemd
@@ -169,7 +169,7 @@  uninstall-crond:
 
 uninstall-libprogs:
 	for i in $(LIBPROGS); do \
-		$(RM) -f $(DESTDIR)$(pkglibdir)/$$i; \
+		$(RM) -f $(DESTDIR)$(pkglibexecdir)/$$i; \
 	done
 
 uninstall-systemd:
diff --git a/scrub/e2scrub_all.cron.in b/scrub/e2scrub_all.cron.in
index 395fb2ab..8e2640d4 100644
--- a/scrub/e2scrub_all.cron.in
+++ b/scrub/e2scrub_all.cron.in
@@ -1,2 +1,2 @@ 
-30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 @pkglibdir@/e2scrub_all_cron
+30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 @pkglibexecdir@/e2scrub_all_cron
 10 3 * * * root test -e /run/systemd/system || SERVICE_MODE=1 @root_sbindir@/e2scrub_all -A -r
diff --git a/scrub/e2scrub_fail@.service.in b/scrub/e2scrub_fail@.service.in
index ae65a1da..462daee2 100644
--- a/scrub/e2scrub_fail@.service.in
+++ b/scrub/e2scrub_fail@.service.in
@@ -4,7 +4,7 @@  Documentation=man:e2scrub(8)
 
 [Service]
 Type=oneshot
-ExecStart=@pkglibdir@/e2scrub_fail "%f"
+ExecStart=@pkglibexecdir@/e2scrub_fail "%f"
 User=mail
 Group=mail
 SupplementaryGroups=systemd-journal
diff --git a/util/subst.conf.in b/util/subst.conf.in
index 0da45541..5af5e356 100644
--- a/util/subst.conf.in
+++ b/util/subst.conf.in
@@ -23,4 +23,4 @@  root_sbindir		@root_sbindir@
 root_bindir		@root_bindir@
 libdir			@libdir@
 $exec_prefix		@exec_prefix@
-pkglibdir		@libdir@/e2fsprogs
+pkglibexecdir		@libexecdir@/e2fsprogs