From admin@omnilan.de  Thu Sep 12 11:10:53 2013
Return-Path: <admin@omnilan.de>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id AF680C46
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Sep 2013 11:10:53 +0000 (UTC)
	(envelope-from admin@omnilan.de)
Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 2BD3E2970
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Sep 2013 11:10:53 +0000 (UTC)
Received: from mailhub.inop.wdn.omnilan.net (cale.wdn.omnilan.net [IPv6:2001:a60:f0bb:1::2:2])
	by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id r8CB9xDV029272
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Sep 2013 13:10:04 +0200 (CEST)
	(envelope-from admin@preed.labshop.wdn.omnilan.net)
Received: from preed.labshop.wdn.omnilan.net (preed.labshop.wdn.omnilan.net [172.21.35.1])
	by mailhub.inop.wdn.omnilan.net (8.14.5/8.14.5) with ESMTP id r8CBAboW059670
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Sep 2013 13:10:37 +0200 (CEST)
	(envelope-from admin@preed.labshop.wdn.omnilan.net)
Received: (from admin@localhost)
	by preed.labshop.wdn.omnilan.net (8.14.7/8.14.7/Submit) id r8CBAW0f034660;
	Thu, 12 Sep 2013 13:10:32 +0200 (CEST)
	(envelope-from admin)
Message-Id: <201309121110.r8CBAW0f034660@preed.labshop.wdn.omnilan.net>
Date: Thu, 12 Sep 2013 13:10:32 +0200 (CEST)
From: Harald Schmalzbauer <freebsd@omnilan.de>
Reply-To:
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /etc/rc.d/tmp can't create tmpmfs on root-mfs
X-Send-Pr-Version: 3.114
X-GNATS-Notify:

>Number:         182035
>Category:       misc
>Synopsis:       /etc/rc.d/tmp can't create tmpmfs on root-mfs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    hrs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 12 11:20:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Thu Sep 12 11:30:10 UTC 2013
>Originator:     Harald Schmalzbauer
>Release:        FreeBSD 9.2-RC1 amd64
>Organization:
OmniLAN
>Environment:
System: FreeBSD preed.labshop.wdn.omnilan.net 9.2-RC1 FreeBSD 9.2-RC1 #0 r254055: Wed Aug 7 17:18:19 CEST 2013 admin@preed.labshop.wdn.omnilan.net:/usr/local/share/deploy-tools/obj-amd64/usr/local/share/deploy-tools/RELENG_9_2/src/sys/GENERIC amd64


	
>Description:
	On startup, /etc/rc.d/tmp checks if /tmp is writable, and if not,
creates a memory-disk filesystem for /tmp.
Before actually creating, there's an additional check to see if /tmp is
already a memory-disk, which returns false positive, if the
root filesystem is a memory-disk!
>How-To-Repeat:
	Boot any setup with root_mfs read-only, and leave tmpmfs="AUTO".
/etc/rc.d/tmp will recognize that /tmp is not writable, but refuses to create
the memorydisk, because 'df' with '/tmp'  and 'md[0-9]' as regex returns
false positive.
>Fix:

--- src/etc/rc.d/tmp.orig	2013-09-11 20:43:25.000000000 +0200
+++ src/etc/rc.d/tmp	2013-09-11 20:48:46.000000000 +0200
@@ -39,7 +39,7 @@
 
 mount_tmpmfs ()
 {
-	if ! /bin/df /tmp | grep -q "^/dev/md[0-9]"; then
+	if ! /sbin/mount | grep -q "^/dev/md[0-9].\+/tmp[[:blank:]]"; then
 		mount_md ${tmpsize} /tmp "${tmpmfs_flags}"
 		chmod 01777 /tmp
 	fi


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->hrs 
Responsible-Changed-By: hrs 
Responsible-Changed-When: Thu Sep 12 11:29:50 UTC 2013 
Responsible-Changed-Why:  
I'll take this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=182035 
>Unformatted:
 freebsd-bugs
