From: banders AT ECD DOT Rockwell DOT COM (Bartlee A. Anderson) Subject: Re: interesting problem with "find" 11 Nov 1997 07:43:53 -0800 Message-ID: <346874E8.571D.cygnus.gnu-win32@switch.rockwell.com> References: <971110155522 DOT 24a00358 AT d0tng DOT fnal DOT gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Alan Jonckheere at Fermi National Accelerator Lab Cc: gnu-win32 AT cygnus DOT com I've noticed a similar problem with rm. In directories with structure something/yada/yada/other/... rm -rf will tell you that you have a circular directory structure and to notify your administrator, it is almost certainly corrupt. You have to remove from the second yada and then once it's gone, the original command will work. Yuck. Alan Jonckheere at Fermi National Accelerator Lab wrote: > > One of my collegues just found an interesting behavior in "find". We are running > cywin32 b18, cygwin.dll is Sergey's latest, and the find that comes with it on > NT4.0. > > He has found that if you have nested directories of the same name eg) x/x/... or > even x/y/x/... and type "find . -name '*' -print", nothing is found except the > directories. Renaming the top level directory to anything else or specifying the > top directory rather than using "." "fixes" the problem. However, the results > are somewhat contradictory. Could someone explain the following series of > results? (all within the b18 bash shell): > > We start with a directory tree containing only: > x/y/x/zz.tmp then: > > 1) find . -name * -print > ./x > ./x/y/x > bash is globbing *->x and looking for that as expected, finding the 2 > directories. > > 2) find . -name "*" -print > ./x > ./x/y > ./x/y/x > This should work, globbing is escaped. But it finds only the directories, not > the file. Single or double quotes or backslash have the same behavior. > > 3) find . -name *.tmp -print > finds nothing: globbing again, can't find "x.tmp" > > 4) find . -name "*.tmp" -print > finds nothing. This should work. > > Substituting "x" for "." in the four cases: > > 1) find x -name * -print > x > x/y/x > Get the expected result, looking for "x" > > 2) find x -name "*" -print > x > x/y > x/y/x > x/y/x/zz.tmp > This is what it should be. Why didn't it work with "."? > > 3) find x -name *.tmp -print > x/y/x/zz.tmp > I would have thought that this would fail. It should be looking for "x.tmp" or > maybe "y.tmp" depending on which directory it's globbing in. > > 4) find x -name "*.tmp" -print > x/y/x/zz.tmp > This is as expected. > > Renaming either of the "x" directories to z so that we have, for example: > z/y/x/zz.tmp (same result with x/y/z/zz.tmp) > 1) find . -name * -print > ./z > as expected after globbing. > > 2) and 4) give the results you'd expect, they find either all files or only the > .tmp file since the "*" is escaped. > > 3) however works just like 4), as if the "*" were escaped. > > Alan > - > For help on using this list (especially unsubscribing), send a message to > "gnu-win32-request AT cygnus DOT com" with one line of text: "help". -- Bartlee A. Anderson | Sys. Test (ISDN-Commands-Trans Link-Tools) Rockwell International | Electronic Commerce Division 300 Bauman Ct. | banders AT ecd DOT rockwell DOT com MS 933-605 Opinions my own, not Rockwell's VOICE (630) 227-8975 Wood Dale, IL 60191 | FAX (630) 227-9771 - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".