Bug 439191 - cryptsetup status gives wrong return codes
Summary: cryptsetup status gives wrong return codes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: cryptsetup-luks
Version: 5.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Milan Broz
QA Contact: Alexander Todorov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-03-27 14:37 UTC by Petr Šplíchal
Modified: 2016-06-01 01:36 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 11:18:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1349 0 normal SHIPPED_LIVE cryptsetup-luks bug fix update 2009-09-01 10:48:20 UTC

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


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