Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 586692 Details for
Bug 691776
portage-2.3.71: unpack should unconditionally die if an unpacker returns an error
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
unpack: Unconditionally die if an unpacker returns an error.
0001-unpack-Unconditionally-die-if-an-unpacker-returns-an.patch (text/plain), 7.96 KB, created by
Ulrich Müller
on 2019-08-12 20:23:14 UTC
(
hide
)
Description:
unpack: Unconditionally die if an unpacker returns an error.
Filename:
MIME Type:
Creator:
Ulrich Müller
Created:
2019-08-12 20:23:14 UTC
Size:
7.96 KB
patch
obsolete
>From 3cd5ccc270e18d4b4b83aa6db01c67fdcf74eebd Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@gentoo.org> >Date: Mon, 12 Aug 2019 22:20:16 +0200 >Subject: [PATCH] unpack: Unconditionally die if an unpacker returns an error. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >As specified by PMS: "If unpacking a supported file format fails, >unpack shall abort the build process." >https://projects.gentoo.org/pms/7/pms.html#x1-13500012.3.15: > >This partially reverts commit 5761a2ecb1a5178d2ea69a39725bdee368a754a5, >as far as unpack() is concerned. > >Bug: https://bugs.gentoo.org/691776 >Signed-off-by: Ulrich Müller <ulm@gentoo.org> >--- > bin/isolated-functions.sh | 11 +---- > bin/phase-helpers.sh | 87 +++++++++++---------------------------- > 2 files changed, 26 insertions(+), 72 deletions(-) > >diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh >index e4e769a04..39faec415 100644 >--- a/bin/isolated-functions.sh >+++ b/bin/isolated-functions.sh >@@ -38,18 +38,11 @@ __assert_sigpipe_ok() { > local x pipestatus=${PIPESTATUS[*]} > for x in $pipestatus ; do > # Allow SIGPIPE through (128 + 13) >- if [[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] >- then >- __helpers_die "$@" >- return 1 >- fi >+ [[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] && die "$@" > done > > # Require normal success for the last process (tar). >- if [[ $x -ne 0 ]]; then >- __helpers_die "$@" >- return 1 >- fi >+ [[ $x -eq 0 ]] || die "$@" > } > > shopt -s extdebug >diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh >index 02633125f..15fe8c682 100644 >--- a/bin/phase-helpers.sh >+++ b/bin/phase-helpers.sh >@@ -1,5 +1,5 @@ > #!/bin/bash >-# Copyright 1999-2018 Gentoo Foundation >+# Copyright 1999-2019 Gentoo Authors > # Distributed under the terms of the GNU General Public License v2 > > if ___eapi_has_DESTTREE_INSDESTTREE; then >@@ -347,10 +347,7 @@ unpack() { > die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}" > fi > fi >- if [[ ! -s ${srcdir}${x} ]]; then >- __helpers_die "unpack: ${x} does not exist" >- return 1 >- fi >+ [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" > > __unpack_tar() { > if [[ ${y_insensitive} == tar ]] ; then >@@ -361,18 +358,15 @@ unpack() { > "supported with EAPI '${EAPI}'. Instead use 'tar'." > fi > $1 -c -- "$srcdir$x" | tar xof - >- __assert_sigpipe_ok "$myfail" || return 1 >+ __assert_sigpipe_ok "$myfail" > else > local cwd_dest=${x##*/} > cwd_dest=${cwd_dest%.*} >- if ! $1 -c -- "${srcdir}${x}" > "${cwd_dest}"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail" > fi > } > >- myfail="unpack: failure unpacking ${x}" >+ myfail="failure unpacking ${x}" > case "${suffix_insensitive}" in > tar) > if ___eapi_unpack_is_case_sensitive && \ >@@ -381,10 +375,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'tar'." > fi >- if ! tar xof "$srcdir$x"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ tar xof "$srcdir$x" || die "$myfail" > ;; > tgz) > if ___eapi_unpack_is_case_sensitive && \ >@@ -393,10 +384,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'tgz'." > fi >- if ! tar xozf "$srcdir$x"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ tar xozf "$srcdir$x" || die "$myfail" > ;; > tbz|tbz2) > if ___eapi_unpack_is_case_sensitive && \ >@@ -406,7 +394,7 @@ unpack() { > "with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'." > fi > ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - >- __assert_sigpipe_ok "$myfail" || return 1 >+ __assert_sigpipe_ok "$myfail" > ;; > zip|jar) > if ___eapi_unpack_is_case_sensitive && \ >@@ -418,10 +406,8 @@ unpack() { > fi > # unzip will interactively prompt under some error conditions, > # as reported in bug #336285 >- if ! unzip -qo "${srcdir}${x}"; then >- __helpers_die "$myfail" >- return 1 >- fi < <(set +x ; while true ; do echo n || break ; done) >+ ( set +x ; while true ; do echo n || break ; done ) | \ >+ unzip -qo "${srcdir}${x}" || die "$myfail" > ;; > gz|z) > if ___eapi_unpack_is_case_sensitive && \ >@@ -430,7 +416,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'." > fi >- __unpack_tar "gzip -d" || return 1 >+ __unpack_tar "gzip -d" > ;; > bz2|bz) > if ___eapi_unpack_is_case_sensitive && \ >@@ -439,8 +425,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'." > fi >- __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \ >- || return 1 >+ __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" > ;; > 7z) > local my_output >@@ -457,10 +442,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'." > fi >- if ! unrar x -idq -o+ "${srcdir}${x}"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ unrar x -idq -o+ "${srcdir}${x}" || die "$myfail" > ;; > lha|lzh) > if ___eapi_unpack_is_case_sensitive && \ >@@ -470,10 +452,7 @@ unpack() { > "with EAPI '${EAPI}'." \ > "Instead use 'LHA', 'LHa', 'lha', or 'lzh'." > fi >- if ! lha xfq "${srcdir}${x}"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ lha xfq "${srcdir}${x}" || die "$myfail" > ;; > a) > if ___eapi_unpack_is_case_sensitive && \ >@@ -482,10 +461,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'a'." > fi >- if ! ar x "${srcdir}${x}"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ ar x "${srcdir}${x}" || die "$myfail" > ;; > deb) > if ___eapi_unpack_is_case_sensitive && \ >@@ -508,32 +484,20 @@ unpack() { > # deb2targz always extracts into the same directory as > # the source file, so create a symlink in the current > # working directory if necessary. >- if ! ln -sf "$srcdir$x" "$y"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ ln -sf "$srcdir$x" "$y" || die "$myfail" > created_symlink=1 > fi >- if ! deb2targz "$y"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ deb2targz "$y" || die "$myfail" > if [ $created_symlink = 1 ] ; then > # Clean up the symlink so the ebuild > # doesn't inadvertently install it. > rm -f "$y" > fi >- if ! mv -f "${y%.deb}".tar.gz data.tar.gz; then >- if ! mv -f "${y%.deb}".tar.xz data.tar.xz; then >- __helpers_die "$myfail" >- return 1 >- fi >- fi >+ mv -f "${y%.deb}".tar.gz data.tar.gz \ >+ || mv -f "${y%.deb}".tar.xz data.tar.xz \ >+ || die "$myfail" > else >- if ! ar x "$srcdir$x"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ ar x "$srcdir$x" || die "$myfail" > fi > ;; > lzma) >@@ -543,7 +507,7 @@ unpack() { > "suffix '${suffix}' which is unofficially supported" \ > "with EAPI '${EAPI}'. Instead use 'lzma'." > fi >- __unpack_tar "lzma -d" || return 1 >+ __unpack_tar "lzma -d" > ;; > xz) > if ___eapi_unpack_is_case_sensitive && \ >@@ -553,7 +517,7 @@ unpack() { > "with EAPI '${EAPI}'. Instead use 'xz'." > fi > if ___eapi_unpack_supports_xz; then >- __unpack_tar "xz -d" || return 1 >+ __unpack_tar "xz -d" > else > __vecho "unpack ${x}: file format not recognized. Ignoring." > fi >@@ -566,10 +530,7 @@ unpack() { > "with EAPI '${EAPI}'. Instead use 'txz'." > fi > if ___eapi_unpack_supports_txz; then >- if ! tar xof "$srcdir$x"; then >- __helpers_die "$myfail" >- return 1 >- fi >+ tar xof "$srcdir$x" || die "$myfail" > else > __vecho "unpack ${x}: file format not recognized. Ignoring." > fi >-- >2.22.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 691776
:
586608
| 586692