[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #31774] Exit code 0 when path is empty
From: |
Victor Engmark |
Subject: |
[bug #31774] Exit code 0 when path is empty |
Date: |
Fri, 26 Nov 2010 12:57:53 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 |
URL:
<http://savannah.gnu.org/bugs/?31774>
Summary: Exit code 0 when path is empty
Project: findutils
Submitted by: l0b0
Submitted on: Fri 26 Nov 2010 01:57:52 PM CET
Category: find
Severity: 3 - Normal
Item Group: Wrong result
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.2
Fixed Release: None
_______________________________________________________
Details:
$ find ''; echo $?
find: cannot search `': No such file or directory
0
$ find '/does/not/exist'; echo $?
find: `/does/not/exist': No such file or directory
1
The actual error is slightly different (the first command couldn't possibly
succeed in any environment), but it still seems inconsistent. The first result
makes it more difficult (and less intuitive) to test code which uses a
variable for the path.
Here's some simplified testing code:
source="$(some command)"
find "$source" ... -print0 | while read -rd $'\0' path
touch "$path"
done
if [ "0 0" != "${PIPESTATUS[*]}" ]
then
fail 'Something failed in the loop'
return
fi
This does not catch the situation where $source is empty. To detect that, I'd
have to tee stderr of find to a separate file and grep for something that
doesn't look like a path.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31774>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #31774] Exit code 0 when path is empty,
Victor Engmark <=