From: Fabian Groffen <grobian@gentoo.org>
To: gentoo-alt@lists.gentoo.org
Subject: Re: [gentoo-alt] [PATCH] script/bootstrap-prefix.sh: check PIPESTATUS on unpack
Date: Sat, 19 Feb 2022 17:09:36 +0100 [thread overview]
Message-ID: <YhEWQPOysru8rQKr@gentoo.org> (raw)
In-Reply-To: <20220219153420.17712-1-cyber+gentoo@sysrq.in>
[-- Attachment #1: Type: text/plain, Size: 3720 bytes --]
Hi!
This looks like both an improvement as well as a fix.
Applied as 52e3a39449 and pushed, thanks!
Fabian
On 19-02-2022 20:34:21 +0500, Anna Vyalkova wrote:
> Both programs need to exit with status 0.
>
> Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
> ---
> I encountered a situation when bzip2 failed but tar didn't return error
> code. This patch fixes it.
>
> Tested with stage1 (can't get past it).
>
> scripts/bootstrap-prefix.sh | 51 +++++++++++++++++++++----------------
> 1 file changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
> index 76383c0210..b8ad960e6d 100755
> --- a/scripts/bootstrap-prefix.sh
> +++ b/scripts/bootstrap-prefix.sh
> @@ -602,8 +602,8 @@ do_tree() {
> fi
> einfo "Unpacking, this may take a while"
> estatus "stage1: unpacking Portage tree"
> - bzip2 -dc ${DISTDIR}/$2 | \
> - tar -xf - -C ${PORTDIR} --strip-components=1 || return 1
> + bzip2 -dc ${DISTDIR}/$2 | tar -xf - -C ${PORTDIR} --strip-components=1
> + [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
> touch ${PORTDIR}/.unpacked
> fi
> }
> @@ -692,7 +692,8 @@ bootstrap_portage() {
> rm -rf "${S}" >& /dev/null
> mkdir -p "${S}" >& /dev/null
> cd "${S}"
> - bzip2 -dc "${DISTDIR}/${A}" | tar -xf - || return 1
> + bzip2 -dc "${DISTDIR}/${A}" | tar -xf -
> + [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
> S="${S}/prefix-portage-${PV}"
> cd "${S}"
>
> @@ -787,7 +788,8 @@ bootstrap_simple() {
> bz2) decomp=bzip2 ;;
> gz|"") decomp=gzip ;;
> esac
> - ${decomp} -dc "${DISTDIR}"/${A} | tar -xf - || return 1
> + ${decomp} -dc "${DISTDIR}"/${A} | tar -xf -
> + [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
> S="${S}"/${PN}-${PV}
> cd "${S}"
>
> @@ -842,18 +844,21 @@ bootstrap_gnu() {
> rm -rf "${S}"
> mkdir -p "${S}"
> cd "${S}"
> - if [[ ${t} == "tar.gz" ]] ; then
> - gzip -dc "${DISTDIR}"/${URL##*/} | tar -xf - || continue
> - elif [[ ${t} == "tar.xz" ]] ; then
> - xz -dc "${DISTDIR}"/${URL##*/} | tar -xf - || continue
> - elif [[ ${t} == "tar.bz2" ]] ; then
> - bzip2 -dc "${DISTDIR}"/${URL##*/} | tar -xf - || continue
> - elif [[ ${t} == "tar" ]] ; then
> - tar -xf "${DISTDIR}"/${A} || continue
> - else
> - einfo "unhandled extension: $t"
> - return 1
> - fi
> + case ${t} in
> + tar.xz) decomp=xz ;;
> + tar.bz2) decomp=bzip2 ;;
> + tar.gz) decomp=gzip ;;
> + tar)
> + tar -xf "${DISTDIR}"/${A} || continue
> + break
> + ;;
> + *)
> + einfo "unhandled extension: $t"
> + return 1
> + ;;
> + esac
> + ${decomp} -dc "${DISTDIR}"/${URL##*/} | tar -xf -
> + [[ ${PIPESTATUS[*]} == '0 0' ]] || continue
> break
> done
> S="${S}"/${PN}-${PV}
> @@ -1202,7 +1207,8 @@ bootstrap_cmake_core() {
> rm -rf "${S}"
> mkdir -p "${S}"
> cd "${S}"
> - gzip -dc "${DISTDIR}"/${A} | tar -xf - || return 1
> + gzip -dc "${DISTDIR}"/${A} | tar -xf -
> + [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
> S="${S}"/cmake-${PV}
> cd "${S}"
>
> @@ -1253,11 +1259,12 @@ bootstrap_zlib_core() {
> rm -rf "${S}"
> mkdir -p "${S}"
> cd "${S}"
> - if [[ ${A} == *.tar.gz ]] ; then
> - gzip -dc "${DISTDIR}"/${A} | tar -xf - || return 1
> - else
> - bzip2 -dc "${DISTDIR}"/${A} | tar -xf - || return 1
> - fi
> + case ${A} in
> + *.tar.gz) decomp=gzip ;;
> + *) decomp=bzip2 ;;
> + esac
> + ${decomp} -dc "${DISTDIR}"/${A} | tar -xf -
> + [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1
> S="${S}"/zlib-${PV}
> cd "${S}"
>
> --
> 2.35.1
>
>
--
Fabian Groffen
Gentoo on a different level
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2022-02-19 16:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-19 15:34 [gentoo-alt] [PATCH] script/bootstrap-prefix.sh: check PIPESTATUS on unpack Anna Vyalkova
2022-02-19 16:09 ` Fabian Groffen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YhEWQPOysru8rQKr@gentoo.org \
--to=grobian@gentoo.org \
--cc=gentoo-alt@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox