Bug 582907 - [RHEL-5] Parted & partprobe return zero(success) status even under error conditions
Summary: [RHEL-5] Parted & partprobe return zero(success) status even under error cond...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: parted
Version: 5.5
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Brian Lane
QA Contact: Release Test Team
URL:
Whiteboard:
: 582904 (view as bug list)
Depends On:
Blocks: 585158 726828
TreeView+ depends on / blocked
 
Reported: 2010-04-16 07:09 UTC by Joe Jin
Modified: 2012-02-21 05:43 UTC (History)
4 users (show)

Fixed In Version: parted-1.8.1-29
Doc Type: Bug Fix
Doc Text:
Prior to this update, the parted utility did not handle the return value of the dm_task_run() call correctly on device-mapper devices. As a consequence, parted returned a 0 exit status even if an error occurred. The utility has been modified and now correctly returns 1 if an error occurs.
Clone Of:
: 585158 (view as bug list)
Environment:
Last Closed: 2012-02-21 05:43:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Fixed parted did not handle the return value of dm_task_run() correctly (1.61 KB, patch)
2010-04-16 07:09 UTC, Joe Jin
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0192 0 normal SHIPPED_LIVE parted bug fix update 2012-02-20 14:54:22 UTC

Description Joe Jin 2010-04-16 07:09:53 UTC
Created attachment 407012 [details]
Fixed parted did not handle the return value of dm_task_run() correctly

Description of problem:

When programed with parted and found below command always return 0
even failed:
# parted /dev/mapper/mpath1 -s -- mklabel msdos mkpart primary 2048s -1s  
device-mapper: remove ioctl failed: Device or resource busy
device-mapper: remove ioctl failed: Device or resource busy
device-mapper: create ioctl failed: Device or resource busy
# echo $?
0  


How reproducible:
  Always as above command.

Steps to Reproduce:
1. Above command.
  
Actual results:


Expected results:
Return no-zero on failed, otherwise return zero.

Additional info:
  Checked source code of parted found in libparted/arch/linux.c, 
  when call dm_ related functions, it always think return value
  <0 if failed, in fact, checked source code of dm_..() functions
  and found it always return 1 on success, error will return 0,
  it's the root cause.

Attach the patch, please review and include it.

Comment 1 Hans de Goede 2010-04-16 12:56:40 UTC
Hi,

Thanks for the bug report and the patch. I've contacted the lvm devs to clarify the return code meaning of dm_task_run. I'll get back to you when I have an answer from then.

Regards,

Hans

Comment 2 Hans de Goede 2010-04-19 08:35:26 UTC
*** Bug 582904 has been marked as a duplicate of this bug. ***

Comment 3 Hans de Goede 2010-04-23 11:29:48 UTC
I've a patch ready for fixing this.

Comment 4 David Cantrell 2010-07-02 01:14:36 UTC
Moving to 5.7 proposed list since parted did not make the approved component list for 5.6.

Comment 6 RHEL Program Management 2011-01-11 20:50:57 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 7 RHEL Program Management 2011-01-11 23:20:43 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 8 Brian Lane 2011-02-21 22:15:25 UTC
Moving to 5.8 since we have a reasonably low impact patch for this.

Comment 9 RHEL Program Management 2011-08-05 12:30:07 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 10 Eliska Slobodova 2011-09-20 12:39:49 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Prior to this update, the parted utility did not handle the return value of the dm_task_run() call correctly on device-mapper devices. As a consequence, parted returned a 0 exit status even if an error occurred. The utility has been modified and now correctly returns 1 if an error occurs.

Comment 12 Alexander Todorov 2011-12-14 14:50:27 UTC
Patch is present and applied in parted-1.8.1-29.el5.src.rpm

Comment 13 errata-xmlrpc 2012-02-21 05:43:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0192.html


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