Skip to content

DEBUG: fincore/count recursive debug #3551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

teknoraver
Copy link
Contributor

No description provided.

@teknoraver teknoraver force-pushed the fincore_mu_debug branch 4 times, most recently from b8f6ce3 to 55661c7 Compare May 5, 2025 16:38
teknoraver and others added 2 commits May 5, 2025 19:00
Add a --recursive flag to fincore which allows to recursively scan
directories.

Co-authored-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Matteo Croce <teknoraver@meta.com>
@teknoraver teknoraver force-pushed the fincore_mu_debug branch 3 times, most recently from 9ad8ecb to 3212a1b Compare May 5, 2025 18:24
@masatake
Copy link
Member

masatake commented May 5, 2025

strace has 'append-mode'. I guess it helps you.

      -A
       --output-append-mode
                   Open the file provided in the -o option in append mode.

@teknoraver
Copy link
Contributor Author

I created an armv7 locally and here the output is:

$ .libs/fincore -R i_dir
recursive
fts_open
fts_read: fts_path: 'i_dir', fts_info: 1
fts_read: fts_path: 'i_dir/EMPTY_FILE', fts_info: 8
ent: i_dir/EMPTY_FILE
fts_read: fts_path: 'i_dir/PAGESIZE_-1__incore_', fts_info: 8
ent: i_dir/PAGESIZE_-1__incore_
fts_read: fts_path: 'i_dir/JUST_PAGESIZE_incore_', fts_info: 8
ent: i_dir/JUST_PAGESIZE_incore_
fts_read: fts_path: 'i_dir', fts_info: 6
RES PAGES SIZE FILE
 0B     0   0B i_dir/EMPTY_FILE
 0B     0  32B i_dir/PAGESIZE_-1__incore_
 0B     0   4K i_dir/JUST_PAGESIZE_incore_

While in the CI is:

recursive
fts_open
fts_read: fts_path: 'i_dir', fts_info: 1
fts_read: fts_path: 'i_dir', fts_info: 6

The flags are respectively FTS_D and FTS_DP.
It's like fts_read() doesn't see the directory members in i_dir

footer "$?"
} >> $TS_OUTPUT 2>> $TS_ERRLOG

if [ -n "$RECURSIVE" ]; then
mkdir -p $TS_OUTDIR/i_dir

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using mkdir $(make_input_name "dir") to keep the "i_" prefix only in make_incpur_name. You also do not need to use $TS_OUTDIR as it runs in the directory (see ts_cd).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will fix this in the original PR when I'll figure out what is the armv7 issue

} >> $TS_OUTPUT 2>> $TS_ERRLOG

ts_log_both "[ RECURSIVE SCAN ]"
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add debug output with ls—la for the directory to verify that the content is really there. It sounds strange, but sleeping/sync before the recursive call may help.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the content is really there, I run find:

find i_dir -ls
   348203      4 drwxr-xr-x   2 root     root         4096 May  6 00:43 i_dir
   348204      0 -rw-r--r--   1 root     root            0 May  6 00:43 i_dir/EMPTY_FILE
   348206      4 -rw-r--r--   1 root     root         4096 May  6 00:43 i_dir/JUST_PAGESIZE_incore_
   348205      4 -rw-r--r--   1 root     root         4095 May  6 00:43 i_dir/PAGESIZE_-1__incore_

and also fincore with a glob:

RUN: fincore --raw --output PAGES,SIZE,FILE --bytes --raw i_dir/*
PAGES SIZE FILE
0 0 i_dir/EMPTY_FILE
1 4096 i_dir/JUST_PAGESIZE_incore_
1 4095 i_dir/PAGESIZE_-1__incore_
END: EXIT 0


echo 'find i_dir -ls'
find i_dir -ls

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Sorry.

@karelzak
Copy link
Collaborator

karelzak commented May 6, 2025

By the way, gnulib has a private FTS implementation that differs from glibc. https://github.com/coreutils/gnulib/blob/master/lib/fts.c

@teknoraver
Copy link
Contributor Author

By the way, gnulib has a private FTS implementation that differs from glibc. https://github.com/coreutils/gnulib/blob/master/lib/fts.c

I know, I faced it when doing the first mu implementation, which was based on du.
And the gnulib does some weird stuff, like ignoring FTS_NOSTAT etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants