Comment 5 for bug 28067

Revision history for this message
Debian Bug Importer (debzilla) wrote : Re: initscripts: checkroot.sh ignores fsck result

Message-Id: <E1EjO62-0002If-Ms@ei>
Date: Mon, 05 Dec 2005 16:42:05 -0500
From: Ilguiz Latypov <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: initscripts: checkroot.sh ignores fsck result

Package: initscripts
Version: 2.86.ds1-6
Severity: normal
Tags: patch

The /etc/init.d/checkroot.sh script ignored the fsck's "PLEASE REBOOT
LINUX NOW" exit code because the code is stored too late. As a result,
the fixes fsck made to my filesystem could be corrupted again because
the system didn't reboot immediately.

Besides, the if/then/else/fi statement's syntax was messed up.
Surprisingly, it was still valid according to "sh -n".

Here is the suggested patch.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
--- checkroot.sh.orig 2005-11-19 06:40:50.000000000 -0500
+++ checkroot.sh 2005-12-05 16:35:34.000000000 -0500
@@ -249,12 +249,13 @@
                fi
                log_action_msg "Will now check root file system"
                fsck $spinner $force $fix -T -t $roottype $rootdev
- if [ "$?" = 0 ]
- log_success_msg "Done checking root file system"
+ FSCKCODE=$?
+ if [ "$FSCKCODE" = 0 ]
                then
+ log_success_msg "Done checking root file system"
+ else
                        log_failure_msg "Done checking root file system"
                fi
- FSCKCODE=$?
        fi

        #
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (800, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-2-k7
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

Versions of packages initscripts depends on:
ii coreutils 5.93-5 The GNU core utilities
ii dpkg 1.13.11.0.1 package maintenance system for Deb
ii e2fsprogs 1.38-2 ext2 file system utilities and lib
ii libc6 2.3.5-8.1 GNU C Library: Shared libraries an
ii lsb-base 3.0-11 Linux Standard Base 3.0 init scrip
ii util-linux 2.12p-8 Miscellaneous system utilities

initscripts recommends no packages.

-- no debconf information