Bug 489841 - lsattr exits with 0 even if the file does not exist
Summary: lsattr exits with 0 even if the file does not exist
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: e2fsprogs
Version: 10
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Eric Sandeen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-12 08:13 UTC by Milos Malik
Modified: 2010-04-21 13:17 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-06-24 20:10:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Milos Malik 2009-03-12 08:13:39 UTC
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 21:40:55 UTC
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 21:43:05 UTC
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 22:15:48 UTC
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 20:10:28 UTC
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.