Home Explore Blog CI



man-pages

21th chunk of `find.man`
667e0a3dd5e65eb866ae4336a7bca61dbc00147c5c7171d70000000100000fff
 depends on the POSIX conformance of the system’s fnmatch(3) library function.  As of findutils‐4.2.2, shell metacharacters (‘*’, ‘?’ or ‘[]’ for example) match  a
              leading ‘.’, because IEEE PASC interpretation 126 requires this.  This is a change from previous versions of findutils.

       -type  Supported.   POSIX  specifies ‘b’, ‘c’, ‘d’, ‘l’, ‘p’, ‘f’ and ‘s’.  GNU find also supports ‘D’, representing a Door, where the OS provides these.  Furthermore, GNU find allows multiple types to be specified at
              once in a comma‐separated list.

       -ok    Supported.  Interpretation of the response is according to the ‘yes’ and ‘no’ patterns selected by setting the LC_MESSAGES environment variable.  When the POSIXLY_CORRECT environment variable is set, these pat‐
              terns are taken system’s definition of a positive (yes) or negative (no) response.  See the system’s documentation for nl_langinfo(3), in particular YESEXPR and NOEXPR.  When POSIXLY_CORRECT  is  not  set,  the
              patterns are instead taken from find’s own message catalogue.

       -newer Supported.   If  the file specified is a symbolic link, it is always dereferenced.  This is a change from previous behaviour, which used to take the relevant time from the symbolic link; see the HISTORY section
              below.

       -perm  Supported.  If the POSIXLY_CORRECT environment variable is not set, some mode arguments (for example +a+x) which are not valid in POSIX are supported for backward‐compatibility.

       Other primaries
              The primaries -atime, -ctime, -depth, -exec, -group, -links, -mtime, -nogroup, -nouser, -ok, -path, -print, -prune, -size, -user and -xdev are all supported.

       The POSIX standard specifies parentheses ‘(’, ‘)’, negation ‘!’ and the logical AND/OR operators -a and -o.

       All other options, predicates, expressions and so forth are extensions beyond the POSIX standard.  Many of these extensions are not unique to GNU find, however.

       The POSIX standard requires that find detects loops:

              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.

       GNU  find complies with these requirements.  The link count of directories which contain entries which are hard links to an ancestor will often be lower than they otherwise should be.  This can mean that GNU find will
       sometimes optimise away the visiting of a subdirectory which is actually a link to an ancestor.  Since find does not actually enter such a subdirectory, it is allowed to avoid emitting a diagnostic message.   Although
       this behaviour may be somewhat confusing, it is unlikely that anybody actually depends on this behaviour.  If the leaf optimisation has been turned off with -noleaf, the directory entry will always be examined and the
       diagnostic  message will be issued where it is appropriate.  Symbolic links cannot be used to create filesystem cycles as such, but if the -L option or the -follow option is in use, a diagnostic message is issued when
       find encounters a loop of symbolic links.  As with loops containing hard links, the leaf optimisation will often mean that find knows that it doesn’t need to call stat() or chdir() on the symbolic link, so this  diag‐
       nostic is frequently not necessary.

       The -d option is supported for compatibility with various BSD systems, but you should use the POSIX‐compliant option -depth instead.

       The POSIXLY_CORRECT environment variable does not affect the behaviour of the -regex or -iregex tests because those tests aren’t specified in the POSIX standard.

ENVIRONMENT VARIABLES
       LANG   Provides a default value for the internationalization variables that are

Title: POSIX Compliance and Environment Variables in `find`
Summary
This section continues discussing the `find` command's adherence to the POSIX standard, focusing on options like `-type`, `-ok`, `-newer`, and `-perm`. It explains how the `POSIXLY_CORRECT` and `LC_MESSAGES` environment variables influence their behavior. It also covers loop detection and the handling of symbolic links. The section highlights that options like `-regex` and `-iregex` are not part of the POSIX standard. Finally, it briefly mentions the role of the `LANG` environment variable.