commit: cb193df5deb262dfec1ca06a6bfd0f411df7ba41
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Jun 4 10:56:00 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 4 19:57:04 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cb193df5
estrip: strategically disarm save_elf_sources() and dedup_elf_debug()
Presently, there are a few conditions under which both the
save_elf_sources() and dedup_elf_debug() functions choose to return 0
without having done anything. Let us take the first of these functions
as a case in point. Should the "installsources" feature be disabled - or
restricted - the function will return. Also, should the debugedit(1)
utility be missing, the function will issue a warning and return, going
to the expense of tracking whether it has previously issued a warning in
that context.
Simplify matters by having these functions disarm themselves in
situations where it is understood that they have nothing to do. This is
accomplished by having the function re-declare itself just before
returning. The replacement function will be one that does nothing beyond
invoking the true builtin.
See-also: b10a9a5a8c8a532911f2396472ad8af94d93bc3f
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/estrip | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/bin/estrip b/bin/estrip
index aacb474c70..cb66a77841 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -213,15 +213,15 @@ mkdir -p "${tmpdir}"/{inodes,splitdebug,sources}
# Usage: save_elf_sources <elf>
save_elf_sources() {
+ # shellcheck disable=2317
if (( ! has_feature[installsources] || has_restriction[installsources]
)); then
+ save_elf_sources() { :; }
return
elif [[ ! ${name_of[debugedit]} ]]; then
- if ! contains_word installsources "${warned_for[debugedit]}";
then
- warned_for[debugedit]+=" installsources"
- ewarn "FEATURES=installsources is enabled but the
debugedit binary could not be"
- ewarn "found. This feature will not work unless
debugedit is installed!"
- fi
- return 0
+ ewarn "FEATURES=installsources is enabled but the debugedit
binary could not be"
+ ewarn "found. This feature will not work unless debugedit is
installed!"
+ save_elf_sources() { :; }
+ return
fi
local x=$1
@@ -253,19 +253,17 @@ __try_symlink() {
# Usage: dedup_elf_debug <src> <inode_dedupdebug>
dedup_elf_debug() {
- if (( ! has_feature[dedupdebug] || has_restriction[dedupdebug] )); then
- return
- fi
-
debug-print-function "${FUNCNAME}" "$@"
- if [[ ! ${name_of[dwz]} ]]; then
- if ! contains_word dedupdebug "${warned_for[dwz]}"; then
- warned_for[dwz]+=" dedupdebug"
- ewarn "FEATURES=dedupdebug is enabled but the dwz
binary could not be"
- ewarn "found. This feature will not work unless dwz is
installed!"
- fi
- return 0
+ # shellcheck disable=2317
+ if (( ! has_feature[dedupdebug] || has_restriction[dedupdebug] )); then
+ dedup_elf_debug() { :; }
+ return
+ elif [[ ! ${name_of[dwz]} ]]; then
+ ewarn "FEATURES=dedupdebug is enabled but the dwz binary could
not be"
+ ewarn "found. This feature will not work unless dwz is
installed!"
+ dedup_elf_debug() { :; }
+ return
fi
local src=$1 # File to dedup debug symbols