commit:     a8af8f7e995c7d1142794768b440e2ca0f02e4d4
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jul 27 20:20:16 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 08:14:21 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a8af8f7e

phase-helpers.sh: have unzip read /dev/null to impede interactive prompts

Rather than reinvent the wheel that is yes(1), redirect STDIN from
/dev/null. For the circumstances described by bug #336285, unzip will
immediately exit. In other situations where a prompt may appear, unzip
may print a message such as '(EOF or read error, treating as "[N]one"
...)' before immediately exiting, which is an improvement on the prior
behaviour. In either case, the exit status value will be something other
than zero.

Bug: https://bugs.gentoo.org/336285
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/phase-helpers.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 715c434ca6..3378d8971a 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -414,9 +414,9 @@ unpack() {
                                ;;
                        zip|jar)
                                # unzip will interactively prompt under some 
error conditions,
-                               # as reported in bug #336285
-                               ( set +x ; while true ; do echo n || break ; 
done ) | \
-                               unzip -qo "${srcdir}${f}" || die "${myfail}"
+                               # as reported in bug #336285. Inducing EOF on 
STDIN makes for
+                               # an adequate countermeasure.
+                               unzip -qo "${srcdir}${f}" </dev/null || die 
"${myfail}"
                                ;;
                        gz|z)
                                __unpack_tar "gzip -d"

Reply via email to