misc/143084: rc.d/jail creates stray softlinks

Dirk Engling erdgeist at erdgeist.org
Fri Jan 22 14:50:01 UTC 2010


>Number:         143084
>Category:       misc
>Synopsis:       rc.d/jail creates stray softlinks
>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:   Fri Jan 22 14:50:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Dirk Engling
>Release:        FreeBSD 8.0 RELEASE
>Organization:
>Environment:
FreeBSD ruprecht.local 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009     root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
While debugging a stray softlink

  "log" => "../var/run/log"

in ezjail's config directory I found the following code in

/etc/rc.d/jail:593

# Transitional symlink for old binaries
if [ ! -L "${_devdir}/log" ]; then
    __pwd="`pwd`"
    cd "${_devdir}"
    ln -sf ../var/run/log log
    cd "$__pwd"
fi

First, I wonder, why the whole block is not just a

  ln -s ../var/run/log "${_devdir}/log"

Secondly I wonder why the code above does not check for errors and just skips this part if it can't mount devfs, why the code does not check return code of the 'cd "${_devdir}' command.
>How-To-Repeat:

>Fix:
--- jail	2009-11-21 15:31:36.000000000 +0100
+++ /home/erdgeist/jail	2010-01-22 15:39:49.776129991 +0100
@@ -591,12 +591,7 @@
 				info "Mounting devfs on ${_devdir}"
 				devfs_mount_jail "${_devdir}" ${_ruleset}
 				# Transitional symlink for old binaries
-				if [ ! -L "${_devdir}/log" ]; then
-					__pwd="`pwd`"
-					cd "${_devdir}"
-					ln -sf ../var/run/log log
-					cd "$__pwd"
-				fi
+				ln -sf ../var/run/log "${_devdir}/log"
 			fi
 
 			# XXX - It seems symlinks don't work when there


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list