From grog@lemis.com  Sat Sep 21 17:29:20 2002
Return-Path: <grog@lemis.com>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7D90837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Sep 2002 17:29:20 -0700 (PDT)
Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 08D1143E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Sep 2002 17:29:19 -0700 (PDT)
	(envelope-from grog@lemis.com)
Received: by wantadilla.lemis.com (Postfix, from userid 1004)
	id ABAB48130F; Sun, 22 Sep 2002 09:59:16 +0930 (CST)
Message-Id: <20020922002916.ABAB48130F@wantadilla.lemis.com>
Date: Sun, 22 Sep 2002 09:59:16 +0930 (CST)
From: Greg 'groggy' Lehey <grog@lemis.com>
Reply-To: Greg 'groggy' Lehey <grog@lemis.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: mergemaster does not handle missing /etc correctly
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         43214
>Category:       bin
>Synopsis:       mergemaster does not handle missing /etc correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 21 17:30:02 PDT 2002
>Closed-Date:    Mon Sep 30 11:23:29 PDT 2002
>Last-Modified:  Mon Sep 30 11:23:29 PDT 2002
>Originator:     Greg 'groggy' Lehey
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
LEMIS (SA) Pty Ltd
>Environment:
System: FreeBSD wantadilla.lemis.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Dec 31 19:08:24 CST 2001 grog@monorchid.lemis.com:/src/FreeBSD/5-CURRENT-MONORCHID/src/sys/i386/compile/MONORCHID i386


>Description:

	If mergemaster is run with a non-existent or empty /etc
	directory, it does not do anything useful.  It would be hoped
	that this method could be used to install a virgin /etc
	directory.

  # mergemaster -p -a
  
  *** The directory specified for the temporary root environment,
      /var/tmp/temproot, exists.  This can be a security risk if untrusted
      users have access to the system.
  
  *** Creating the temporary root environment in /var/tmp/temproot.0922.00.20.04
   *** /var/tmp/temproot.0922.00.20.04 ready for use
   *** Creating and populating directory structure in /var/tmp/temproot.0922.00.20.04
  
  
  *** Beginning comparison
  
     *** ./etc/master.passwd will remain for your consideration
     *** ./etc/group will remain for your consideration
  
  *** Comparison complete
  
  *** Files that remain for you to merge by hand:
  /var/tmp/temproot.0922.00.20.04/etc/master.passwd
  /var/tmp/temproot.0922.00.20.04/etc/group
  
  
  grep: /etc/make.conf: No such file or directory
  
  *** Comparing make variables
  
  *** From /etc/make.conf
  *** From /usr/src/share/examples/etc/make.conf

In this case, it returns a condition code 0.

  # ls -l /etc
  ls: /etc: No such file or directory
  # mergemaster -i -a
  
  *** The directory specified for the temporary root environment,
      /var/tmp/temproot, exists.  This can be a security risk if untrusted
      users have access to the system.
  
  *** Creating the temporary root environment in /var/tmp/temproot.0922.00.20.47
   *** /var/tmp/temproot.0922.00.20.47 ready for use
   *** Creating and populating directory structure in /var/tmp/temproot.0922.00.20.47
  
  set - `grep "^[a-zA-Z]" /src/FreeBSD/5-CURRENT-WANTADILLA/src/etc/locale.deprecated`;  while [ $# -gt 0 ] ;  do  for dir in /usr/share/locale  /usr/share/nls  /usr/local/share/nls;  do  test -d /var/tmp/temproot.0922.00.20.47/${dir} && cd /var/tmp/temproot.0922.00.20.47/${dir};  test -L "$2" && rm -rf "$2";  test \! -L "$1" && test -d "$1" && mv "$1" "$2";  done;  shift; shift;  done
  mtree -deU  -f /src/FreeBSD/5-CURRENT-WANTADILLA/src/etc/mtree/BSD.root.dist -p /var/tmp/temproot.0922.00.20.47/
  mtree: line 6: unknown user root
  *** Error code 1
  
  Stop in /src/FreeBSD/5-CURRENT-WANTADILLA/src/etc.
  
    *** FATAL ERROR: Cannot 'cd' to /usr/src/etc and install files to
        the temproot environment


>How-To-Repeat:
	As above
>Fix:

	It's probably not worth fixing this bug in isolation.  The
	real issue here is the difficulty of installing /etc at all.
	The only way I know is via a release CD-ROM.  It shouldn't be
	that difficult: it should be part of the base installworld
	target.  Consider this PR a flag to be closed when a good
	solution has been found.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: johan 
Responsible-Changed-When: Sun Sep 29 06:45:52 PDT 2002 
Responsible-Changed-Why:  
Over to mergemaster maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43214 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Mon Sep 30 11:21:49 PDT 2002 
State-Changed-Why:  

mergemaster -a -D/ 
should do the trick, although I haven't tested it (for obvious reasons). 


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