[BusyBox 0000866]: [PATCH] find returns 0 when no file is matched

Paul Fox pgf at brightstareng.com
Sun Jun 11 13:20:24 PDT 2006


 > Hi,
 > 
 > Any find guru, should this be closed?
 > 
 > PS: Too lazy to try to find a standard which may mandate the proper
 > behaviour for the belowmentioned case.
 > cheers,

i'd close it.  the find man page says:
    EXIT STATUS
       find exits with status 0 if all files are processed
       successfully, greater than 0 if errors occur.  This is
       deliberately a very broad description, but if the return
       value is non-zero, you should not rely on the correctness
       of the results of find.

seems to me that returning 0 if no files are found is simply indicating
that the results are correct.  i.e., no error occurred.

paul

 > 
 > On Sun, Jun 11, 2006 at 10:43:40AM -0700, bugs at busybox.net wrote:
 > >
 > >A NOTE has been added to this issue. 
 > >====================================================================== 
 > >http://busybox.net/bugs/view.php?id=866 
 > >====================================================================== 
 > >Reported By:                asierllano
 > >Assigned To:                BusyBox
 > >====================================================================== 
 > >Project:                    BusyBox
 > >Issue ID:                   866
 > >Category:                   Standards Compliance
 > >Reproducibility:            always
 > >Severity:                   minor
 > >Priority:                   normal
 > >Status:                     assigned
 > >====================================================================== 
 > >Date Submitted:             05-04-2006 23:32 PDT
 > >Last Modified:              06-11-2006 10:43 PDT
 > >====================================================================== 
 > >Summary:                    [PATCH] find returns 0 when no file is matched
 > >Description: 
 > >Execute:
 > >find -name idontexist
 > >echo $?
 > >
 > >You will see that in busybox it returns 0, but in findutils it returns 1.
 > >
 > >I've provided a simple patch that solves it easily.
 > >This bug happens in the SVN snapshot, but I haven't tried to apply this
 > >patch to it, but it may apply directly or near-directly.
 > >====================================================================== 
 > >
 > >---------------------------------------------------------------------- 
 > > bernhardf - 06-11-06 10:43  
 > >---------------------------------------------------------------------- 
 > >While i can see why returning a failure-code in this case would make sense,
 > >GNU find does return success too. 
 > >
 > >Issue History 
 > >Date Modified   Username       Field                    Change               
 > >====================================================================== 
 > >05-04-06 23:32  asierllano     New Issue                                    
 > >05-04-06 23:32  asierllano     Status                   new => assigned     
 > >05-04-06 23:32  asierllano     Assigned To               => BusyBox         
 > >05-04-06 23:32  asierllano     File Added: busybox-find-nomatch.patch           
 > >        
 > >06-11-06 10:43  bernhardf      Note Added: 0001416                          
 > >======================================================================
 > _______________________________________________
 > busybox mailing list
 > busybox at busybox.net
 > http://busybox.net/cgi-bin/mailman/listinfo/busybox

=---------------------
 paul fox, pgf at brightstareng.com


More information about the busybox mailing list