[cryptsetup-luks] Fix return code for status command when device doesn't exist.

Milan Broz mbroz at fedoraproject.org
Wed Jun 22 14:09:23 UTC 2011


commit 048c150a2bfcdeaa609dcfa963dcc2ff15471b0a
Author: Milan Broz <mbroz at redhat.com>
Date:   Wed Jun 22 10:08:38 2011 -0400

    Fix return code for status command when device doesn't exist.

 cryptsetup-1.3.2-status.patch |   56 +++++++++++++++++++++++++++++++++++++++++
 cryptsetup-luks.spec          |    7 ++++-
 2 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/cryptsetup-1.3.2-status.patch b/cryptsetup-1.3.2-status.patch
new file mode 100644
index 0000000..ba3c3ae
--- /dev/null
+++ b/cryptsetup-1.3.2-status.patch
@@ -0,0 +1,56 @@
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,6 @@
++2011-06-08  Milan Broz  <mbroz at redhat.com>
++	* Fix return code for status command when device doesn't exists.
++
+ 2011-05-24  Milan Broz  <mbroz at redhat.com>
+ 	* Version 1.3.1.
+ 
+--- a/src/cryptsetup.c
++++ b/src/cryptsetup.c
+@@ -366,10 +366,11 @@ static int action_status(int arg __attribute__((unused)))
+ 	ci = crypt_status(NULL, action_argv[0]);
+ 	switch (ci) {
+ 	case CRYPT_INVALID:
+-		r = -ENODEV;
++		r = -EINVAL;
+ 		break;
+ 	case CRYPT_INACTIVE:
+ 		log_std("%s/%s is inactive.\n", crypt_get_dir(), action_argv[0]);
++		r = -ENODEV;
+ 		break;
+ 	case CRYPT_ACTIVE:
+ 	case CRYPT_BUSY:
+--- a/tests/compat-test
++++ b/tests/compat-test
+@@ -255,6 +255,7 @@ $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
+ $CRYPTSETUP -q resize  $DEV_NAME || fail
+ $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "19997 sectors" || fail
+ $CRYPTSETUP -q remove  $DEV_NAME || fail
++$CRYPTSETUP -q status  $DEV_NAME >/dev/null && fail
+ echo "key0" | $CRYPTSETUP create $DEV_NAME --hash sha1 $LOOPDEV || fail
+ $CRYPTSETUP -q remove  $DEV_NAME || fail
+ echo "key0" | $CRYPTSETUP -q create $DEV_NAME --hash sha1 $LOOPDEV || fail
+--- a/tests/mode-test
++++ b/tests/mode-test
+@@ -51,7 +51,7 @@ add_device() {
+ 
+ dmcrypt_check() # device outstring
+ {
+-	X=$(dmsetup table $1 2>/dev/null | cut -d' '  -f 4)
++	X=$(dmsetup table $1 2>/dev/null | sed 's/.*: //' | cut -d' '  -f 4)
+ 	if [ $X = $2 ] ; then
+ 		echo -n "[table OK]"
+ 	else
+--- a/tests/password-hash-test
++++ b/tests/password-hash-test
+@@ -63,7 +63,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit]
+ 		fi
+ 	fi
+ 
+-	VKEY=$(dmsetup table $DEV2 --showkeys 2>/dev/null | cut -d' '  -f 5)
++	VKEY=$(dmsetup table $DEV2 --showkeys 2>/dev/null | sed 's/.*: //' | cut -d' '  -f 5)
+ 	if [ "$VKEY" != "$5" ] ; then
+ 		echo " [FAILED]"
+ 		echo "expected: $5"
diff --git a/cryptsetup-luks.spec b/cryptsetup-luks.spec
index 835ad3c..91ac4ec 100644
--- a/cryptsetup-luks.spec
+++ b/cryptsetup-luks.spec
@@ -1,7 +1,7 @@
 Summary: A utility for setting up encrypted filesystems
 Name: cryptsetup-luks
 Version: 1.3.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2
 Group: Applications/System
 URL: http://cryptsetup.googlecode.com/
@@ -16,6 +16,7 @@ Requires: cryptsetup-luks-libs = %{version}-%{release}
 %define _root_sbindir /sbin
 %define upstream_version %{version}
 Source0: http://cryptsetup.googlecode.com/files/cryptsetup-%{upstream_version}.tar.bz2
+Patch0: cryptsetup-1.3.2-status.patch
 
 %description
 This package contains cryptsetup, a utility for setting up
@@ -41,6 +42,7 @@ This package contains the cryptsetup shared library, libcryptsetup.
 
 %prep
 %setup -q -n cryptsetup-%{upstream_version}
+%patch0 -p1 -b .status
 
 iconv -f latin1 -t utf8 ChangeLog > ChangeLog.new
 mv -f ChangeLog.new ChangeLog
@@ -90,6 +92,9 @@ popd
 rm -rf $RPM_BUILD_ROOT
 
 %changelog
+* Wed Jun 22 2011 Milan Broz <mbroz at redhat.com> - 1.3.1-2
+- Fix return code for status command when device doesn't exist.
+
 * Tue May 24 2011 Milan Broz <mbroz at redhat.com> - 1.3.1-1
 - Update to cryptsetup 1.3.1.
 


More information about the scm-commits mailing list