Package: cryptsetup
Version: 2:1.0.6+20090405.svn49-1

  I encountered same issue. After a quick check, I found the problem is
because cryptdisks_start use a while-read loop, which starts a subshell.

  For more details you can check
http://fvue.nl/wiki/Bash:_Piped_%60while-read%27_loop_starts_subshell

  Enclosed please find the patch for this problem.

--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.30-rc3-686

Debian Release: squeeze/sid
  500 unstable        www.debian-multimedia.org
  500 unstable        snapshots.ekiga.net
  500 unstable        ftp.tw.debian.org
  500 stable          ftp.tw.debian.org
  500 stable          dl.google.com
  500 kernel-dists-trunk kernel-archive.buildserver.net
  500 jaunty          ppa.launchpad.net
    1 experimental    ftp.tw.debian.org

--- Package information. ---
Depends                     (Version) | Installed
=====================================-+-===============
libc6                        (>= 2.3) | 2.9-8
libdevmapper1.02.1     (>= 2:1.02.20) | 2:1.02.30-3
libpopt0                    (>= 1.14) | 1.14-4
libuuid1                    (>= 1.05) | 1.41.5-1
dmsetup                               | 2:1.02.30-3


Package's Recommends field is empty.

Suggests                  (Version) | Installed
===================================-+-===========
udev                                | 0.141-1
initramfs-tools          (>= 0.91)  | 0.93.2
 OR linux-initramfs-tool            |
dosfstools                          | 3.0.2-1

--- cryptdisks_start.orig	2009-04-29 22:02:47.000000000 +0800
+++ /usr/sbin/cryptdisks_start	2009-04-29 22:03:33.000000000 +0800
@@ -27,13 +27,17 @@
 mount_fs
 
 found="no"
-egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do
-	if [ "$1" = "$dst" ]; then
-		found="yes"
-		handle_crypttab_line_start "$dst" "$src" "$key" "$opts" <&3
-		exit 0
-	fi
-done 3<&1
+found=$(
+	egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do
+		if [ "$1" = "$dst" ]; then
+			found="yes"
+			handle_crypttab_line_start "$dst" "$src" "$key" "$opts" <&3
+			echo yes
+			exit 0
+		fi
+	done 3<&1
+	echo no
+)
 
 if [ "$found" = "no" ]; then
 	device_msg "$1" "failed, not found in crypttab"
--- cryptdisks_stop.orig	2009-04-29 22:08:46.000000000 +0800
+++ /usr/sbin/cryptdisks_stop	2009-04-29 22:09:33.000000000 +0800
@@ -28,13 +28,17 @@
 log_action_begin_msg "Stopping crypto disk"
 
 found="no"
-egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do
-	if [ "$1" = "$dst" ]; then
-		found="yes"
-		handle_crypttab_line_stop "$dst" "$src" "$key" "$opts" <&3
-		exit 0
-	fi
-done 3<&1
+found=$(
+	egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do
+		if [ "$1" = "$dst" ]; then
+			found="yes"
+			handle_crypttab_line_stop "$dst" "$src" "$key" "$opts" <&3
+			echo yes
+			exit 0
+		fi
+	done 3<&1
+	echo no
+)
 
 if [ "$found" = "no" ]; then
 	device_msg "$1" "failed, not found in crypttab"

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to