Bug 618134

Summary: fsck returns zero instead of error code
Product: Red Hat Enterprise Linux 5 Reporter: Takuma Umeya <tumeya>
Component: e2fsprogsAssignee: Eric Sandeen <esandeen>
Status: CLOSED ERRATA QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: high Docs Contact:
Priority: medium    
Version: 5.5CC: bmr, bnater, sct, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: e2fsprogs-1.39-28.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 619139 (view as bug list) Environment:
Last Closed: 2011-07-21 09:07:11 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:
Bug Depends On:    
Bug Blocks: 590060    
Attachments:
Description Flags
fix fsck error handling
none
patch from comment #1 re-diffed to apply with -p1 none

Description Takuma Umeya 2010-07-26 08:47:53 UTC
Description of problem:
fsck command does not return with proper error code but returns zero under specific circumstance. The return value of fsck_device function should appear as the error code. 

Version-Release number of selected component (if applicable):
e2fsprogs-1.39-23.el5

How reproducible:
Always 

Steps to Reproduce:
1. Create entry such as following to /etc/fstab: 
    /dev/sda1  /data  ignore  defaults  1 2 ###fstype is "ignore"
2. Execute # fsck -t ignore /dev/sdb1 which would return error message. 
3. Execute echo $? to confirm it returned 0 instead of error code. 

  
Actual results:
# echo $? returns 0. 

Expected results:
It should return non-zero, desirably, 8. 

Additional info:
The bug has been encountered by vendor's middle ware, which continued to try running although there were an error.

Comment 1 Bryn M. Reeves 2010-07-28 17:01:19 UTC
Created attachment 435078 [details]
fix fsck error handling

Comment 2 Bryn M. Reeves 2010-07-28 17:06:36 UTC
Created attachment 435080 [details]
patch from comment #1 re-diffed to apply with -p1

Comment 3 Bryn M. Reeves 2010-07-28 17:07:23 UTC
Patch in comment #2 is from the partner who reported this, reviewed &
localbuild tested by me.

Comment 5 Eric Sandeen 2011-02-01 20:21:22 UTC
Upstream fix exists in the util-linux-ng repo:

http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=commitdiff;h=6c6f2af9e3949197cf7a70255895a2f4451f2319

commit 6c6f2af9e3949197cf7a70255895a2f4451f2319
Author: Karel Zak <kzak>
Date:   Mon Dec 27 22:30:24 2010 +0100

    fsck: returns proper code on exec() error
    
        # fsck -t foo /dev/sda1; echo $?
        fsck: fsck.foo: not found
        /sbin/fsck: Error 2 while executing fsck.foo for /dev/sda1
        0
    
    new version:
    
        # fsck -t foo /dev/sda1; echo $?
        fsck: fsck.foo: not found
        fsck: Error 2 while executing fsck.foo for /dev/sda1
        8
    
    Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=619139
    Signed-off-by: Karel Zak <kzak>

Comment 6 Eric Sandeen 2011-02-01 22:09:50 UTC
Built & tagged in e2fsprogs-1.39-28.el5

Comment 9 errata-xmlrpc 2011-07-21 09:07:11 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-2011-1080.html

Comment 10 errata-xmlrpc 2011-07-21 12:39:03 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-2011-1080.html