bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

find -depth bug


From: Joseph S. Myers
Subject: find -depth bug
Date: Tue, 15 Feb 2005 00:24:49 +0000 (UTC)

With findutils 4.2.15, find -depth seems not always to find all matching 
files.

The attached script creates a number of files and directories (the order 
in which these are created and appear in the directory may be of 
significance).  "find 1 -depth -type d" should output

1/2/3
1/2/20
1/2/37
1/2/54
1/2/55/56
1/2/55/57
1/2/55/58
1/2/55/59
1/2/55
1/2
1

but instead outputs just

1/2/54
1/2/55/56
1/2/55/57
1/2/55/58
1/2/55/59
1/2/55

Debugging output from a --enable-debug build:

debug_stat (/)
debug_stat (/var)
debug_stat (/usr/src)
debug_stat (/home)
debug_stat (/proc)
debug_stat (/dev/pts)
debug_stat (/dev/shm)
cur_day_start = Mon Feb 14 00:19:44 2005
Predicate List:
( type ) and print 
Eval Tree:
pred = and      type = bi_op        prec = and      addr = 0x805e128
left:
    pred = type     type = primary       prec = no       addr = 0x805d020
    Needs type
    left:
    right:
right:
    pred = print    type = primary       prec = no       addr = 0x805e1a0
    left:
    right:
Normalized Eval Tree:
pred = and      type = bi_op        prec = and      addr = 0x805e128
left:
    pred = and      type = bi_op        prec = and      addr = 0x805e218
    left:
    right:
        pred = type     type = primary       prec = no       addr = 0x805d020
        Needs type
        left:
        right:
right:
    pred = print    type = primary       prec = no       addr = 0x805e1a0
    left:
    right:
Optimized Eval Tree:
pred = and      type = bi_op        prec = and      addr = 0x805e128
left:
    pred = and      type = bi_op        prec = and      addr = 0x805e218
    Needs type
    left:
    right:
        pred = type     type = primary       prec = no       addr = 0x805d020
        Needs type
        left:
        right:
right:
    pred = print    type = primary       prec = no       addr = 0x805e1a0
    left:
    right:
Optimized command line:
[type needed here] type and print 
debug_stat (.)
debug_stat (1)
pathname = 1, stop_at_current_level = 0
debug_stat (1)
safely_chdir(): chdir("1")
debug_stat (.)
debug_stat (2)
pathname = 1/2, stop_at_current_level = 0
debug_stat (2)
safely_chdir(): chdir("2")
debug_stat (.)
debug_stat (3)
pathname = 1/2/3, stop_at_current_level = 0
debug_stat (3)
safely_chdir(): chdir("3")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
debug_stat (20)
pathname = 1/2/20, stop_at_current_level = 0
debug_stat (20)
safely_chdir(): chdir("20")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
debug_stat (37)
pathname = 1/2/37, stop_at_current_level = 0
debug_stat (37)
safely_chdir(): chdir("37")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
debug_stat (54)
pathname = 1/2/54, stop_at_current_level = 0
debug_stat (54)
safely_chdir(): chdir("54")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
1/2/54
debug_stat (55)
pathname = 1/2/55, stop_at_current_level = 0
debug_stat (55)
safely_chdir(): chdir("55")
debug_stat (.)
debug_stat (56)
pathname = 1/2/55/56, stop_at_current_level = 0
debug_stat (56)
safely_chdir(): chdir("56")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
1/2/55/56
debug_stat (57)
pathname = 1/2/55/57, stop_at_current_level = 0
debug_stat (57)
safely_chdir(): chdir("57")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
1/2/55/57
debug_stat (58)
pathname = 1/2/55/58, stop_at_current_level = 0
debug_stat (58)
safely_chdir(): chdir("58")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
1/2/55/58
debug_stat (59)
pathname = 1/2/55/59, stop_at_current_level = 0
debug_stat (59)
safely_chdir(): chdir("59")
debug_stat (.)
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
1/2/55/59
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
1/2/55
debug_stat (..)
safely_chdir(): chdir("..")
debug_stat (.)
debug_stat (.)
chdir_back(): chdir(<starting-point>)
debug_stat (.)
safely_chdir(): chdir(".")
debug_stat (.)
debug_stat (.)

-- 
Joseph S. Myers
address@hidden

Attachment: find-bug-script
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]