From nobody@FreeBSD.ORG Wed Oct 13 02:41:35 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 2FE0714BC8; Wed, 13 Oct 1999 02:41:35 -0700 (PDT)
Message-Id: <19991013094135.2FE0714BC8@hub.freebsd.org>
Date: Wed, 13 Oct 1999 02:41:35 -0700 (PDT)
From: cemerson+freebsd@chiark.greenend.org.uk
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: MAKEDEV requires /usr to be mounted (for chown(1))
X-Send-Pr-Version: www-1.0

>Number:         14300
>Category:       misc
>Synopsis:       MAKEDEV requires /usr to be mounted (for chown(1))
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 13 02:50:00 PDT 1999
>Closed-Date:    Thu Jan 6 09:48:44 PST 2000
>Last-Modified:  Thu Jan  6 09:51:54 PST 2000
>Originator:     Chris Emerson
>Release:        3.3
>Organization:
>Environment:
FreeBSD test 3.3-19990918-STABLE FreeBSD 3.3-19990918-STABLE #0: Sat Sep 18 10:21:02 GMT1999 root@usw3.freebsd.org:/usr/src/sys/compile/GENERIC i386

>Description:
MAKEDEV fails to create devices, even with wrong ownerships, when /usr
is not mounted because chown(1) is not available.  This makes recovery
when the device node for /usr (or other filesystems) is missing harder.
>How-To-Repeat:
# umount /usr
# cd /dev
# ./MAKEDEV wd1s1a
wd1s1[a-h] will be removed, and not recreated as MAKEDEV bombs out when
chown(1) fails to run.  A manual mknod is required.
>Fix:
(a) move chown(1) to /bin or /sbin
or
(b) cause MAKEDEV to at least create the nodes (with conservative
permissions) before bombing out.

>Release-Note:
>Audit-Trail:

From: Nick Hibma <nick.hibma@jrc.it>
To: cemerson+freebsd@chiark.greenend.org.uk
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/14300: MAKEDEV requires /usr to be mounted (for chown(1))
Date: Wed, 13 Oct 1999 13:19:21 +0200 (MET DST)

  > # ./MAKEDEV wd1s1a
  > wd1s1[a-h] will be removed, and not recreated as MAKEDEV bombs out when
  > chown(1) fails to run.  A manual mknod is required.
  > >Fix:
  > (a) move chown(1) to /bin or /sbin
  > or
  > (b) cause MAKEDEV to at least create the nodes (with conservative
  > permissions) before bombing out.
 
 (b) sounds like a worthwhile idea, if (a) is not an option.
 
 The diff below contains one line wrapping in line 4.
 
 --- MAKEDEV.orig        Tue Oct 12 23:41:23 1999
 +++ MAKEDEV     Wed Oct 13 13:17:35 1999
 @@ -174,6 +174,14 @@
         echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 |
 $4))
  }
  
 +chown() {
 +        if [ -x /usr/sbin/chown ]; then
 +                /usr/sbin/chown "$@"
 +        else
 +                echo skipped /usr/sbin/chown "$@", not found.
 +        fi
 +}
 +
  # Override mknod(2) to add extra handling to it.
  mknod() {
         rm -f "$1" || exit 1
 
 
 -- 
 ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
 
 
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: phantom 
Responsible-Changed-When: Tue Dec 21 09:43:29 PST 1999 
Responsible-Changed-Why:  
David is working on this problem 
State-Changed-From-To: open->closed 
State-Changed-By: obrien 
State-Changed-When: Thu Jan 6 09:48:44 PST 2000 
State-Changed-Why:  
Fixed.  Thanks! 
>Unformatted:
