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

[patch] find_snap weirdness



Hi,

I started again looking at the persistence bits and found some quite
weird behaviour:

- find_snap is called with a blacklisted devices list as its second
  argument
- it simply ignores its second argument
- the two functions find_snap calls (namely: find_cow_device and
  find_files) support being passed a blacklist as a second argument
  too
- find_files is not called by anything else than find_snap

=> so I guess the blacklist should be forwarded by find_snap to
find_files and find_cow_device.

Patch attached against debian-old-2.0 branch.

Bye,
-- 
  intrigeri <intrigeri@boum.org>
  | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
  | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr-fingerprint.asc
  | If you must label the absolute, use it's proper name: Temporary.

>From 87d6f31e10170bc4183a48d079290c81dc0ee09f Mon Sep 17 00:00:00 2001
From: amnesia <amnesia@boum.org>
Date: Sat, 25 Sep 2010 21:54:37 +0200
Subject: [PATCH] Fixing find_snap to take its second argument into account.

Signed-off-by: amnesia <amnesia@boum.org>
---
 scripts/live |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/live b/scripts/live
index 0e1b2f4..f257218 100755
--- a/scripts/live
+++ b/scripts/live
@@ -944,16 +944,17 @@ find_snap ()
 {
 	# Look for ${snap_label}.* in block devices
 	snap_label="${1}"
+	black_listed_devices="${2}"
 
 	if [ "${PERSISTENT}" != "nofiles" ]
 	then
 		# search for image files
-		snapdata=$(find_files "${PERSISTENT_PATH}${snap_label}.squashfs ${PERSISTENT_PATH}${snap_label}.cpio.gz ${PERSISTENT_PATH}${snap_label}.ext2 ${PERSISTENT_PATH}${snap_label}.ext3 ${PERSISTENT_PATH}${snap_label}.ext4 ${PERSISTENT_PATH}${snap_label}.jffs2")
+		snapdata=$(find_files "${PERSISTENT_PATH}${snap_label}.squashfs ${PERSISTENT_PATH}${snap_label}.cpio.gz ${PERSISTENT_PATH}${snap_label}.ext2 ${PERSISTENT_PATH}${snap_label}.ext3 ${PERSISTENT_PATH}${snap_label}.ext4 ${PERSISTENT_PATH}${snap_label}.jffs2" "${black_listed_devices}")
 	fi
 
 	if [ -z "${snapdata}" ]
 	then
-		snapdata=$(find_cow_device "${snap_label}")
+		snapdata=$(find_cow_device "${snap_label}" "${black_listed_devices}")
 	fi
 	echo "${snapdata}"
 }
-- 
1.7.1


Reply to: