Bug 618134 - fsck returns zero instead of error code
fsck returns zero instead of error code
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e2fsprogs (Show other bugs)
5.5
All Linux
medium Severity high
: rc
: ---
Assigned To: Eric Sandeen
BaseOS QE - Apps
:
Depends On:
Blocks: 590060
  Show dependency treegraph
 
Reported: 2010-07-26 04:47 EDT by Takuma Umeya
Modified: 2011-07-21 08:39 EDT (History)
4 users (show)

See Also:
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 05:07:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fix fsck error handling (1.23 KB, patch)
2010-07-28 13:01 EDT, Bryn M. Reeves
no flags Details | Diff
patch from comment #1 re-diffed to apply with -p1 (1.49 KB, patch)
2010-07-28 13:06 EDT, Bryn M. Reeves
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1080 normal SHIPPED_LIVE e2fsprogs bug fix and enhancement update 2011-07-21 05:04:54 EDT

  None (edit)
Description Takuma Umeya 2010-07-26 04:47:53 EDT
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 13:01:19 EDT
Created attachment 435078 [details]
fix fsck error handling
Comment 2 Bryn M. Reeves 2010-07-28 13:06:36 EDT
Created attachment 435080 [details]
patch from comment #1 re-diffed to apply with -p1
Comment 3 Bryn M. Reeves 2010-07-28 13:07:23 EDT
Patch in comment #2 is from the partner who reported this, reviewed &
localbuild tested by me.
Comment 5 Eric Sandeen 2011-02-01 15:21:22 EST
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@redhat.com>
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@redhat.com>
Comment 6 Eric Sandeen 2011-02-01 17:09:50 EST
Built & tagged in e2fsprogs-1.39-28.el5
Comment 9 errata-xmlrpc 2011-07-21 05:07:11 EDT
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 08:39:03 EDT
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

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