Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Nov 1998 23:25:51 -0600 (CST)
From:      Joel Ray Holveck <detlev!joelh@FreeBSD.ORG>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   i386/8598: MAKEDEV fails if not run from current directory [patch]
Message-ID:  <86lnlmrbiv.fsf@detlev.UUCP>

next in thread | raw e-mail | index | archive | help

>Number:         8598
>Category:       i386
>Synopsis:       MAKEDEV fails if not run from current directory [patch]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov  7 21:40:00 PST 1998
>Last-Modified:
>Originator:     Joel Ray Holveck
>Organization:
none
>Release:        FreeBSD 3.0-BETA i386
>Environment:

i386 -current

>Description:

MAKEDEV frequently will call itself recursively using 'sh MAKEDEV'.
This causes the script to fail if it is called from a different
directory than where it resides.  If, for instance, a dev directory
from a disk not meant to hold MAKEDEV is created, and MAKEDEV is
called from that directory, it will fail.  As another data point, on
-current, in message ID (Terry, hush unless you know of a better way
to uniquely search for a message)
<Pine.BSF.4.05.9811080026310.8500-100000@gina.swimsuit.internet.dk>,
-current user Leif Neland <root@swimsuit.internet.dk> had attempted to
run MAKEDEV from the src directory while in /dev (the two were not in
sync), and was perplexed by the error messages when the current
MAKEDEV called the old MAKEDEV to generate devices that were not
present in the old MAKEDEV.

>How-To-Repeat:

detlev# mount /dev/fd0 /mnt
detlev# mkdir /mnt/dev
detlev# cd /mnt/dev
detlev# /dev/MAKEDEV all
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
MAKEDEV: Can't open MAKEDEV
detlev# 

See also the aforereferenced article.

>Fix:

I propose to change all instances of "sh MAKEDEV" to "sh $0".  Simple
tests indicate correct functionality.

The call "MAKEDEV local" causes me concern.  I settled for calling
/dev/MAKEDEV.local no matter what directory MAKEDEV was called from.

----- cut here -----
*** MAKEDEV.orig	Sat Nov  7 22:44:40 1998
--- MAKEDEV	Sat Nov  7 23:24:12 1998
***************
*** 188,210 ****
  
  all)
! 	sh MAKEDEV std					# standard
! 	sh MAKEDEV fd0 fd1				# bdev, floppy disk
! 	sh MAKEDEV da0 da1 da2 da3 wd0 wd1 wd2 wd3	# bdev, ordinary disk
! 	sh MAKEDEV od0					# bdev, optical disk
! 	sh MAKEDEV wfd0					# bdev, LS-120 floppy
! 	sh MAKEDEV vn0					# bdev, virtual disk
! 	sh MAKEDEV cd0 matcd0 mcd0 scd0 wcd0		# bdev, cdrom
! 	sh MAKEDEV ft0 sa0 wt0 wst0			# bdev, tape
! 	sh MAKEDEV vty4					# cdev, virtual tty
! 	sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3		# cdev, serial tty
! 	sh MAKEDEV pty0					# cdev, pseudo tty
! 	sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3		# cdev, serial tty
! 	sh MAKEDEV mse0 psm0 sysmouse			# cdev, mouse
! 	sh MAKEDEV pcaudio speaker			# cdev, noise
! 	sh MAKEDEV lpt0 lpt1 lpt2			# cdev, printer
! 	sh MAKEDEV bpf0 ipl tun0			# cdev, network
! 	sh MAKEDEV ch0 perfmon tw0			# cdev, miscellaneous
! 	sh MAKEDEV apm card0 card1			# cdev, laptop
! 	sh MAKEDEV pass4 xpt2				# cdev, CAM
  	;;
  std)
--- 188,210 ----
  
  all)
! 	sh $0 std				# standard
! 	sh $0 fd0 fd1				# bdev, floppy disk
! 	sh $0 da0 da1 da2 da3 wd0 wd1 wd2 wd3	# bdev, ordinary disk
! 	sh $0 od0				# bdev, optical disk
! 	sh $0 wfd0				# bdev, LS-120 floppy
! 	sh $0 vn0				# bdev, virtual disk
! 	sh $0 cd0 matcd0 mcd0 scd0 wcd0		# bdev, cdrom
! 	sh $0 ft0 sa0 wt0 wst0			# bdev, tape
! 	sh $0 vty4				# cdev, virtual tty
! 	sh $0 cuaa0 cuaa1 cuaa2 cuaa3		# cdev, serial tty
! 	sh $0 pty0				# cdev, pseudo tty
! 	sh $0 ttyd0 ttyd1 ttyd2 ttyd3		# cdev, serial tty
! 	sh $0 mse0 psm0 sysmouse		# cdev, mouse
! 	sh $0 pcaudio speaker			# cdev, noise
! 	sh $0 lpt0 lpt1 lpt2			# cdev, printer
! 	sh $0 bpf0 ipl tun0			# cdev, network
! 	sh $0 ch0 perfmon tw0			# cdev, miscellaneous
! 	sh $0 apm card0 card1			# cdev, laptop
! 	sh $0 pass4 xpt2			# cdev, CAM
  	;;
  std)
***************
*** 460,464 ****
  		for slicepartname in s0h s1 s2 s3 s4
  		do
! 			sh MAKEDEV $name$unit$slicepartname
  		done
  		;;
--- 460,464 ----
  		for slicepartname in s0h s1 s2 s3 s4
  		do
! 			sh $0 $name$unit$slicepartname
  		done
  		;;
***************
*** 1031,1035 ****
  	name=`expr $i : 'mouse\(.*\)'`
  	if [ ! -c $name ]; then
! 		$0 $name			# make the appropriate device
  	fi
  	ln -fs $name mouse
--- 1031,1035 ----
  	name=`expr $i : 'mouse\(.*\)'`
  	if [ ! -c $name ]; then
! 		sh $0 $name			# make the appropriate device
  	fi
  	ln -fs $name mouse
***************
*** 1244,1248 ****
  local)
  	umask 0			# XXX should be elsewhere
! 	sh MAKEDEV.local
  	umask 77
  	;;
--- 1244,1248 ----
  local)
  	umask 0			# XXX should be elsewhere
! 	sh /dev/MAKEDEV.local
  	umask 77
  	;;
----- cut here -----

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lnlmrbiv.fsf>