commit: b641149a4a03cab0a5934ad46d8adea4c55f65e8
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jun 10 09:17:55 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 11 03:26:23 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b641149a
estrip: don't treat find_path as an ERE sub-pattern
Presently, the do_queue() function performs the following test in the
course of consuming pathnames from the scanelf(1) utility.
[[ "${needed_entry_file}" =~ ^${find_path##"${D}"} ]]
Given that the expansion of 'find_path' is unquoted, its value is
treated as a component of an extended regular expression. Address this
by properly quoting the expansion.
Use the == operator to match an equivalent glob, as opposed to the =~
operator. ERE matching is always slower in bash.
Refrain from employing the ${param##"$prefix"} form of expansion, given
that ${param#"$prefix"} does exactly the same thing while properly
communicating the intent.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/estrip | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/estrip b/bin/estrip
index b3ba71bbed..d24a2663fd 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -378,7 +378,7 @@ do_queue() {
# matches the path given
# e.g. find_path="/usr/lib64" will match
needed_entry="/usr/lib64/libfoo.so libc.so".
needed_entry_file="${needed_entry% *}"
- if [[ "${needed_entry_file}" =~
^${find_path##"${D}"} ]] ; then
+ if [[ ${needed_entry_file} ==
"${find_path#"${D}"}"* ]]; then
scanelf_results+=(
"${D}${needed_entry_file}" )
fi
done