Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2010 14:40:37 GMT
From:      Dirk Engling <erdgeist@erdgeist.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/143084: rc.d/jail creates stray softlinks
Message-ID:  <201001221440.o0MEebSt058718@www.freebsd.org>
Resent-Message-ID: <201001221450.o0MEo0pI053456@freefall.freebsd.org>

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

>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@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:



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