The following issue has been SUBMITTED. ====================================================================== https://austingroupbugs.net/view.php?id=1606 ====================================================================== Reported By: Clausecker Assigned To: ====================================================================== Project: 1003.1(2016/18)/Issue7+TC2 Issue ID: 1606 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: New Name: Robert Clausecker Organization: Zuse Institute Berlin User Reference: Section: find Page Number: 2761 Line Number: 90456–90458 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2022-09-23 23:11 UTC Last Modified: 2022-09-23 23:11 UTC ====================================================================== Summary: find: is a directory loop considered to be an error? Description: The find(1) utility is specified to print a diagnostic message upon encountering a directory loop:
> The find utility shall detect infinite loops; that is, entering > a previously visited directory that is an ancestor of the last file > encountered. When it detects an infinite loop, find shall write > a diagnostic message to standard error and shall either recover > its position in the hierarchy or terminate. What is not specified is if the find(1) utility shall consider this to be an error and return a non-zero exit status. While the Utility Description Defaults seem to indicate that a non-zero exit status shall be returned for any diagnostic message printed, it is not entirely clear if this applies to this case. GNU find and SunOS find do. FreeBSD find(1) and Jörg Schilling's libfind/sfind neither print a diagnostic message nor return a non-zero exit status. This situation most commonly occurs when operating with -L and a symbolic link to a directory up the hierarchy is encountered. Such cases seem to be benign and can easily be backed out of. Other cases (e.g. a true directory loop through misuse of hard links) may indicate a problem in the file system. It may be convenient for the user to search through symbolically linked directory hierarchies without the search failing through a case that doesn't really affect the search. See also https://codeberg.org/schilytools/schilytools/issues/27 Desired Action: Please clarify if the find(1) utility is meant to consider a directory loop to be an error condition causing exit with a nonzero exit status. If it is intended to specify if it is, please add appropriate language, e.g. > When it detects an infinite loop, find shall write > a diagnostic message to standard error and shall either recover > its position in the hierarchy or terminate. In either case, > the exit status shall be nonzero. If it is intended that the implementation is free to consider this to be an error condition or not, please add appropriate language to RATIONALE indicating that this. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2022-09-23 23:11 Clausecker New Issue 2022-09-23 23:11 Clausecker Name => Robert Clausecker 2022-09-23 23:11 Clausecker Organization => Zuse Institute Berlin 2022-09-23 23:11 Clausecker Section => find 2022-09-23 23:11 Clausecker Page Number => 2761 2022-09-23 23:11 Clausecker Line Number => 90456–90458 ======================================================================