Message ID | 20200602221649.1387436-1-eschwartz@archlinux.org |
---|---|
State | Accepted, archived |
Headers | show
Return-Path: <pacman-dev-bounces@archlinux.org> Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 05F541922ACBD for <patchwork@archlinux.org>; Tue, 2 Jun 2020 22:17:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: <dns:70.91.198.88.list.dnswl.org> [127.0.9.2] <dns:70.91.198.88.wl.mailspike.net> [127.0.0.19] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for <patchwork@archlinux.org>; Tue, 2 Jun 2020 22:17:22 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 3F3EB1C7E8B573; Tue, 2 Jun 2020 22:17:13 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id EE8A51C7E8B56C; Tue, 2 Jun 2020 22:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591136232; bh=rFpTu9IqrV6KnJEKqGnBJvrb6TVa6+lGoEFm8gZzCC4=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To; b=c+mMtDkBSbV9bHy31eXYCOOUAgjAtddYkKJTQa/x4wUgyVxBCnkE9B6lF5irmmZ4E TDQLHgEKUkeaSynyw8rTpuhHcif7/TldEu+H1VjCPRQsGNwTNd1VHf+MvcUFRfl6vv HN6wPyLtBEUG4ahsw5XoH9+yWyCuH+8csi+Dn2GlkhI2ImyCizTl4bG/Ka/kJPG1oc 1jCS7aUE0jy/a/Bgt82BRIO8ukzP4XiXyfnkAnpwaAfocqaSC4zQpGRt1ybIk/XH07 Qkqu9X9DXiMbq5ghV5mebrEdt1pqIU/6g7ZIBS2GzT5kOTt/tfpE/pnlWxd6bbSg76 iYbVbozW0lLm+Ga12RdSXgYXBCRgw+VXAjD6Ig8uZXLa6TJ11LQZsRH8JttmTDnVJ/ /yYe+6tFeDr3ebZP/mh7YacIeONa8PHetH1jOg57gRUbOXbSLI3g0S5+Dl3EBQ2ny0 nER0PFXKXSO8Ap+BUXaR7Mm2mRSYBlIhlTulX+DYvFLuFOuUHHVSWykR8ByRkFgqed DkJooQ+HPctnhKW3dUreigMENalOJtvhwCkenWhs/eX6pGag6mlsWcFE7FODHec+Cf uLCV0LPTqC4bRGO/iuXaF5idW3do36mhwtpfmPb/YugmTEpjXMEX5iD43QDU9TOdls N9RA2AoDSj1Fxvmc6oOFwrVw= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id DBAC22C029; Tue, 2 Jun 2020 22:17:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1591136232; bh=rFpTu9IqrV6KnJEKqGnBJvrb6TVa6+lGoEFm8gZzCC4=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To; b=W5uYmmHhNi/axUpB9gA6BfbYkf1apvN8TssSl+Bfdncmk/c5ua/32yO8bz6y5s31M dJfFreMEhlYDaA2fMcohnEKyx1zz0vMInpIP2iAeufco226CdgXcU8X7Um44/qHPhL 6fUkNjo2//QKmPL31QA1jrQVznSadhGGQLCHUYNe4J1Wx8sqsz/2W2NZcmdBo7BfLu VAlUZFq6vTxnXxMmLSQs65081fZ+LpNP9rbchDKTLCbxHvWGHLVE5wg4GAaJsWTjiQ 7Ols4bDT2EMKsKhhpcptF9FARCXMEZE8JCr8PrlNuhtLLmlhMIZRGzBmmUSqEPLFtF BrC4FmFC1UZasUDPObkjk0GchAJTKmAstdSDIXWM6M3OPbBqWdOrr0Uj2p5CO4E2oQ XQV418Ad4arcKUSEJCEAPgXSktvXfthiUv6OKBOhZ1d/8fCVcjWb+RzM/BlveMlZuw lhWLSU5vfCBqWuzYpM+q8KwKNTzXV9Cu9bdeHs9pEl332S37Vle/lfH3Y+aWuyQmUa r4PGcdoudFOX/9h4t0UeWZsjjwidgDkPwDXg6oDqU9kJ5DCiJYxUEyGku4+gQGyd8w S3OnFeRijS/XF1BuTJJsfYf1/hRBTTuLNwccs7SjKJV4CpoW4VJ07SShI52/HpfzO4 QqLfjggVab30T9zgnNq30Tls= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 9BBD22C01E for <pacman-dev@lists.archlinux.org>; Tue, 2 Jun 2020 22:17:10 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for <pacman-dev@lists.archlinux.org>; Tue, 2 Jun 2020 22:17:10 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 2B77C1C7E8B563; Tue, 2 Jun 2020 22:17:09 +0000 (UTC) Received: from didactylos.attlocal.net (108-200-163-197.lightspeed.bcvloh.sbcglobal.net [108.200.163.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: eschwartz) by orion.archlinux.org (Postfix) with ESMTPSA id 8EA401C7E8B562; Tue, 2 Jun 2020 22:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1591136229; bh=rFpTu9IqrV6KnJEKqGnBJvrb6TVa6+lGoEFm8gZzCC4=; h=From:To:Subject:Date:In-Reply-To:References; b=WXyq6rAcyMBcVDq8T306CzwHjosFZaFO5e6N4NQZkW9kJF5TxO/ymT98U/j/QTT8N GE07XBtwKS3UD2xRnaRHWZS+SkFOmTfb8ngf+TqaYvy4ybKvyE9EpcW7BxM3yrG0pt i3bAv9UK7ieGDw1WkzrgIA2rYV0do+18H6aDM2YYshsmwl/3qvkRMrD9snkhFymuy5 fFK2nICtFIJiGlWisLqrSXpC/QPVyh0NgIX29MNfJQX2L2Gj4N2AwtJ1GpguYRtu/d Aa4aBC66dfTdJlWHlmeK84ou8QmxYCufQyQD4O1/VQ/A75+Ea/RFsRP6gIgWCVphXG 8Njxj2EuX2zDtCfIcZo6bKKKFEq4J3l+3ZVVpiaA9LWhkyaqpVLk1TwdIbogMejo2y xrs6aP+bjIqrhHIT69zLKPkRBrrNuktIHVBKw9ayyjqohPwVbTGzGV241eA60TgVD4 7ju7B+N8LOTkaoDOPzVJvlRRTmaFviFMh8qOvWxKhDwoYiHj/BSrVXUWLVt1swbW7A PHjnJD8W6wLUjjkezGLb9jecDFHuxUuGSVXTdUa63GKnbQJEX/0FtTWayGGvC7Qcuv IlhUJFRuksP1+bmrspsJaKuB/0olRf18uQXr2XXHjh19DdM4ZzIp5+LX68eVdVwplg G0O+fnkmMPgkjVGzS7KCIagw= From: Eli Schwartz <eschwartz@archlinux.org> To: pacman-dev@archlinux.org Date: Tue, 2 Jun 2020 18:16:48 -0400 Message-Id: <20200602221649.1387436-1-eschwartz@archlinux.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200517223406.3148571-1-eschwartz@archlinux.org> References: <20200517223406.3148571-1-eschwartz@archlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [pacman-dev] [PATCH v2 1/2] makepkg: correctly handle missing download clients X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussion list for pacman development <pacman-dev.archlinux.org> List-Unsubscribe: <https://lists.archlinux.org/options/pacman-dev>, <mailto:pacman-dev-request@archlinux.org?subject=unsubscribe> List-Archive: <https://lists.archlinux.org/pipermail/pacman-dev/> List-Post: <mailto:pacman-dev@archlinux.org> List-Help: <mailto:pacman-dev-request@archlinux.org?subject=help> List-Subscribe: <https://lists.archlinux.org/listinfo/pacman-dev>, <mailto:pacman-dev-request@archlinux.org?subject=subscribe> Reply-To: Discussion list for pacman development <pacman-dev@archlinux.org> Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" <pacman-dev-bounces@archlinux.org> |
Series |
[pacman-dev,v2,1/2] makepkg: correctly handle missing download clients
|
expand
|
diff --git a/scripts/libmakepkg/source/file.sh.in b/scripts/libmakepkg/source/file.sh.in index 819320c2..2b804564 100644 --- a/scripts/libmakepkg/source/file.sh.in +++ b/scripts/libmakepkg/source/file.sh.in @@ -42,7 +42,7 @@ download_file() { # find the client we should use for this URL local -a cmdline IFS=' ' read -a cmdline < <(get_downloadclient "$proto") - (( ${#cmdline[@]} )) || exit + wait $! || exit local filename=$(get_filename "$netfile") local url=$(get_url "$netfile")
This was broken in commit 882e707e40bbade0111cf3bdedbdac4d4b70453b, which changed 'plain()' messages to go to stdout, which was then captured as the download client in question: cmdline=("Aborting..."). The result was a very confusing error message e.g. /usr/share/makepkg/source/file.sh: line 72: $'\E[1m': command not found or with makepkg --nocolor: /usr/share/makepkg/source/file.sh: line 72: Aborting...: command not found The problem here is that we checked to see if an asynchronous subshell, in our case <(...), failed, by checking if its captured stdout is non-empty. Which is terrible, and also a limitation of old bash. But bash 4.4 can use wait $! to retrieve the return value of an asynchronous subshell. Now we target that as our minimum, we can sanely handle errors in such functions. Losing error messages on stdout by capturing them in a variable instead of printing them, continues to be a problem, but this will be fixed systematically in a later commit. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- v2: split out the plain() function redirection into its own patch, which will be handled more consistently. scripts/libmakepkg/source/file.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)