Skip to content

Commit

Permalink
src/common: Add find loop debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Feb 1, 2022
1 parent d183a47 commit b1a49b7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/common.bash
Expand Up @@ -293,7 +293,7 @@ function AconfCompileSystem() {
# Progress display - only show file names once per second
local progress_fd
exec {progress_fd}> \
>( gawk '
>( ( gawk '
BEGIN {
RS = "\0";
t = systime();
Expand All @@ -305,7 +305,7 @@ BEGIN {
printf "%s\0", $0;
system(""); # https://unix.stackexchange.com/a/83853/4830
}
}' | \
}' || FatalError 'gawk failed!\n' ) | \
while read -r -d $'\0' line
do
local path=${line:1}
Expand All @@ -323,6 +323,7 @@ BEGIN {
# NB: Regular expressions can be generated by AconfCreateFindIgnoreArgs
# The posix-extended regex type is used since it's easier to work
# with (e.g. no need to escape '|' alternations, parenthesis, etc.)
(
sudo find / \
-regextype posix-extended \
-not \
Expand All @@ -332,9 +333,11 @@ BEGIN {
\) \
-printf 'I' -print0 -prune \
\) \
-printf 'O' -print0 \
| tee /dev/fd/$progress_fd \
| ( grep \
-printf 'O' -print0 || FatalError 'find failed!\n'
) \
| (
tee /dev/fd/$progress_fd || FatalError 'tee failed!\n'
) | ( grep \
--null --null-data \
--invert-match \
--fixed-strings \
Expand Down

0 comments on commit b1a49b7

Please sign in to comment.