From nobody@FreeBSD.org  Thu Nov  8 20:27:59 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 56A6D176
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  8 Nov 2012 20:27:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FAD48FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  8 Nov 2012 20:27:59 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qA8KRwDZ063261
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 8 Nov 2012 20:27:58 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qA8KRwYl063260;
	Thu, 8 Nov 2012 20:27:58 GMT
	(envelope-from nobody)
Message-Id: <201211082027.qA8KRwYl063260@red.freebsd.org>
Date: Thu, 8 Nov 2012 20:27:58 GMT
From: Nick Hibma <nick@anywi.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NanoBSD initialises /cfg incorrectly (wrong permissions)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173483
>Category:       misc
>Synopsis:       [nanobsd] [patch] NanoBSD initialises /cfg incorrectly (wrong permissions)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 08 20:30:01 UTC 2012
>Closed-Date:    Sun Apr 28 21:45:54 UTC 2013
>Last-Modified:  Sun Apr 28 21:50:00 UTC 2013
>Originator:     Nick Hibma
>Release:        8.3-RELEASE
>Organization:
AnyWi Technologies
>Environment:
System: FreeBSD bitske2.localdomain 8.3-RELEASE FreeBSD 8.3-RELEASE #0 r242660: Tue Nov 6 16:23:23 CET 2012 root@bitske2.localdomain:/usr/obj/usr/src/sys/GENERIC i386
>Description:
/cfg is initialised from /var/empty in NANO_CFGDIR is unset. This also copies
the 0555 permissions from this dir to /cfg.
>How-To-Repeat:
Build an image using NanoBSD with NANO_CFGDIR="" .
>Fix:
Index: nanobsd.sh
===================================================================
--- nanobsd.sh	(revision 12226)
+++ nanobsd.sh	(working copy)
@@ -413,12 +413,13 @@
 	dir=$2
 	mnt=$3
 	lbl=$4
-	test -z $2 && dir=${NANO_WORLDDIR}/var/empty
-	test -d $dir || dir=${NANO_WORLDDIR}/var/empty
-	echo "Creating ${dev} with ${dir} (mounting on ${mnt})"
-	newfs_part $dev $mnt $lbl
-	cd ${dir}
-	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt}
+	echo "Creating ${dev} (mounting on ${mnt})"
+	newfs_part ${dev} ${mnt} ${lbl}
+	if [ -n "${dir}" -a -d "${dir}" ]; then
+		echo "Populating ${lbl} from ${dir}"
+		cd ${dir}
+		find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt}
+	fi
 	df -i ${mnt}
 	umount ${mnt}
 )

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->imp 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Nov 8 23:40:00 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173483 
State-Changed-From-To: open->closed 
State-Changed-By: n_hibma 
State-Changed-When: Sun Apr 28 21:45:27 UTC 2013 
State-Changed-Why:  
Patch has been committed in revision 250034 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173483 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/173483: commit references a PR
Date: Sun, 28 Apr 2013 21:44:52 +0000 (UTC)

 Author: n_hibma
 Date: Sun Apr 28 21:44:44 2013
 New Revision: 250034
 URL: http://svnweb.freebsd.org/changeset/base/250034
 
 Log:
   Doing a cpio from /var/empty if dir was not specified or non-existent
   copies its mode to the destination. This is not desirable.
   Rephrase this code to be more sensible.
   
   PR:		173483
   MFC after:	1 week
 
 Modified:
   head/tools/tools/nanobsd/nanobsd.sh
 
 Modified: head/tools/tools/nanobsd/nanobsd.sh
 ==============================================================================
 --- head/tools/tools/nanobsd/nanobsd.sh	Sun Apr 28 21:14:23 2013	(r250033)
 +++ head/tools/tools/nanobsd/nanobsd.sh	Sun Apr 28 21:44:44 2013	(r250034)
 @@ -413,12 +413,13 @@ populate_slice ( ) (
  	dir=$2
  	mnt=$3
  	lbl=$4
 -	test -z $2 && dir=${NANO_WORLDDIR}/var/empty
 -	test -d $dir || dir=${NANO_WORLDDIR}/var/empty
 -	echo "Creating ${dev} with ${dir} (mounting on ${mnt})"
 -	newfs_part $dev $mnt $lbl
 -	cd ${dir}
 -	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt}
 +	echo "Creating ${dev} (mounting on ${mnt})"
 +	newfs_part ${dev} ${mnt} ${lbl}
 +	if [ -n "${dir}" -a -d "${dir}" ]; then
 +		echo "Populating ${lbl} from ${dir}"
 +		cd ${dir}
 +		find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt}
 +	fi
  	df -i ${mnt}
  	umount ${mnt}
  )
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
