[SCM] live-boot branch, debian-next, updated. debian/3.0_a25-1-70-ga39a167

Daniel Baumann daniel at debian.org
Thu Apr 5 06:00:34 UTC 2012


The following commit has been merged in the debian-next branch:
commit 22216d157f7dacf5cdaabc45a7a7a42bfcfe49d1
Author: Tails developers <amnesia at boum.org>
Date:   Tue Mar 20 17:37:58 2012 +0100

    Make two custom mounts with nested source directories illegal.

diff --git a/scripts/live-helpers b/scripts/live-helpers
index 75fc106..52f812c 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -1342,7 +1342,24 @@ get_custom_mounts ()
 
 	# After all mounts are considered we add symlinks so they
 	# won't be hidden by some mount.
-	[ -e "${links}" ] && sort -k3 -sbu ${links} >> ${custom_mounts} && rm ${links}
+	[ -e "${links}" ] && cat ${links} >> ${custom_mounts} && rm ${links}
+
+	# We need to make sure that no two custom mounts have the same sources
+	# or are nested; if that is the case, too much weird stuff can happen.
+	local prev_source="impossible source" # first iteration must not match
+	local prev_dest=""
+	# This sort will ensure that a source /a comes right before a source
+	# /a/b so we only need to look at the previous source
+	sort -k2 -b ${custom_mounts} |
+	while read device source dest options
+	do
+		if echo ${source} | grep -qe "^${prev_source}\(/.*\)\?$"
+		then
+			panic "Two persistent mounts have the same or nested sources: ${source} on ${dest}, and ${prev_source} on ${prev_dest}"
+		fi
+		prev_source=${source}
+		prev_dest=${dest}
+	done
 }
 
 activate_custom_mounts ()
@@ -1356,7 +1373,7 @@ activate_custom_mounts ()
 		local opt_union=""
 		for opt in $(echo ${options} | tr ',' ' ');
 		do
-			 case "${opt}" in
+			case "${opt}" in
 				linkfiles)
 					opt_linkfiles="yes"
 					;;

-- 
live-boot



More information about the debian-live-changes mailing list