coding errors in update-motd-fsck-at-reboot script
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
update notifier |
New
|
Undecided
|
Unassigned | ||
update-notifier (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
The script /usr/lib/
One of the errors hides the other error:
1. It sets two variables NEEDS_FSCK_CHECK and NEED_FSCK_CHECK (missing 'S') but only checks one of them (NEEDS_FSCK_CHECK). Because of this error, the script doesn't always initialize the value of NEEDS_FSCK_CHECK at the start of the script, so whatever value might happen to be passed in from the environment of the script could force a check even if the script would not itself do so.
Rename variable NEED_FSCK_CHECK to NEEDS_FSCK_CHECK and always run your Bourne shell scripts with the "-u" (check for undefined variables) option enabled: #!/bin/sh -u
2. It sets the variables with values "no" and "yes", but *any* value set in the variables means "yes". (It doesn't check that the value is actually "yes", so even "no" means "yes".) Because of coding error #1, this coding error #2 has no effect on the script operation, so if you fix coding error #1 without fixing this one, the script will incorrectly always run. You have to fix both.
Change:
if [ -n "$NEEDS_FSCK_CHECK" ]; then
to actually check for a "yes":
if [ "$NEEDS_FSCK_CHECK" = 'yes' ]; then
P.S. This script uses dumpe2fs that waits for all the disks on your system to spin up, which can significantly delay an ssh login to your system, as well as cause unnecessary wear on all your normally idle disks since the script seems to run frequently. If you don't like this behaviour (and don't need the fsck information it generates), you can render the script inactive by adding this line to /etc/crontab:
01 * * * * root f=/var/
It would be nice if there were a cleaner way (perhaps something in /etc/default/?) to disable all this disk-spin-up activity, but that would be a different bug report.
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: update-
ProcVersionSign
Uname: Linux 5.11.0-46-generic x86_64
ApportVersion: 2.20.11-
Architecture: amd64
CasperMD5CheckR
Date: Thu Jan 13 23:40:37 2022
EcryptfsInUse: Yes
InstallationDate: Installed on 2020-10-07 (463 days ago)
InstallationMedia: Lubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
PackageArchitec
SourcePackage: update-notifier
UpgradeStatus: No upgrade log present (probably fresh install)
modified.
mtime.conffile.
tags: | added: rls-jj-incoming |
tags: | removed: rls-jj-incoming |
tags: | added: desktop-lts-wishlist |
Wonder if Brian is able to test its own fine art coding style !!! An other coding style is about 'apport' too, with its redundant popping boxes (what a mess)