commit:     d4bdae2340f35b9e22c149b359ead0f0028f2747
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jun 10 00:01:23 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 11 03:26:21 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d4bdae23

estrip: use the -files0-from option of GNU find

GNU findutils 4.9.0 introduces a new -files0-from option. It improves
the interface of find(1) by allowing for it to be invoked in such a way
that the specified paths cannot possibly be confused with options and
primaries. Have estrip make use of this feature by employing the find0()
function, which is defined by the "isolated-functions.sh" unit.

See-also: a0210b3c49ea346b1e999f92a7ed89802e8d6849
See-also: d887c7fd33b5f136ff62d423d7a11980fb9faca1
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/estrip | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bin/estrip b/bin/estrip
index 1ee391c96e..56f24d45a7 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -333,7 +333,7 @@ do_ignore() {
        done
 
        if (( ${#skip_dirs[@]} )); then
-               find "${skip_dirs[@]}" -name '*.estrip' -delete || die
+               printf '%s\0' "${skip_dirs[@]}" | find0 -name '*.estrip' 
-delete || die
        fi
 }
 
@@ -389,7 +389,7 @@ do_queue() {
                : >> "${path}.estrip" || die
        done < <(
                (( ${#scanelf_results[@]} )) && printf "%s\n" 
"${scanelf_results[@]}"
-               find "${find_paths[@]}" -type f ! -type l -name '*.a'
+               printf '%s\0' "${find_paths[@]}" | find0 -type f ! -type l 
-name '*.a'
        )
 }
 
@@ -570,14 +570,14 @@ if (( do_prepstrip )); then
                        if (( ${#needed_contents[@]} )); then
                                printf "%s\n" "${needed_contents[@]}"
                        fi
-                       find "$@" -type f ! -type l -name '*.a'
+                       printf '%s\0' "$@" | find0 -type f ! -type l -name '*.a'
                ) | LC_ALL=C sort -u
        )
 else
        while IFS= read -d '' -r x ; do
                inode_link=$(get_inode_number "${x%.estrip}") || die "stat 
failed unexpectedly"
                echo "${x%.estrip}" >> "${inode_link}" || die "echo failed 
unexpectedly"
-       done < <(find "${ED}" -name '*.estrip' -delete -print0)
+       done < <(printf '%s\0' "${ED}" | find0 -name '*.estrip' -delete -print0)
 fi
 
 # Now we look for unstripped binaries.
@@ -684,7 +684,7 @@ then
        # https://bugzilla.redhat.com/show_bug.cgi?id=444310
        while read -r -d $'\0' emptydir; do
                : >> "${emptydir}"/.keepdir
-       done < <(find "${D%/}/${prepstrip_sources_dir#/}/" -type d -empty 
-print0)
+       done < <(printf '%s\0' "${D%/}/${prepstrip_sources_dir#/}/" | find0 
-type d -empty -print0)
 fi
 
 # Collect any outstanding warnings and convey them through ewarn.

Reply via email to