Bug 489841 - lsattr exits with 0 even if the file does not exist
lsattr exits with 0 even if the file does not exist
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: e2fsprogs (Show other bugs)
10
All Linux
medium Severity medium
: ---
: ---
Assigned To: Eric Sandeen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-12 04:13 EDT by Milos Malik
Modified: 2010-04-21 09:17 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-06-24 16:10:28 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)

  None (edit)
Description Milos Malik 2009-03-12 04:13:39 EDT
Description of problem:
There is important difference between the behaviour of ls and lsattr. If the file does not exist, ls exits with non-zero code. In the same situation lsattr pretends that non-existent file is OK and exits with 0.

Version-Release number of selected component (if applicable):
e2fsprogs-1.41.4-1.fc10

How reproducible:
always

Steps to Reproduce:
$ ls output.txt
ls: cannot access output.txt: No such file or directory
$ echo $?
2
$ lsattr output.txt
lsattr: No such file or directory while trying to stat output.txt
$ echo $?
0
  
Actual results:
lsattr exits with 0

Expected results:
lsattr exits with non-zero

Additional info:
Comment 1 Eric Sandeen 2009-06-18 17:40:55 EDT
Since lsattr takes more than one file as an argument, I'm not sure what the standard is for return values if only some have errors... will look into it.
Comment 2 Eric Sandeen 2009-06-18 17:43:05 EDT
looks like ls will return an error if any arg has a problem:

# ls foo bar baz blah TODO
ls: cannot access foo: No such file or directory
ls: cannot access bar: No such file or directory
ls: cannot access baz: No such file or directory
ls: cannot access blah: No such file or directory
TODO
# echo $?
2
Comment 3 Eric Sandeen 2009-06-18 18:15:48 EDT
sent a patch upstream for this.

# misc/lsattr foo bar baz blah TODO
misc/lsattr: No such file or directory while trying to stat foo
misc/lsattr: No such file or directory while trying to stat bar
misc/lsattr: No such file or directory while trying to stat baz
misc/lsattr: No such file or directory while trying to stat blah
-------------e- TODO
# echo $?
2

Sorry for the long delay.  :)
Comment 4 Eric Sandeen 2009-06-24 16:10:28 EDT
Fixes for these are upstream now, and will be pulled into Fedora w/ the next e2fsprogs rebase.  It'll probably only make it to F11 unless you have a specific need for F10; if so just let me know.

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