[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: Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3


                 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



$ find ''; echo $?
find: cannot search `': No such file or directory

$ find '/does/not/exist'; echo $?
find: `/does/not/exist': No such file or directory

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"
if [ "0 0" != "${PIPESTATUS[*]}" ]
    fail 'Something failed in the loop'

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:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]