Bug 439191

Summary: cryptsetup status gives wrong return codes
Product: Red Hat Enterprise Linux 5 Reporter: Petr Šplíchal <psplicha>
Component: cryptsetup-luksAssignee: Milan Broz <mbroz>
Status: CLOSED ERRATA QA Contact: Alexander Todorov <atodorov>
Severity: low Docs Contact:
Priority: low    
Version: 5.1CC: agk, atodorov, borgan, dwysocha, mbroz, ohudlick, pjones, prockai, pvrabec, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 11:18:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Šplíchal 2008-03-27 14:37:02 UTC
Description of problem:

When calling "cryptsetup status" for nonexistent device, it returns 0.
Calling "cryptsetup status" for existing device works fine, displays details
about the device but returns 1.

Version-Release number of selected component (if applicable):
cryptsetup-luks-1.0.3-2.2.el5

How reproducible:
Always

Steps to Reproduce:
cryptsetup status existing-device
cryptsetup status nonexistent-device
  
Actual results:
# cryptsetup status crypted
/dev/mapper/crypted is active:
  cipher:  aes-cbc-plain
  keysize: 256 bits
  device:  /dev/loop7
  offset:  0 sectors
  size:    14336 sectors
  mode:    read/write
# echo $?
1

# cryptsetup status nonexistent
/dev/mapper/nonexistent is inactive.
# echo $?
0

Expected results:
should return 0 when everything's ok
and non-zero if there's been some problem (e.g. missing device)

Comment 5 Milan Broz 2009-02-11 14:38:07 UTC
Fixed in cryptsetup-luks-1.0.3-5.el5.

Comment 7 Alexander Todorov 2009-05-12 08:24:39 UTC
With cryptsetup-luks-1.0.3-5.el5

# cryptsetup status luks-b17bec60-d73f-40be-834f-cd813ad1d26a
/dev/mapper/luks-b17bec60-d73f-40be-834f-cd813ad1d26a is active:
  cipher:  aes-cbc-essiv:sha256
  keysize: 128 bits
  device:  /dev/mapper/VolGroup00-LogVol00
  offset:  1032 sectors
  size:    18086904 sectors
  mode:    read/write
# echo $?
0

# cryptsetup status nonexistent
/dev/mapper/nonexistent is inactive.
# echo $?
1

Comment 9 errata-xmlrpc 2009-09-02 11:18:05 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1349.html