From rea-fbsd@codelabs.ru  Mon Mar 31 06:20:32 2008
Return-Path: <rea-fbsd@codelabs.ru>
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 <rea-fbsd@codelabs.ru>
Reply-To: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc: dougb@freebsd.org, rik@freebsd.org
Subject: [patch] check the presence of fstab's obsoleted 'nodev' option by mergemaster
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         122282
>Category:       bin
>Synopsis:       [patch] mergemaster(8): check the presence of fstab's obsoleted 'nodev' option by mergemaster
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 31 06:30:01 UTC 2008
>Closed-Date:    Fri Jan 09 11:27:16 UTC 2009
>Last-Modified:  Fri Jan 09 11:27:16 UTC 2009
>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 <rea-fbsd@codelabs.ru>
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 <rea-fbsd@codelabs.ru>
---
 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:
Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Mar 31 07:00:27 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122282 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/122282: commit references a PR
Date: Thu,  1 Jan 2009 11:41:24 +0000 (UTC)

 Author: dougb
 Date: Thu Jan  1 11:41:13 2009
 New Revision: 186678
 URL: http://svn.freebsd.org/changeset/base/186678
 
 Log:
   Maintenance and updates
   =======================
   1. Various improvements to the mtree (-U) feature:
   a. Seperate the notion of directory and file (user can override db path)
   b. Only check for the existence of the mtree file if -U is set
   c. Use mktemp to create the new version of the file
   d. More safely install the new file
   e. Standardize error messages a bit
   2. Remove the last of the MAKEDEV stuff (RIP)
   
   New Features
   ============
   1. Switch to using the top level (e.g., /usr/src) Makefile, and specify
   that we should use the *.mk files from the source directory instead of
   the installed versions. [1][2] This allows easier cross builds and
   simplifies (or in some cases permits) upgrading.
   2. Check for the deprecated 'nodev' option in /etc/fstab [3]
   3. Add support for the IGNORE_FILES variable [4] and deprecate IGNORE_MOTD
   accordingly.
   4. Before installing a file check to make sure that the target does not
   already exist as a directory [5]
   5. Check to be sure that the file installed and error out if not
   
   PR:		bin/96528 [1]
   Submitted by:	ru [1]
   PR:		bin/129639 [2]
   Submitted by:	sam [2]
   PR:		bin/122282 [3]
   Submitted by:	Eygene Ryabinkin <rea-fbsd@codelabs.ru> [3]
   PR:		bin/106642 [4]
   Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk> [4]
   PR:		bin/108183 [5]
   Submitted by:	Riccardo Torrini <riccardo@torrini.org> [5]
 
 Modified:
   head/usr.sbin/mergemaster/mergemaster.sh
 
 Modified: head/usr.sbin/mergemaster/mergemaster.sh
 ==============================================================================
 --- head/usr.sbin/mergemaster/mergemaster.sh	Thu Jan  1 10:55:26 2009	(r186677)
 +++ head/usr.sbin/mergemaster/mergemaster.sh	Thu Jan  1 11:41:13 2009	(r186678)
 @@ -5,7 +5,7 @@
  # Compare files created by /usr/src/etc/Makefile (or the directory
  # the user specifies) with the currently installed copies.
  
 -# Copyright 1998-2004 Douglas Barton
 +# Copyright 1998-2009 Douglas Barton
  # DougB@FreeBSD.org
  
  # $FreeBSD$
 @@ -244,10 +244,6 @@ press_to_continue () {
  #
  TEMPROOT='/var/tmp/temproot'
  
 -# Assign the location of the mtree database
 -#
 -MTREEDB='/var/db/mergemaster.mtree'
 -
  # Read /etc/mergemaster.rc first so the one in $HOME can override
  #
  if [ -r /etc/mergemaster.rc ]; then
 @@ -260,12 +256,17 @@ if [ -r "$HOME/.mergemasterrc" ]; then
    . "$HOME/.mergemasterrc"
  fi
  
 +# Assign the location of the mtree database
 +#
 +MTREEDB=${MTREEDB:-/var/db}
 +MTREEFILE="${MTREEDB}/mergemaster.mtree"
 +
  # Check the command line options
  #
  while getopts ":ascrvhipCPm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do
    case "${COMMAND_LINE_ARGUMENT}" in
    A)
 -    ARCHSTRING='MACHINE_ARCH='${OPTARG}
 +    ARCHSTRING='TARGET_ARCH='${OPTARG}
      ;;
    U)
      AUTO_UPGRADE=yes
 @@ -338,10 +339,28 @@ if [ -n "${PRESERVE_FILES}" -a -z "${PRE
    PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
  fi
  
 -# Check the for the mtree database in DESTDIR.
 -if [ ! -f ${DESTDIR}${MTREEDB} ]; then
 -  echo "*** Unable to find mtree database. Skipping auto-upgrade."
 -  unset AUTO_UPGRADE
 +# Check for the mtree database in DESTDIR
 +case "${AUTO_UPGRADE}" in
 +'') ;;	# If the option is not set no need to run the test or warn the user
 +*)
 +  if [ ! -f "${DESTDIR}${MTREEFILE}" ]; then
 +    echo ''
 +    echo "*** Unable to find mtree database. Skipping auto-upgrade."
 +    echo ''
 +    press_to_continue
 +    unset AUTO_UPGRADE
 +  fi
 +  ;;
 +esac
 +
 +if grep -q nodev ${DESTDIR}/etc/fstab; then
 +  echo ''
 +  echo "*** You have the deprecated 'nodev' option in ${DESTDIR}/etc/fstab."
 +  echo "    This can prevent your system from mounting the filesystem on reboot."
 +  echo "    Please update your fstab before continuing."
 +  echo "    See fstab(5) for more information."
 +  echo ''
 +  exit 1
  fi
  
  echo ''
 @@ -412,14 +431,25 @@ DIFF_FLAG=${DIFF_FLAG:--u}
  
  # Assign the source directory
  #
 -SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
 +SOURCEDIR=${SOURCEDIR:-/usr/src}
 +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \
 +   -f ${SOURCEDIR}/../Makefile.inc1 ]; then
 +  echo " *** The source directory you specified (${SOURCEDIR})"
 +  echo "     will be reset to ${SOURCEDIR}/.."
 +  echo ''
 +  sleep 3
 +  SOURCEDIR=${SOURCEDIR}/..
 +fi
 +
 +# Setup make to use system files from SOURCEDIR
 +MM_MAKE="make -m ${SOURCEDIR}/share/mk"
  
  # Check DESTDIR against the mergemaster mtree database to see what
  # files the user changed from the reference files.
  #
  CHANGED=
 -if [ -n "${AUTO_UPGRADE}" -a -f "${DESTDIR}${MTREEDB}" ]; then
 -	for file in `mtree -eq -f ${DESTDIR}${MTREEDB} -p ${DESTDIR}/ \
 +if [ -n "${AUTO_UPGRADE}" -a -f "${DESTDIR}${MTREEFILE}" ]; then
 +	for file in `mtree -eq -f ${DESTDIR}${MTREEFILE} -p ${DESTDIR}/ \
  		2>/dev/null | awk '($2 == "changed") {print $1}'`; do
  		if [ -f "${DESTDIR}/$file" ]; then
  			CHANGED="${CHANGED} ${DESTDIR}/$file"
 @@ -552,13 +582,13 @@ case "${RERUN}" in
        case "${DESTDIR}" in
        '') ;;
        *)
 -      make DESTDIR=${DESTDIR} ${ARCHSTRING} distrib-dirs
 +      ${MM_MAKE} DESTDIR=${DESTDIR} ${ARCHSTRING} distrib-dirs
          ;;
        esac
 -      make DESTDIR=${TEMPROOT} ${ARCHSTRING} distrib-dirs &&
 -      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} obj &&
 -      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} all &&
 -      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} \
 +      ${MM_MAKE} DESTDIR=${TEMPROOT} ${ARCHSTRING} distrib-dirs &&
 +      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj ${MM_MAKE} ${ARCHSTRING} obj SUBDIR_OVERRIDE=etc &&
 +      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj ${MM_MAKE} ${ARCHSTRING} all SUBDIR_OVERRIDE=etc &&
 +      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj ${MM_MAKE} ${ARCHSTRING} \
  	  DESTDIR=${TEMPROOT} distribution;} ||
      { echo '';
       echo "  *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to";
 @@ -569,8 +599,8 @@ case "${RERUN}" in
    *)
      # Only set up files that are crucial to {build|install}world
      { mkdir -p ${TEMPROOT}/etc &&
 -      cp -p ${SOURCEDIR}/master.passwd ${TEMPROOT}/etc &&
 -      cp -p ${SOURCEDIR}/group ${TEMPROOT}/etc;} ||
 +      cp -p ${SOURCEDIR}/etc/master.passwd ${TEMPROOT}/etc &&
 +      cp -p ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} ||
      { echo '';
        echo '  *** FATAL ERROR: Cannot copy files to the temproot environment';
        echo '';
 @@ -599,17 +629,23 @@ case "${RERUN}" in
    esac
  
    # Avoid comparing the motd if the user specifies it in .mergemasterrc
 +  # Compatibility shim to be removed in FreeBSD 9.x
    case "${IGNORE_MOTD}" in
    '') ;;
 -  *) rm -f ${TEMPROOT}/etc/motd
 +  *) IGNORE_FILES="${IGNORE_FILES} /etc/motd"
 +     echo ''
 +     echo "*** You have the IGNORE_MOTD option set in your mergemaster rc file."
 +     echo "    This option is deprecated in favor of the IGNORE_FILES option."
 +     echo "    Please update your rc file accordingly."
 +     echo ''
 +     press_to_continue
       ;;
    esac
  
 -  # Avoid trying to update MAKEDEV if /dev is on a devfs
 -  if /sbin/sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
 -    rm -f ${TEMPROOT}/dev/MAKEDEV ${TEMPROOT}/dev/MAKEDEV.local
 -  fi
 -
 +  # Avoid comparing the following user specified files
 +  for file in ${IGNORE_FILES}; do
 +    test -e ${file} && unlink ${file}
 +  done
    ;; # End of the "RERUN" test
  esac
  
 @@ -626,9 +662,9 @@ find ${TEMPROOT}/usr/obj -type f -delete
  find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null
  
  # Build the mtree database in a temporary location.
 -# TODO: Possibly use mktemp instead for security reasons?
 +MTREENEW=`mktemp -t mergemaster.mtree`
  case "${PRE_WORLD}" in
 -'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${DESTDIR}${MTREEDB}.new 2>/dev/null
 +'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${DESTDIR}${MTREENEW} 2>/dev/null
      ;;
  *) # We don't want to mess with the mtree database on a pre-world run.
     ;;
 @@ -647,7 +683,7 @@ if [ -z "${NEW_UMASK}" -a -z "${AUTO_RUN
      echo ''
      echo " *** Your umask is currently set to ${USER_UMASK}.  By default, this script"
      echo "     installs all files with the same user, group and modes that"
 -    echo "     they are created with by ${SOURCEDIR}/Makefile, compared to"
 +    echo "     they are created with by ${SOURCEDIR}/etc/Makefile, compared to"
      echo "     a umask of 022.  This umask allows world read permission when"
      echo "     the file's default permissions have it."
      echo ''
 @@ -714,6 +750,12 @@ esac
  # Use the umask/mode information to install the files
  # Create directories as needed
  #
 +install_error () {
 +  echo "*** FATAL ERROR: Unable to install ${1} to ${2}"
 +  echo ''
 +  exit 1
 +}
 +
  do_install_and_rm () {
    case "${PRESERVE_FILES}" in
    [Yy][Ee][Ss])
 @@ -724,8 +766,15 @@ do_install_and_rm () {
      ;;
    esac
  
 -  install -m "${1}" "${2}" "${3}" &&
 -  rm -f "${2}"
 +  if [ ! -d "${3}/${2##*/}" ]; then
 +    if install -m ${1} ${2} ${3}; then
 +      unlink ${2}
 +    else
 +      install_error ${2} ${3}
 +    fi
 +  else
 +    install_error ${2} ${3}
 +  fi
  }
  
  # 4095 = "obase=10;ibase=8;07777" | bc
 @@ -828,11 +877,6 @@ mm_install () {
        ;;
      esac
    else	# File matched -x
 -    case "${1#.}" in
 -    /dev/MAKEDEV)
 -      NEED_MAKEDEV=yes
 -      ;;
 -    esac
      do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
    fi
    return $?
 @@ -904,7 +948,7 @@ if [ -r "${MM_PRE_COMPARE_SCRIPT}" ]; th
  fi
  
  # Using -size +0 avoids uselessly checking the empty log files created
 -# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does
 +# by ${SOURCEDIR}/etc/Makefile and the device entries in ./dev, but does
  # check the scripts in ./dev, as we'd like (assuming no devfs of course).
  #
  for COMPFILE in `find . -type f -size +0`; do
 @@ -986,9 +1030,10 @@ done # This is for the do way up there a
  echo ''
  echo "*** Comparison complete"
  
 -if [ -f "${DESTDIR}${MTREEDB}.new" ]; then
 +if [ -f "${DESTDIR}${MTREENEW}" ]; then
    echo "*** Saving mtree database for future upgrades"
 -  mv -f ${DESTDIR}${MTREEDB}.new ${DESTDIR}${MTREEDB} 2>/dev/null
 +  test -e "${MTREEFILE}" && unlink ${MTREEFILE}
 +  mv ${DESTDIR}${MTREENEW} ${DESTDIR}${MTREEFILE}
  fi
  
  echo ''
 @@ -1096,16 +1141,6 @@ run_it_now () {
    esac
  }
  
 -case "${NEED_MAKEDEV}" in
 -'') ;;
 -*)
 -  echo ''
 -  echo "*** You installed a new ${DESTDIR}/dev/MAKEDEV script, so make sure that you run"
 -  echo "    'cd ${DESTDIR}/dev && /bin/sh MAKEDEV all' to rebuild your devices"
 -  run_it_now "cd ${DESTDIR}/dev && /bin/sh MAKEDEV all"
 -  ;;
 -esac
 -
  case "${NEED_NEWALIASES}" in
  '') ;;
  *)
 @@ -1187,7 +1222,7 @@ esac
  case "${PRE_WORLD}" in
  '') ;;
  *)
 -  MAKE_CONF="${SOURCEDIR%etc}share/examples/etc/make.conf"
 +  MAKE_CONF="${SOURCEDIR}/share/examples/etc/make.conf"
  
    (echo ''
    echo '*** Comparing make variables'
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: dougb 
State-Changed-When: Thu Jan 1 12:11:43 UTC 2009 
State-Changed-Why:  

I added a slightly different implementation in r186678. I'll MFC 
it as soon as it is reasonable to do so. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122282 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/122282: commit references a PR
Date: Thu,  1 Jan 2009 12:10:13 +0000 (UTC)

 Author: dougb
 Date: Thu Jan  1 12:09:57 2009
 New Revision: 186679
 URL: http://svn.freebsd.org/changeset/base/186679
 
 Log:
   General Improvements
   ====================
   1. List the command line options in a more standard way
   2. Improve the explanations of some of the arguments (-A, -D)
   3. Add ARCHSTRING and MTREEDB to the example rc file
   4. Re-sort some of the examples according to the existing distinction
   of "has a command line version" vs. "does not have a command line version"
   
   Document changes for r186678
   ===========================
   1. /usr/src/etc -> /usr/src where needed [1]
   2. Add IGNORE_FILES to the example rc [2] (and remove IGNORE_MOTD)
   3. Update the EXIT STATUS section for [3] and [4]
   
   Update Copyright and .Dd accordingly
   
   PR:		bin/96528 [1]
   Submitted by:	ru [1]
   PR:		bin/106642 [2]
   Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
   PR:		bin/122282 [3]
   Submitted by:	Eygene Ryabinkin <rea-fbsd@codelabs.ru> [3]
   PR:		bin/108183 [4]
   Submitted by:	Riccardo Torrini <riccardo@torrini.org> [4]
 
 Modified:
   head/usr.sbin/mergemaster/mergemaster.8
 
 Modified: head/usr.sbin/mergemaster/mergemaster.8
 ==============================================================================
 --- head/usr.sbin/mergemaster/mergemaster.8	Thu Jan  1 11:41:13 2009	(r186678)
 +++ head/usr.sbin/mergemaster/mergemaster.8	Thu Jan  1 12:09:57 2009	(r186679)
 @@ -1,4 +1,4 @@
 -.\" Copyright (c) 1998-2003 Douglas Barton
 +.\" Copyright (c) 1998-2009 Douglas Barton
  .\" All rights reserved.
  .\"
  .\" Redistribution and use in source and binary forms, with or without
 @@ -24,7 +24,7 @@
  .\"
  .\" $FreeBSD$
  .\"
 -.Dd February 4, 2006
 +.Dd January 1, 2009
  .Dt MERGEMASTER 8
  .Os
  .Sh NAME
 @@ -32,14 +32,14 @@
  .Nd merge configuration files, et al during an upgrade
  .Sh SYNOPSIS
  .Nm
 -.Op Fl scrvahipCPU
 +.Op Fl achiprsvCPU
 +.Op Fl A Ar Target architecture
 +.Op Fl D Ar /destdir/path
  .Op Fl m Ar /path/to/sources
  .Op Fl t Ar /path/to/temp/root
  .Op Fl d
  .Op Fl u Ar N
  .Op Fl w Ar N
 -.Op Fl A Ar architecture
 -.Op Fl D Ar /path
  .Sh DESCRIPTION
  The
  .Nm
 @@ -54,7 +54,7 @@ recommended that you back up your
  directory before beginning this process.
  .Pp
  The script uses
 -.Pa /usr/src/etc/Makefile
 +.Pa /usr/src/Makefile
  to build a temporary root environment from
  .Pa /
  down, populating that environment with the various
 @@ -236,7 +236,7 @@ Supply an alternate screen width to the
  .Xr sdiff 1
  command in numbers of columns.
  The default is 80.
 -.It Fl A Ar architecture
 +.It Fl A Ar Target architecture
  Specify an alternative
  .Ev TARGET_ARCH
  architecture name.
 @@ -294,18 +294,24 @@ with all values commented out:
  # These are options for mergemaster, with their default values listed
  # The following options have command line overrides
  #
 +# The target architecture (unset by default)
 +#ARCHSTRING='TARGET_ARCH=<foo>'
 +#
 +# Sourcedir is the directory to do the 'make' in (where the new files are)
 +#SOURCEDIR='/usr/src'
 +#
  # Directory to install the temporary root environment into
  #TEMPROOT='/var/tmp/temproot'
  #
 +# Specify the destination directory for the installed files
 +#DESTDIR=
 +#
  # Strict comparison bypasses the CVS $Id tests and compares every file
  #STRICT=no
  #
  # Type of diff, such as unified, context, etc.
  #DIFF_FLAG='-u'
  #
 -# Additional options for diff.  This will get unset when using -s.
 -#DIFF_OPTIONS='-I$\&FreeBSD:.*[$]'	# Ignores CVS Id tags
 -#
  # Verbose mode includes more details and additional checks
  #VERBOSE=
  #
 @@ -322,25 +328,26 @@ with all values commented out:
  #PRESERVE_FILES=yes
  #PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
  #
 -# Sourcedir is the directory to do the 'make' in (where the new files are)
 -#SOURCEDIR='/usr/src/etc'
 -#
  # The umask for mergemaster to compare the default file's modes to
  #NEW_UMASK=022
  #
 -# Specify the destination directory for the installed files
 -#DESTDIR=
 -#
  # The following options have no command line overrides
 +#
 +# Files to always avoid comparing
 +#IGNORE_FILES='/etc/motd /etc/printcap foo bar'
 +#
 +# Additional options for diff.  This will get unset when using -s.
 +#DIFF_OPTIONS='-I$\&FreeBSD:.*[$]'	# Ignores CVS Id tags
 +#
 +# Location to store the list of mtree values for AUTO_UPGRADE purposes
 +#MTREEDB='/var/db'
 +#
  # For those who just cannot stand including the full path to PAGER
  #DONT_CHECK_PAGER=
  #
  # If you set 'yes' above, make sure to include the PATH to your pager
  #PATH=/bin:/usr/bin:/usr/sbin
  #
 -# Don't compare the old and new motd files
 -#IGNORE_MOTD=yes
 -#
  # Specify the path to scripts to run before the comparison starts,
  # and/or after the script has finished its work
  #MM_PRE_COMPARE_SCRIPT=
 @@ -357,6 +364,11 @@ Invalid command line option
  Failure to create the temporary root environment
  .Pp
  Failure to populate the temporary root
 +.Pp
 +Presence of the 'nodev' option in
 +.Pa <DESTDIR>/etc/fstab
 +.Pp
 +Failure to install a file
  .Sh EXAMPLES
  Typically all you will need to do is type
  .Nm
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: dougb@FreeBSD.org
Cc: bug-followup@freebsd.org
Subject: Re: bin/122282: [patch] mergemaster(8): check the presence of
	fstab's obsoleted 'nodev' option by mergemaster
Date: Fri, 2 Jan 2009 12:46:46 +0300

 Doug, good day.
 
 Thu, Jan 01, 2009 at 12:12:37PM +0000, dougb@FreeBSD.org wrote:
 > I added a slightly different implementation in r186678. I'll MFC
 > it as soon as it is reasonable to do so.
 
 Thanks for handling this.  However, it seems to be better to use
 more lengthy test for the option, as in the original submission
 (slightly modified variant that adds '-q' to grep and avoids
 redirection):
 -----
 sed -e'/^#/d' "${DESTDIR}/etc/fstab" | \
   awk -F '[[:space:]]+' '{ print $4; }' | \
   grep -qE '(^nodev$|^nodev,|,nodev,|,nodev$)'
 -----
 There are many reasons to do so: 'nodev' can be hanging in comments,
 in filesystem names, in NFS fileserver names or somewhere else.  So,
 one should check only 'Options' field, nothing else.  Am I missing
 something?
 -- 
 Eygene
  _                ___       _.--.   #
  \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
  /  ' `         ,       __.--'      #  to read the on-line manual
  )/' _/     \   `-_,   /            #  while single-stepping the kernel.
  `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
      _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
     {_.-``-'         {_/            #

From: Doug Barton <dougb@FreeBSD.org>
To: rea-fbsd@codelabs.ru
Cc: bug-followup@freebsd.org
Subject: Re: bin/122282: [patch] mergemaster(8): check the presence of	fstab's
 obsoleted 'nodev' option by mergemaster
Date: Fri, 02 Jan 2009 13:52:48 -0800

 Eygene Ryabinkin wrote:
 > Doug, good day.
 > 
 > Thu, Jan 01, 2009 at 12:12:37PM +0000, dougb@FreeBSD.org wrote:
 >> I added a slightly different implementation in r186678. I'll MFC
 >> it as soon as it is reasonable to do so.
 > 
 > Thanks for handling this.  However, it seems to be better to use
 > more lengthy test for the option, as in the original submission
 > (slightly modified variant that adds '-q' to grep and avoids
 > redirection):
 
 The current version has -q. I did the way I did purposely, for one to
 make the test simpler since for most users it's going to run every
 time. The other reason is that even if it's in a commented out line I
 still want to warn users about it so that they don't uncomment that
 line and expect it to work.
 
 If we hit a rash of problems with this I'll revisit it, but I'd rather
 make it simple to start with.
 
 Doug
 
 -- 
 
     This .signature sanitized for your protection
 
State-Changed-From-To: patched->closed 
State-Changed-By: dougb 
State-Changed-When: Fri Jan 9 11:26:59 UTC 2009 
State-Changed-Why:  

This change is now MFC'ed through RELENG_6 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122282 
>Unformatted:
