Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 03/15] unpacker.eclass: Fix unpack_7z to respect the exit status
Date: Sun, 25 Sep 2022 18:24:22
Message-Id: 20220925182317.1559529-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/15] unpacker.eclass: Tests, bugfixes and GPKG support by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/unpacker.eclass | 5 ++++-
4 1 file changed, 4 insertions(+), 1 deletion(-)
5
6 diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
7 index c26523a419df..1f2f09e33ad6 100644
8 --- a/eclass/unpacker.eclass
9 +++ b/eclass/unpacker.eclass
10 @@ -344,8 +344,11 @@ unpack_7z() {
11
12 local p7z=$(find_unpackable_file "$1")
13 unpack_banner "${p7z}"
14 - local output="$(7z x -y "${p7z}")"
15
16 + # warning: putting local and command substitution in a single call
17 + # discards the exit status!
18 + local output
19 + output="$(7z x -y "${p7z}")"
20 if [ $? -ne 0 ]; then
21 echo "${output}" >&2
22 die "unpacking ${p7z} failed (arch=unpack_7z)"
23 --
24 2.37.3