Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 586608 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), 6.87 KB, created by
Ulrich Müller
on 2019-08-12 13:11:56 UTC
(
hide
)
Description:
unpack: Unconditionally die if an unpacker returns an error.
Filename:
MIME Type:
Creator:
Ulrich Müller
Created:
2019-08-12 13:11:56 UTC
Size:
6.87 KB
patch
obsolete
>From 3273f899021c37707c958c1dbd3cd6c6e73fe3e8 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@gentoo.org> >Date: Mon, 12 Aug 2019 15:11:04 +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: > >Bug: https://bugs.gentoo.org/691776 >Signed-off-by: Ulrich Müller <ulm@gentoo.org> >--- > bin/phase-helpers.sh | 81 ++++++++++++-------------------------------- > 1 file changed, 22 insertions(+), 59 deletions(-) > >diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh >index 02633125f..0baf12d4b 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 "unpack: ${x} does not exist" > > __unpack_tar() { > if [[ ${y_insensitive} == tar ]] ; then >@@ -361,14 +358,11 @@ 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}" || die > 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 > } > >@@ -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}" || die > ;; > zip|jar) > if ___eapi_unpack_is_case_sensitive && \ >@@ -419,8 +407,7 @@ unpack() { > # unzip will interactively prompt under some error conditions, > # as reported in bug #336285 > if ! unzip -qo "${srcdir}${x}"; then >- __helpers_die "$myfail" >- return 1 >+ die "${myfail}" > fi < <(set +x ; while true ; do echo n || break ; done) > ;; > gz|z) >@@ -430,7 +417,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" || die "${myfail}" > ;; > bz2|bz) > if ___eapi_unpack_is_case_sensitive && \ >@@ -440,7 +427,7 @@ unpack() { > "with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'." > fi > __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \ >- || return 1 >+ || die "${myfail}" > ;; > 7z) > local my_output >@@ -457,10 +444,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 +454,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 +463,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 +486,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 +509,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" || die "${myfail}" > ;; > xz) > if ___eapi_unpack_is_case_sensitive && \ >@@ -553,7 +519,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" || die "${myfail}" > else > __vecho "unpack ${x}: file format not recognized. Ignoring." > fi >@@ -566,10 +532,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