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

Bug#698423: fixing samhain : a possible typo in live-build version 3.0~b5-1



Le vendredi 18 janvier à 13h 01mn 44s (+0100), Daniel Baumann a écrit :
> tag 698423 moreinfo
> thanks
> 
> On 01/18/2013 01:46 PM, jhcha54008 wrote:
> >As far as I understand, if samhain is not installed on the build host,
> >the current code amounts to create as root a directory /var/state/samhain
> 
> ...and removed again, so not a problem.
> 

Please feel free to classify this case as "whishlist" (of minor importance).
My concern was : isn't /var/state/samhain at risk to remain longer as
needed if a fatal error occurs between creation and removal (say, the user
did something wrong in the config) ?

> >or to a failure if live-build is invoked as a normal user with fakeroot.
> 
> can you elabore on that?
> 

Is uid 0 required to write under /var ?

ls -ld /var
drwxr-xr-x 19 root root 160  1 sept. 10:42 /var

Running as a normal user 

fakeroot -s .lb_fakeroot_state lb config --use-fakeroot true
fakeroot -i .lb_fakeroot_state -s .lb_fakeroot_state fakechroot lb build

would cause an error and the build to stop. Please correct me if I am 
wrong.

( My previous patch proposal didn't address the case where samhain is
installed and one is using fakeroot. Here is a second try )

> btw, in general to *discuss* things, it's preferable to use irc or
> the mailinglist, not the bug tracking system, less overhead.
> 


Sorry, I didn't realize I should discuss the point on the mailing list
first (I am a novice bug reporter, and followed the guidelines to 
report a typo - so, not appropriate in the present case).

Thank you for your answer and all your work on debian-live.

Regards,
JH Chatenet

diff -Naur a/usr/lib/live/build/chroot_dpkg b/usr/lib/live/build/chroot_dpkg
--- a/usr/lib/live/build/chroot_dpkg	2012-12-31 23:12:21.000000000 +0000
+++ b/usr/lib/live/build/chroot_dpkg	2013-01-18 12:31:44.966528061 +0000
@@ -62,12 +62,16 @@
 		# Manual hacks for special packages
 
 		# samhain
-		if [ -e /var/state/samhain/samhain_file ]
+		# do nothing if using fakeroot or samhain is not installed on the build host
+		if [ "${LB_USE_FAKEROOT}" != "true" -a -e /usr/sbin/samhain ]
 		then
-			mv /var/state/samhain/samhain_file /var/state/samhain/samhain_file.orig
-		else
-			mkdir -p /var/state/samhain
-			touch /var/state/samhain/samhain_file
+			if [ -e /var/state/samhain/samhain_file ]
+			then
+				mv /var/state/samhain/samhain_file /var/state/samhain/samhain_file.orig
+			else
+				mkdir -p /var/state/samhain
+				touch /var/state/samhain/samhain_file
+			fi
 		fi
 
 		# flash-kernel
@@ -94,13 +98,17 @@
 		Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/flash-kernel
 
 		# samhain
-		if [ -e /var/state/samhain/samhain_file.orig ]
+		# do nothing if using fakeroot or samhain is not installed on the build host
+		if [ "${LB_USE_FAKEROOT}" != "true" -a -e /usr/sbin/samhain ]
 		then
-			mv /var/state/samhain/samhain_file.orig /var/state/samhain/samhain_file
-		elif [ -d /var/state/samhain ]
-		then
-			rm -f /var/state/samhain/samhain_file
-			rmdir --ignore-fail-on-non-empty /var/state/samhain || true
+			if [ -e /var/state/samhain/samhain_file.orig ]
+			then
+				mv /var/state/samhain/samhain_file.orig /var/state/samhain/samhain_file
+			elif [ -d /var/state/samhain ]
+			then
+				rm -f /var/state/samhain/samhain_file
+				rmdir --ignore-fail-on-non-empty /var/state/samhain || true
+			fi
 		fi
 
 		# Restore start-stop-daemon program


Reply to: