Skip site navigation (1)Skip section navigation (2)
Date:      23 Oct 1998 12:38:14 +1000
From:      john@nlc.net.au
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   i386/8418: sh MAKEDEV all - fails to create hard links properly
Message-ID:  <19981023023814.19720.qmail@monster.nlc.net.au>

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

>Number:         8418
>Category:       i386
>Synopsis:       sh MAKEDEV all - fails to create hard links properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 22 19:40:00 PDT 1998
>Last-Modified:
>Originator:     John Saunders
>Organization:
NORTHLINK COMMUNICATIONS
>Release:        FreeBSD 2.2.7-STABLE i386
>Environment:

	FreeBSD 2.2.7-STABLE cvsupped October 12th. Problem appeared
	in the process of finalizing a make world by re-running
	sh MAKEDEV all in /dev.

>Description:

	For the following MAKEDEV targets; fd, ft and st; MAKEDEV
	tries to make a hard link for several names to the one
	device node. However because an old version of the name
	exists, and the -f option isn't supplied, the link fails.
	This leaves the alternative names linked to an old device
	node. In the case that the major or minor device number
	changes for these devices, this will cause incorrect
	system operation.

>How-To-Repeat:

	In the /dev directory run "sh MAKEDEV fd0", then "ls -l fd0*".
	The device nodes fd0, fd0a, fd0b, ... fd0h should be all linked
	to the same device node (2,0). There should be a link count
	of 9. However with the bug fd0 gets re-created and fd0a ...
	fd0h are orphaned because the hard link fails. (link count is
	8 on fd0a ... fd0h, and 1 on fd0).

>Fix:
	
	The link problem exists for the fd, ft and st devices. The following
	patch corrects the problem. The patch is against this version.

	$Id: MAKEDEV,v 1.127.2.20 1998/07/06 10:59:17 des Exp $

--- /usr/src/etc/etc.i386/MAKEDEV.orig	Mon Oct 12 16:57:47 1998
+++ /usr/src/etc/etc.i386/MAKEDEV	Fri Oct 23 02:59:42 1998
@@ -342,8 +342,8 @@
 		# Fake BSD partitions
 		for i in a b c d e f g h
 		do
-			ln ${name}${unit} ${name}${unit}$i
-			ln r${name}${unit} r${name}${unit}$i
+			ln -f ${name}${unit} ${name}${unit}$i
+			ln -f r${name}${unit} r${name}${unit}$i
 		done
 		# User-readable and programmer-readable name sets
 
@@ -422,8 +422,8 @@
 	0|1|2|3)
 		mknod ${name}${unit}   b $blk `expr $unit '*' 64 + 32`
 		mknod r${name}${unit}  c $chr `expr $unit '*' 64 + 32`
-		ln ${name}${unit} ${name}${unit}a
-		ln r${name}${unit} r${name}${unit}a
+		ln -f ${name}${unit} ${name}${unit}a
+		ln -f r${name}${unit} r${name}${unit}a
 		chgrp operator ${name}${unit}* r${name}${unit}*
 		;;
 	*)
@@ -586,9 +586,9 @@
 		mknod rst${unit}.ctl c $chr `expr $unit '*' 16 + $scsictl `
 		chmod 600 rst${unit}.ctl
 
-		ln rst${unit}.0 rst${unit}
-		ln nrst${unit}.0 nrst${unit}
-		ln erst${unit}.0 erst${unit}
+		ln -f rst${unit}.0 rst${unit}
+		ln -f nrst${unit}.0 nrst${unit}
+		ln -f erst${unit}.0 erst${unit}
 		;;
 	*)
 		echo bad unit for tape in: $i

>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?19981023023814.19720.qmail>