Bug 618134 - fsck returns zero instead of error code
Summary: fsck returns zero instead of error code
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e2fsprogs
Version: 5.5
Hardware: All
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 590060
TreeView+ depends on / blocked
 
Reported: 2010-07-26 08:47 UTC by Takuma Umeya
Modified: 2018-11-14 19:00 UTC (History)
4 users (show)

Fixed In Version: e2fsprogs-1.39-28.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 619139 (view as bug list)
Environment:
Last Closed: 2011-07-21 09:07:11 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1080 0 normal SHIPPED_LIVE e2fsprogs bug fix and enhancement update 2011-07-21 09:04:54 UTC

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


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