Bug in find?

Brian D. Carlstrom bdc@martigny.ai.mit.edu
Sun May 17 15:48:00 GMT 1998


We use some of the gnu-win32 tools as part of our build process on NT. I
was using find to create a list of Java class files for archiving and
mysteriously some were not making it into the zip file. 

I made the observation that find was not descending into directories
that had a repeated path segment such as findlosage/quux/foo/foo or
findlosage/quux/foo/quux. This was running the find starting in the
findlosage directory. 

However if the starting directory is one lower, it will find
quux/foo/quux but not quux/foo/foo still, since running from the quux
directory it does not see the repeated path segment any more presumably.

I wrote the following sh script to test the problem. It works fine on
the unix box I'm posting this from which happens to have the same
version of GNU find (4.1) so I'm guessing it's not pilot error. 

For the moment I've worked around by using mks, but I'd rather not have
to require that...

I'm not on the list at the moment so please CC me in any replies.

-bri

#
# Why doesn't this print the files in:
#
#     c:/temp/findlosage/quux/foo/foo
#     c:/temp/findlosage/quux/foo/quux
#
# The only thing that makes them special is the repeated path segment
#
FINDDIR=${TMPDIR}/findlosage

FOODIR=${FINDDIR}/quux/foo
rm -rf ${FINDDIR}
mkdir -p ${FINDDIR}
mkdir -p ${FOODIR}
mkdir ${FOODIR}/foo
mkdir ${FOODIR}/bar
mkdir ${FOODIR}/baz
mkdir ${FOODIR}/quux
for i in ${FOODIR}/*; do touch $i/1 $i/2 $i/3; done

find ${FINDDIR} -type f > findlosage.out
linecount=`wc -l findlosage.out | awk '{print $1}'`
if [ ! "${linecount}" = "12" ] ; then
    echo 
    echo expected line count of 12, received ${linecount}
    echo find results were:
    cat findlosage.out
fi

find ${FINDDIR}/quux -type f > findlosage.out
linecount=`wc -l findlosage.out | awk '{print $1}'`
if [ ! "${linecount}" = "12" ] ; then
    echo 
    echo expected line count of 12, received ${linecount}
    echo find results were:
    cat findlosage.out
fi

find ${FINDDIR}/quux/foo -type f > findlosage.out
linecount=`wc -l findlosage.out | awk '{print $1}'`
if [ ! "${linecount}" = "12" ] ; then
    echo 
    echo expected line count of 12, received ${linecount}
    echo find results were:
    cat findlosage.out
fi

rm findlosage.out
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list