[Pkg-sysvinit-devel] Bug#608534: fsck exit code 32 should be treated as success

Kel Modderman kel at otaku42.de
Sun Jan 9 03:54:58 UTC 2011


tags 608534 patch
thanks

On Saturday 01 January 2011 19:29:42 Petter Reinholdtsen wrote:
> [Ben Hutchings]
> > However, check{root,fsck}.sh are interactive and fsck will be and
> > should be interruptible.  If fsck checks the filesystem only due to
> > a schedule (number of days or number of mounts since last check) and
> > not due to a detected error condition then a user interrupt should
> > *not* be considered a failure of the init script.  Please squash
> > exit code 32 in these init scripts.

I think a failure message should still be emitted but the boot process
allowed to continue after message about user interrupt.

> 
> Something like this might work.  I have not had time to complete the
> patch, nor test it, and I am not sure if it is a good idea to ignore
> interrupted fsck runs, so I post the patch here for review and
> feedback.
> 
> Not tagging the BTS report with 'patch' as this patch is incomplete
> (need to also modify checkfsck.sh).

This works for me. Please let me know of problems or if you'd like to
see it committed.

Thanks, Kel.

---
Index: debian/src/initscripts/etc/init.d/checkfs.sh
===================================================================
--- debian/src/initscripts/etc/init.d/checkfs.sh	(revision 1953)
+++ debian/src/initscripts/etc/init.d/checkfs.sh	(working copy)
@@ -23,6 +23,9 @@
 . /lib/init/swap-functions.sh
 
 do_start () {
+	# Trap SIGINT so that we can handle user interupt of fsck.
+	trap "" INT
+
 	# See if we're on AC Power.  If not, we're not gonna run our
 	# check.  If on_ac_power (in /usr/) is unavailable, behave as
 	# before and check all file systems needing it.
@@ -109,9 +112,13 @@
 			    splash_stop_indefinite
 			fi
 
-			if [ "$FSCKCODE" -gt 1 ]
+			if [ "$FSCKCODE" -eq 32 ]
 			then
 				log_action_end_msg 1 "code $FSCKCODE"
+				log_warning_msg "File system check was interrupted by user"
+			elif [ "$FSCKCODE" -gt 1 ]
+			then
+				log_action_end_msg 1 "code $FSCKCODE"
 				handle_failed_fsck
 			else
 				log_action_end_msg 0
@@ -127,8 +134,11 @@
 			logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT
 			FSCKCODE=$?
 			splash_stop_indefinite
-			if [ "$FSCKCODE" -gt 1 ]
+			if [ "$FSCKCODE" -eq 32 ]
 			then
+				log_warning_msg "File system check was interrupted by user"
+			elif [ "$FSCKCODE" -gt 1 ]
+			then
 				handle_failed_fsck
 			else
 				log_success_msg "Done checking file systems. 
Index: debian/src/initscripts/etc/init.d/checkroot.sh
===================================================================
--- debian/src/initscripts/etc/init.d/checkroot.sh	(revision 1953)
+++ debian/src/initscripts/etc/init.d/checkroot.sh	(working copy)
@@ -25,6 +25,9 @@
 . /lib/init/usplash-fsck-functions.sh
 
 do_start () {
+	# Trap SIGINT so that we can handle user interrupt of fsck.
+	trap "" INT
+
 	#
 	# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to
 	# be spawned from this script *before anything else* with a timeout,
@@ -304,8 +307,11 @@
 	# errors were corrected but that the boot may proceed. A return
 	# code of 2 or 3 indicates that the system should immediately reboot.
 	#
-	if [ "$FSCKCODE" -gt 3 ]
+	if [ "$FSCKCODE" -eq 32 ]
 	then
+		log_warning_msg "File system check was interrupted by user"
+	elif [ "$FSCKCODE" -gt 3 ]
+	then
 		# Surprise! Re-directing from a HERE document (as in "cat << EOF")
 		# does not work because the root is currently read-only.
 		log_failure_msg "An automatic file system check (fsck) of the root filesystem failed. 
---



More information about the Pkg-sysvinit-devel mailing list