From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 31 06:30:02 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C5FE1065672 for ; Mon, 31 Mar 2008 06:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 070DF8FC1C for ; Mon, 31 Mar 2008 06:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m2V6U1bN090257 for ; Mon, 31 Mar 2008 06:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m2V6U123090256; Mon, 31 Mar 2008 06:30:01 GMT (envelope-from gnats) Resent-Date: Mon, 31 Mar 2008 06:30:01 GMT Resent-Message-Id: <200803310630.m2V6U123090256@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eygene Ryabinkin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E8B81065672; Mon, 31 Mar 2008 06:20:32 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 562848FC34; Mon, 31 Mar 2008 06:20:32 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from shadow.codelabs.ru (shadow.codelabs.ru [144.206.177.8]) by 0.mx.codelabs.ru with esmtps (TLSv1:CAMELLIA256-SHA:256) id 1JgD54-0001L2-NM; Mon, 31 Mar 2008 10:01:19 +0400 Received: by shadow.codelabs.ru (Postfix, from userid 1001) id 867D85C62; Mon, 31 Mar 2008 10:01:18 +0400 (MSD) Message-Id: <20080331060118.867D85C62@shadow.codelabs.ru> Date: Mon, 31 Mar 2008 10:01:18 +0400 (MSD) From: Eygene Ryabinkin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: rik@FreeBSD.org, dougb@FreeBSD.org Subject: bin/122282: [patch] check the presence of fstab's obsoleted 'nodev' option by mergemaster X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eygene Ryabinkin List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2008 06:30:02 -0000 >Number: 122282 >Category: bin >Synopsis: [patch] check the presence of fstab's obsoleted 'nodev' option by mergemaster >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 31 06:30:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Eygene Ryabinkin >Release: FreeBSD 7.0-STABLE amd64 >Organization: Code Labs >Environment: System: FreeBSD XXX 7.0-STABLE FreeBSD 7.0-STABLE #6: Tue Mar 18 16:46:28 MSK 2008 root@XXX:/usr/src/sys/amd64/compile/XXX amd64 >Description: Option 'nodev' in fstab(5) is obsoleted since FreeBSD 7.x [1] (It was no-op since FreeBSD 6.x). So in the upgrade path FreeBSD 6.x -> FreeBSD 7.x such options in /etc/fstab could survive the upgrade. This will render the corresponding filesystems inaccessible after reboot. [1] http://www.freebsd.org/cgi/cvsweb.cgi/src/sbin/mount/mntopts.h, revision 1.28. >How-To-Repeat: Insert 'nodev' into the options field in /etc/fstab and try to mount the filesystem. >Fix: I propose to add the check to the mergemaster.sh and warn the user if 'nodev' options are found. --- check-nodev-in-mergemaster begins here --- >From f55d0cd0b64c2949687222251304f6fb1a09f10d Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Sun, 30 Mar 2008 15:54:41 +0400 Option 'nodev' was eliminated in FreeBSD 7.x, so some systems, upgrading from 6.x or earlier, can have this option in /etc/fstab. If option(s) will be left in fstab(5), the system will fail to mount the corresponding filesystem(s). And if update is done remotely, this can render the system unusable before someone will go to the console, drop to the single-user mode or boot from other media and correct the things. Signed-off-by: Eygene Ryabinkin --- usr.sbin/mergemaster/mergemaster.sh | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh index 06266e9..1749f79 100755 --- a/usr.sbin/mergemaster/mergemaster.sh +++ b/usr.sbin/mergemaster/mergemaster.sh @@ -1000,6 +1000,12 @@ if [ -n "${TEST_FOR_FILES}" ]; then echo '' fi +if [ -e "${DESTDIR}/etc/fstab" ] && sed -e'/^#/d' "${DESTDIR}/etc/fstab" | \ + awk -F '[[:space:]]+' '{ print $4; }' | \ + grep -E '(^nodev$|^nodev,|,nodev,|,nodev$)' > /dev/null; then + NEED_TO_REMOVE_FSTAB_NODEV=yes +fi + case "${AUTO_RUN}" in '') echo -n "Do you wish to delete what is left of ${TEMPROOT}? [no] " @@ -1096,6 +1102,14 @@ run_it_now () { esac } +any_key () { + local input + [ -t 0 ] || return + [ -n "$AUTO_RUN" ] && return + echo -n ' Press any key... ' + read input +} + case "${NEED_MAKEDEV}" in '') ;; *) @@ -1151,6 +1165,19 @@ case "${NEED_PWD_MKDB}" in ;; esac +case "${NEED_TO_REMOVE_FSTAB_NODEV}" in +'') ;; +*) + echo '' + echo "*** Your fstab file has obsolete 'nodev' options." + echo " Please, remove them before next system boot" + echo " or filesystem mounts will likely fail." + echo '' + echo " Fstab file is ${DESTDIR}/etc/fstab" + any_key + ;; +esac + echo '' if [ -r "${MM_EXIT_SCRIPT}" ]; then -- 1.5.3.8 --- check-nodev-in-mergemaster ends here --- >Release-Note: >Audit-Trail: >Unformatted: