Bug 711832 - return code 0 even if device locked
Summary: return code 0 even if device locked
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cryptsetup-luks
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Milan Broz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 732179
TreeView+ depends on / blocked
 
Reported: 2011-06-08 16:51 UTC by Patrick C. F. Ernzer
Modified: 2013-03-01 04:10 UTC (History)
9 users (show)

Fixed In Version: cryptsetup-luks-1.3.1-2.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 732179 (view as bug list)
Environment:
Last Closed: 2011-06-26 18:48:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Patrick C. F. Ernzer 2011-06-08 16:51:01 UTC
Description of problem:
before F15, I could do this
cryptsetup status luks-${UUID}
if [ $? = 0 ]; then
        echo "Device already unlocked"
else
        echo "need to unlock device"
        cryptsetup luksOpen /dev/BANANA luks-${UUID}
fi

But since I installed F15 x86_64 on this box, cryptsetup status always has a return code of 0

Version-Release number of selected component (if applicable):
cryptsetup-luks-1.2.0-2.fc15.x86_64

How reproducible:
always

Steps to Reproduce:
[root@karhu ~]# cryptsetup status luks-SOMETHING
/dev/mapper/luks-SOMETHING is inactive.
[root@karhu ~]# echo $?
0
[root@karhu ~]# cryptsetup luksOpen /dev/BANANA luks-SOMETHING
Enter passphrase for /dev/BANANA: 
[root@karhu ~]# cryptsetup status luks-SOMETHING
/dev/mapper/luks-SOMETHING is active.
  type:  LUKS1
  cipher:  aes-cbc-essiv:sha256
  keysize: 256 bits
  device:  /dev/BANANA
  offset:  2056 sectors
  size:    104855544 sectors
  mode:    read/write
[root@karhu ~]# echo $?
0
  
Actual results:
exit code is 0 also when device is still locked

Expected results:
exit code 0 only when device is unlocked

Additional info:
obviously BANANA and SOMETHING is me replacing the UUID and device path by hand for the bug report

Comment 1 Milan Broz 2011-06-08 17:04:22 UTC
Hm. yes, it should return error code if device dosn't exist.

Comment 2 Milan Broz 2011-06-08 17:14:01 UTC
Just one line fix. I'll plan to update cryptsetup to 1.3.1 version in F15, so I'll add this patch too.

Thanks for report.

Comment 3 Milan Broz 2011-06-22 14:44:04 UTC
Updated cryptsetup-luks-1.3.1-2.fc15 with patch for this problem as well.

Comment 4 Fedora Update System 2011-06-22 14:48:11 UTC
cryptsetup-luks-1.3.1-2.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/cryptsetup-luks-1.3.1-2.fc15

Comment 5 Fedora Update System 2011-06-24 03:36:38 UTC
Package cryptsetup-luks-1.3.1-2.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cryptsetup-luks-1.3.1-2.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/cryptsetup-luks-1.3.1-2.fc15
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2011-06-26 18:48:38 UTC
cryptsetup-luks-1.3.1-2.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.