[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] [1/2] Do not attempt to recursively chown chroot or binary if LB_ROOT_COMMAND is set



On Tue, Jul 19, 2011 at 4:12 PM, Cody A.W. Somerville <cody.somerville@canonical.com> wrote:
Hello,

 Please accept attached patch to remove calls to chown chroot and binary directories during build process if LB_ROOT_COMMAND is set as chown will strip the setsuid bit (which breaks a lot of stuff naturally).

Oops. Forgot to attach the patch. :)

Cheers,

--
Cody A.W. Somerville
Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1 781 850 2087
Cell: +1 613 401 5141
Fax: +1 613 687 7368
Email: cody.somerville@canonical.com
=== modified file 'scripts/build/lb_binary_chroot'
--- scripts/build/lb_binary_chroot	2011-06-02 22:38:09 +0000
+++ scripts/build/lb_binary_chroot	2011-07-19 19:49:22 +0000
@@ -114,10 +114,5 @@
 	esac
 fi
 
-if [ -n "${LB_ROOT_COMMAND}" ]
-then
-	${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-fi
-
 # Creating stage file
 Create_stagefile .stage/binary_chroot

=== modified file 'scripts/build/lb_binary_rootfs'
--- scripts/build/lb_binary_rootfs	2011-06-15 18:48:56 +0000
+++ scripts/build/lb_binary_rootfs	2011-07-19 19:49:22 +0000
@@ -76,11 +76,6 @@
 		mkdir -p binary/"${INITFS}"
 		${LB_ROOT_COMMAND} cp -a cache/stages_rootfs/filesystem.* binary/"${INITFS}"
 
-		if [ -n "${LB_ROOT_COMMAND}" ]
-		then
-			${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary
-		fi
-
 		# Creating stage file
 		Create_stagefile .stage/binary_rootfs
 		exit 0
@@ -438,11 +433,6 @@
 				;;
 		esac
 
-		if [ -n "${LB_ROOT_COMMAND}" ]
-		then
-			${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary/${INITFS}
-		fi
-
 		# Saving cache
 		Save_cache cache/packages_binary
 		;;
@@ -480,10 +470,6 @@
 			${LB_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/stages_rootfs
 		fi
 
-		if [ -n "${LB_ROOT_COMMAND}" ]
-		then
-			${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_rootfs
-		fi
 	fi
 done
 

=== modified file 'scripts/build/lb_bootstrap_cache'
--- scripts/build/lb_bootstrap_cache	2011-03-09 18:20:42 +0000
+++ scripts/build/lb_bootstrap_cache	2011-07-19 19:49:22 +0000
@@ -52,11 +52,6 @@
 					# Restoring old cache
 					${LB_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot
 
-					if [ -n "${LB_ROOT_COMMAND}" ]
-					then
-						${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-					fi
-
 					# Creating stage file
 					Create_stagefile .stage/bootstrap_cache.restore
 					Create_stagefile .stage/bootstrap
@@ -81,11 +76,6 @@
 
 				${LB_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap
 
-				if [ -n "${LB_ROOT_COMMAND}" ]
-				then
-					${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_bootstrap
-				fi
-
 				# Creating stage file
 				Create_stagefile .stage/bootstrap_cache.save
 				;;

=== modified file 'scripts/build/lb_bootstrap_cdebootstrap'
--- scripts/build/lb_bootstrap_cdebootstrap	2011-06-03 09:10:38 +0000
+++ scripts/build/lb_bootstrap_cdebootstrap	2011-07-19 19:49:22 +0000
@@ -128,11 +128,6 @@
 		Echo_breakage "Running ${LB_BOOTSTRAP} (download-only)... "
 		${LB_ROOT_COMMAND} ${LB_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
 
-		if [ -n "${LB_ROOT_COMMAND}" ]
-		then
-			${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-		fi
-
 		# Removing old cache
 		rm -f cache/packages_bootstrap/*.deb
 
@@ -144,11 +139,6 @@
 	Echo_breakage "Running ${LB_BOOTSTRAP}... "
 	${LB_ROOT_COMMAND} ${LB_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
 
-	if [ -n "${LB_ROOT_COMMAND}" ]
-	then
-		${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-	fi
-
 	# Remove cdebootstrap-helper-diverts (needed at least for minimal flavours)
 	case "${LB_PACKAGE_LISTS}" in
 		stripped|minimal)

=== modified file 'scripts/build/lb_bootstrap_debootstrap'
--- scripts/build/lb_bootstrap_debootstrap	2011-06-03 09:10:38 +0000
+++ scripts/build/lb_bootstrap_debootstrap	2011-07-19 19:49:22 +0000
@@ -116,11 +116,6 @@
 		Echo_breakage "Running debootstrap (download-only)... "
 		${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
 
-		if [ -n "${LB_ROOT_COMMAND}" ]
-		then
-			${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-		fi
-
 		# Removing old cache
 		rm -f cache/packages_bootstrap/*.deb
 
@@ -132,11 +127,6 @@
 	Echo_breakage "Running debootstrap... "
 	${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}"
 
-	if [ -n "${LB_ROOT_COMMAND}" ]
-	then
-		${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-	fi
-
 	# Deconfiguring debootstrap configurations
 	rm -f chroot/etc/hosts
 

=== modified file 'scripts/build/lb_chroot_cache'
--- scripts/build/lb_chroot_cache	2011-03-09 18:20:42 +0000
+++ scripts/build/lb_chroot_cache	2011-07-19 19:49:22 +0000
@@ -49,11 +49,6 @@
 					# Restoring old cache
 					${LB_ROOT_COMMAND} cp -a cache/stages_chroot chroot
 
-					if [ -n "${LB_ROOT_COMMAND}" ]
-					then
-						${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot
-					fi
-
 					# Creating stage file
 					Create_stagefile .stage/chroot_cache.restore
 
@@ -77,11 +72,6 @@
 
 				${LB_ROOT_COMMAND} cp -a chroot cache/stages_chroot
 
-				if [ -n "${LB_ROOT_COMMAND}" ]
-				then
-					${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_chroot
-				fi
-
 				# Creating stage file
 				Create_stagefile .stage/chroot_cache.save
 				;;

=== modified file 'scripts/build/lb_chroot_hacks'
--- scripts/build/lb_chroot_hacks	2011-07-08 16:41:54 +0000
+++ scripts/build/lb_chroot_hacks	2011-07-19 19:49:22 +0000
@@ -226,11 +226,6 @@
 rm -f chroot/var/lib/dpkg/*-old
 rm -f chroot/var/log/apt/term.log
 
-if [ -n "${LB_ROOT_COMMAND}" ]
-then
-	${LB_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot
-fi
-
 case "${LB_INITRAMFS}" in
 	casper)
 		ID="999"


Reply to: