From lev@ftp.translate.ru  Sun Oct 24 18:37:44 2010
Return-Path: <lev@ftp.translate.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3FECA106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Oct 2010 18:37:44 +0000 (UTC)
	(envelope-from lev@ftp.translate.ru)
Received: from ftp.translate.ru (ftp.translate.ru [80.249.188.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 014508FC08
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Oct 2010 18:37:43 +0000 (UTC)
Received: by ftp.translate.ru (Postfix, from userid 1000)
	id 15D5413DF48; Sun, 24 Oct 2010 22:37:43 +0400 (MSD)
Message-Id: <20101024183743.15D5413DF48@ftp.translate.ru>
Date: Sun, 24 Oct 2010 22:37:43 +0400 (MSD)
From: Lev Serebryakov <lev@FreeBSD.org>
Reply-To: Lev Serebryakov <lev@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [nanobsd] [patch] nanobsd.sh copy links to packages as links to chrooted environment
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         151697
>Category:       misc
>Synopsis:       [nanobsd] [patch] nanobsd.sh copy links to packages as links to chrooted environment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 24 18:40:10 UTC 2010
>Closed-Date:    Thu Mar 13 22:17:12 MDT 2014
>Last-Modified:  Thu Mar 13 22:17:12 MDT 2014
>Originator:     Lev Serebryakov
>Release:        FreeBSD 8.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD vmware-8-32.home.serebryakov.spb.ru 8.1-STABLE FreeBSD 8.1-STABLE #1: Wed Oct 20 18:55:10 MSD 2010 root@vmware-8-32.home.serebryakov.spb.ru:/usr/obj/usr/src/sys/GENERIC i386

>Description:

  "cust_pkg" function in nanobsd.sh script copy all packages from configured directory to nanobsd world ands chroot to this world dir.
  It uses "cpio" with options, whcih istructs cpio to copy symlinks as symlinks.
  Typical way to populate package directory is fill_pkg.sh script, whcih populates Pkg directory with symlinks.
  cust_pkg copies these links, and after chroot all symlinks becomes invalid.
  This patch adds "-L" option to "cpio" call to copy real files, not symlinks, to chroot environment.

>How-To-Repeat:

  Populate "nanobsd/Pkg" directory with help from fill_pkg.sh, try to install these packages via "customize_cmd cust_pkg" command in nanobsd.sh config file.

>Fix:
--- nanobsd.sh.orig	2010-10-24 22:20:07.000000000 +0400
+++ nanobsd.sh.bugfix.pkg	2010-10-24 22:15:56.000000000 +0400
@@ -641,7 +641,7 @@
 	(
 		cd ${NANO_PACKAGE_DIR}
 		find ${NANO_PACKAGE_LIST} -print |
-		    cpio -dumpv ${NANO_WORLDDIR}/Pkg
+		    cpio -Ldumpv ${NANO_WORLDDIR}/Pkg
 	)
 
 	# Count & report how many we have to install
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-embedded 
Responsible-Changed-By: lev 
Responsible-Changed-When: Sun Oct 24 18:46:01 UTC 2010 
Responsible-Changed-Why:  

Over to maintainer(s). 


http://www.freebsd.org/cgi/query-pr.cgi?pr=151697 
Responsible-Changed-From-To: freebsd-embedded->imp 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Nov 20 11:55:16 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/151697: commit references a PR
Date: Fri, 13 May 2011 18:28:35 +0000 (UTC)

 Author: imp
 Date: Fri May 13 18:28:25 2011
 New Revision: 221850
 URL: http://svn.freebsd.org/changeset/base/221850
 
 Log:
   Copy symbolic links as files rather than recreating the links.
   
   PR:		misc/151697
   Submitted by:	lev@
   MFC after:	2 weeks
 
 Modified:
   head/tools/tools/nanobsd/nanobsd.sh
 
 Modified: head/tools/tools/nanobsd/nanobsd.sh
 ==============================================================================
 --- head/tools/tools/nanobsd/nanobsd.sh	Fri May 13 18:20:24 2011	(r221849)
 +++ head/tools/tools/nanobsd/nanobsd.sh	Fri May 13 18:28:25 2011	(r221850)
 @@ -418,7 +418,7 @@ populate_slice ( ) (
  	echo "Creating ${dev} with ${dir} (mounting on ${mnt})"
  	newfs_part $dev $mnt $lbl
  	cd ${dir}
 -	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt}
 +	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${mnt}
  	df -i ${mnt}
  	umount ${mnt}
  )
 @@ -674,7 +674,7 @@ cust_allow_ssh_root () (
  
  cust_install_files () (
  	cd ${NANO_TOOLS}/Files
 -	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR}
 +	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${NANO_WORLDDIR}
  )
  
  #######################################################################
 @@ -687,7 +687,7 @@ cust_pkg () (
  	(
  		cd ${NANO_PACKAGE_DIR}
  		find ${NANO_PACKAGE_LIST} -print |
 -		    cpio -dumpv ${NANO_WORLDDIR}/Pkg
 +		    cpio -Ldumpv ${NANO_WORLDDIR}/Pkg
  	)
  
  	# Count & report how many we have to install
 _______________________________________________
 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"
 
State-Changed-From-To: open->patched 
State-Changed-By: imp 
State-Changed-When: Fri May 13 12:36:49 MDT 2011 
State-Changed-Why:  
Applied to head... 8.x in the fullness of time... 


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

From: Alex Bakhtin <alex.bakhtin@gmail.com>
To: Warner Losh <imp@bsdimp.com>, bug-followup@freebsd.org, lev@freebsd.org
Cc:  
Subject: Re: misc/151697: [nanobsd] [patch] nanobsd.sh copy links to packages
 as links to chrooted environment
Date: Thu, 26 May 2011 18:48:50 +0400

 Warner,
 
     Today I have tested the latest nanobsd.sh to build my production
 images. And ALL images was broken by your commited revision 221850.
 After this revision you have COMPLETELY removed any option to make
 symbolic links in the nanobsd image. The original patch by Lev touched
 only cust_pkg, but you have applied the same cpio flags to
 populate_slice.
 
     For example, I'm using symbolic links to save /boot/zfs in the /cfg slice:
 
 cust_dir_cfg () (
 
         cd ${NANO_WORLDDIR}
 
 # zfs import data
         rmdir boot/zfs
         ln -s /etc/zfs boot/zfs
 )
 late_customize_cmd cust_dir_cfg
 
 
    With the current nanobsd.sh there is no way to build an image which
 contains ANY symbolic links inside. I'm pretty sure that this violates
 POLA, please remove cpio -L flag from populate_slice.
 
 
 
 -- 
 ---
 Alex Bakhtin
State-Changed-From-To: patched->closed 
State-Changed-By: imp 
State-Changed-When: Thu Mar 13 22:17:02 MDT 2014 
State-Changed-Why:  
This is in 9 and 10, so	can be closed. 


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