Print this page
12328 FNMPERIOD makes little sense for find -path

@@ -20,10 +20,11 @@
  */
 /*
  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2013 Andrew Stormont.  All rights reserved.
+ * Copyright 2020 Joyent, Inc.
  */
 
 
 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
 /*        All Rights Reserved   */

@@ -1025,12 +1026,15 @@
                          * XPG4 find should not treat a leading '.' in a
                          * filename specially for pattern matching.
                          * /usr/bin/find  will not pattern match a leading
                          * '.' in a filename, unless '.' is explicitly
                          * specified.
+                         *
+                         * The legacy behavior makes no sense for PATH.
                          */
 #ifndef XPG4
+                        if (np->action == NAME || np->action == INAME)
                         fnmflags |= FNM_PERIOD;
 #endif
 
                         val = !fnmatch(np->first.cp,
                             (np->action == NAME || np->action == INAME) ?