Bug 180596 - Chattr command doesn't provide expected exit code in case of failure
Summary: Chattr command doesn't provide expected exit code in case of failure
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: e2fsprogs
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Eric Sandeen
QA Contact: Jay Turner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-02-09 06:56 UTC by Prahlad
Modified: 2015-01-08 00:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-10-19 18:47:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch sent upstream (3.66 KB, patch)
2007-09-20 17:59 UTC, Eric Sandeen
no flags Details | Diff

Description Prahlad 2006-02-09 06:56:06 UTC
Description of problem: 
Using chattr some kind of immutable chars can be added.
This feature work as expected, but effect is different in case of cheking its
exit code.

Version-Release number of selected component (if applicable):
e2fsprogs-1.32-15

How reproducible:   

Steps to Reproduce:
[Intentionally did chattr from normal 'test' user]
1. $ ls -l /bin/df
-rwxr-xr-x    1 root     root        28973 Oct 27 23:09 /bin/df
2. $ chattr +i /bin/df
chattr: Operation not permitted while setting flags on /bin/df
3. $ echo $?
0
  
Actual results:

Exit code is 0.

Expected results:

Exit code must be non-zero in case of failure.

Additional info: Hope to see the resolution in your further release.

Comment 1 Eric Sandeen 2007-09-20 17:59:49 UTC
Created attachment 201071 [details]
patch sent upstream

Sent this patch upstream for comment.

Sorry about the long delay...

Comment 2 RHEL Program Management 2007-10-19 18:47:41 UTC
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
 
For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/
 
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.

Comment 3 Eric Sandeen 2010-06-22 15:11:22 UTC
FWIW, fix did get merged upstream:

commit e68594d2376afd10e03b440b4bc288508ad13aa2
Author: Theodore Ts'o <tytso>
Date:   Mon Oct 22 08:51:39 2007 -0400

    chattr: provide an exit code in case of failure and add -f flag
    
    Fix chattr so that if there are errors, it will report it via a
    non-zero exit code.  It will now explicitly give errors when
    attempting to set files that are not files or directories (which are
    currently not supported under Linux).  The -f flag will suppress error
    messages from being printed, although the exit status will still be
    non-zero.
    
    Addresses-Red-Hat-Bugzilla: #180596
    
    Signed-off-by: "Theodore Ts'o" <tytso>
    Signed-off-by: Eric Sandeen <sandeen>


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