bugfindutils - Bugs: bug #62480, find -D stat cannot print anything

 
 

bug #62480: find -D stat cannot print anything

Submitter:  Shuiqing Zhou <zhoushuiqing>
Submitted:  Tue 17 May 2022 01:16:55 PM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Working as Intended
Privacy:  Public Assigned to:  berny
Originator Name:  Open/Closed:  Closed
Release:  4.8.0 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 18 May 2022 06:03:42 AM UTC, comment #3: 

Thanks, I'm hereby closing this issue.

Bernhard Voelker <berny>
Group administrator
Wed 18 May 2022 02:49:54 AM UTC, comment #2: 

Thank you very much, I am interested in this program so I am learning it

Shuiqing Zhou <zhoushuiqing>
Tue 17 May 2022 03:13:33 PM UTC, comment #1: 

The point is that `find` does not have to invoke stat() for
an invocation using the default -print.  Reading the directory
entries is sufficient for that.

One has to use tests or actions which need a stat(), e.g.:

# Prepare some files with different size.
$ touch f0
$ for f in 1 100 1000; do if=/dev/zero bs=1 count=$f > f$f; done

# -ls needs stat().
$ find -D stat -ls
   409613      4 drwxr-xr-x   2 berny    users        4096 May 17 17:07 .
debug_stat (f0)
   394313      0 -rw-r--r--   1 berny    users           0 May 17 17:07 ./f0
debug_stat (f100)
   393551      0 -rw-r--r--   1 berny    users           0 May 17 17:07 ./f100
debug_stat (f1000)
   394287      0 -rw-r--r--   1 berny    users           0 May 17 17:07 ./f1000
debug_stat (f1)
   393513      0 -rw-r--r--   1 berny    users           0 May 17 17:07 ./f1



# -size needs stat().
$ find -D stat . -size -300c
debug_stat (f0)
./f0
debug_stat (f100)
./f100
debug_stat (f1000)
./f1000
debug_stat (f1)
./f1


Therefore, -D stat works as expected.

Bernhard Voelker <berny>
Group administrator
Tue 17 May 2022 01:16:55 PM UTC, original submission:  

I want to get fileinfo by find -D stat, but it prints nothing in my terminal. How can I get DebugStat info?
OS: centos.
find (GNU findutils) 4.8.0
In the source code file, I can find something about debugstat.
in ftsfind.c:
  if (options.debug_options & DebugStat)
  {
    options.xstat = debug_stat;
  }

then I check debug_stat(), it seems to be ok...

[root@localhost doc]#mkdir /home/doc/test1 /home/doc/test2
[root@localhost doc]# touch /home/doc/test1/1.txt
[root@localhost doc]# ln -s /home/doc/test1/1.txt
[root@localhost doc]# find -D stat  /home/doc/test1
/home/doc/test1
/home/doc/test1/1.txt
[root@localhost doc]# find -D stat -L  /home/doc/test2
/home/doc/test2
/home/doc/test2/2

Looking forward to your reply



Shuiqing Zhou <zhoushuiqing>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by berny (Posted a comment)
  • -email is unavailable- added by zhoushuiqing (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-18 berny Open/ClosedOpen Closed
    2022-05-17 berny StatusNone Working as Intended
        Assigned toNone berny

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code