bin/59768: patch: devfs_link in rc.subr creates link in wrong directory

Josh Elsasser jre at vineyard.net
Fri Nov 28 11:20:18 PST 2003


>Number:         59768
>Category:       bin
>Synopsis:       patch: devfs_link in rc.subr creates link in wrong directory
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 28 11:20:13 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Josh Elsasser
>Release:        FreeBSD 5.2-BETA i386
>Organization:
>Environment:
System: FreeBSD jade.elsasser.org 5.2-BETA FreeBSD 5.2-BETA #5: Thu Nov 27 00:40:17 EST 2003 joshe at jade.elsasser.org:/usr/local/obj/usr/src/sys/JADE i386


	
>Description:
	The devfs_link function in /etc/rc.subr ignores it's "dir"
argument and instead creates the symlink in ${chroot}/dev.  Note that
if jail_enable="YES" and jail_foo_devfs_enable="YES" in /etc/rc.conf,
this bug will cause /etc/rc.d/jail to trash /dev/console.

>How-To-Repeat:
	Configure a jail in /etc/rc.conf and watch /dev/console disappear:
jail_enable="YES"
jail_list="foo"
jail_foo_rootdir="/foo"
jail_foo_hostname="foo"
jail_foo_ip="192.168.0.2"
jail_foo_exec="/bin/sh /etc/rc"
jail_foo_devfs_enable="YES"

>Fix:

diff -u /etc/rc.subr.orig /etc/rc.subr
--- /etc/rc.subr.orig	Fri Sep  5 16:54:29 2003
+++ /etc/rc.subr	Fri Nov 28 13:50:32 2003
@@ -1058,7 +1058,7 @@
 		warn "$_me: the directory ($dir) does not exist"
 		return 1
 	fi
-	cd ${chroot}/dev
+	cd "$dir"
 	if ! ln -sf $src $link ; then
 		warn "$_me: unable to link $link --> $src in $dir"
 		return 1
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list