Discussion:
Bug#932622: Cronjobs doesn't check the presence of the executable
(too old to reply)
Laurent Bigonville
2019-07-21 11:40:02 UTC
Permalink
Package: e2fsprogs
Version: 1.45.2-1
Severity: minor
File: /etc/cron.d/e2scrub_all

Hi,

The cronjob (/etc/cron.d/e2scrub_all) file is a conffile, that means
that if the package is removed without being purge, the cronjob will
still be installed, but the executable will not.

The cronjob should test the presence of the executable.

This is less a problem these days as the cronjob is a noop if systemd is
used.

It's probably the best to keep checking if systemd is used first as this
should be the default case. Maybe something like that:

[ ! -d /run/systemd/system -a -x /usr/lib/x86_64-linux-gnu/e2fsprogs/e2scrub_all_cron ] && /usr/lib/x86_64-linux-gnu/e2fsprogs/e2scrub_all_cron
[ ! -d /run/systemd/system -a -x /sbin/e2scrub_all ] && /sbin/e2scrub_all -C -A -r

Kind regards,

Laurent Bigonville

-- System Information:
Debian Release: bullseye/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-5-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8), LANGUAGE=fr_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: SELinux: enabled - Mode: Permissive - Policy name: refpolicy

Versions of packages e2fsprogs depends on:
ii libblkid1 2.33.1-0.1
ii libc6 2.28-10
ii libcom-err2 1.45.2-1
ii libext2fs2 1.45.2-1
ii libss2 1.45.2-1
ii libuuid1 2.33.1-0.1

Versions of packages e2fsprogs recommends:
ii e2fsprogs-l10n 1.45.2-1

Versions of packages e2fsprogs suggests:
pn e2fsck-static <none>
ii fuse2fs 1.45.2-1
pn gpart <none>
ii parted 3.2-25

-- no debconf information
Theodore Y. Ts'o
2019-07-21 18:50:02 UTC
Permalink
control: -1 +pending
Post by Laurent Bigonville
The cronjob (/etc/cron.d/e2scrub_all) file is a conffile, that means
that if the package is removed without being purge, the cronjob will
still be installed, but the executable will not.
The cronjob should test the presence of the executable.
Thanks for pointing this out. The following will be in the next
e2fsprogs release.

- Ted

commit 2e0ad4432898e13a21db3b8f76c629b19e01cadc
Author: Theodore Ts'o <***@mit.edu>
Date: Sun Jul 21 13:13:24 2019 -0400

e2scrub_all_cron: check to make sure e2scrub_all

Since e2scrub_all.cron is marked as a config file, it can hang around
after the package is removed, in which case e2scrub_all might not be
present. So check to make sure e2scrub_all exists before trying to
execute it.

Addresses-Debian-Bug: #932622

Signed-off-by: Theodore Ts'o <***@mit.edu>
Reported-by: Laurent Bigonville <***@debian.org>

diff --git a/scrub/e2scrub_all_cron.in b/scrub/e2scrub_all_cron.in
index f9cff878..fcfe415f 100644
--- a/scrub/e2scrub_all_cron.in
+++ b/scrub/e2scrub_all_cron.in
@@ -62,6 +62,7 @@ on_ac_power() {
return 0
}

+test -e @root_sbindir@/e2scrub_all || exit 0
test -e /run/systemd/system && exit 0
on_ac_power || exit 0

Loading...