From patchwork Mon Dec 12 08:43:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allan McRae X-Patchwork-Id: 2095 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [2a01:4f9:c010:3052::1] by patchwork.archlinux.org with IMAP (fetchmail-6.4.34) for (single-drop); Mon, 12 Dec 2022 08:43:38 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id kEy4JLnplmPwgwUAK+/4rw (envelope-from ) for ; Mon, 12 Dec 2022 08:43:37 +0000 Received: from lists.archlinux.org (lists.archlinux.org [IPv6:2a01:4f9:c010:9eb4::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id F038717AAE19; Mon, 12 Dec 2022 08:43:35 +0000 (UTC) Authentication-Results: mail.archlinux.org; dkim=pass header.d=archlinux.org header.s=dkim-rsa header.b=cvUbCCMX; dkim=pass header.d=archlinux.org header.s=dkim-ed25519 header.b=Bw1yUoR+; dmarc=pass (policy=none) header.from=archlinux.org; spf=pass (mail.archlinux.org: domain of pacman-dev-bounces@lists.archlinux.org designates 2a01:4f9:c010:9eb4::1 as permitted sender) smtp.mailfrom=pacman-dev-bounces@lists.archlinux.org Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id 24D7D7036EE; Mon, 12 Dec 2022 08:43:33 +0000 (UTC) Received: from mail.archlinux.org (mail.archlinux.org [95.216.189.61]) by lists.archlinux.org (Postfix) with ESMTPS id 1DBAA7036E5 for ; Mon, 12 Dec 2022 08:43:30 +0000 (UTC) From: Allan McRae DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1670834609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qZPSxMus6QLDShkl7grXS8tprLpvlklpnCnwe6FuInw=; b=cvUbCCMX0W0gOifxqM4M2vAPuiFtrfpIQq7+Ap443trit6Cbx1dhfqDuAsliyeewJ630+Z 36fdJuO5r+R6+wf0J1geGsBJb8AJsLbs8FRolweOjjmQQ5Z5qiyoGVo85vZZLkoPUoMq/7 SQ+e7s6cJOXZwBn9YizXXmoRDW5DA7f78JiRt8eE74//kujduyUZaRgFP1rNtovT3E5XrS ZLDfA9HPPWqJRvOKG94jKyCgmppLjIeKcIj6Dv0EMqStpg7Rb36dY4yG11UEDv5xcc+8JN /hXPZdNoGKILrHG0dkjDlXvOcWBGOjgYpxWwAYLerrj9sMHoFqpkSXAMKZpaugw7ckk1hI 1Uyyy6xHHkrJ+S/ZoqP6YYABTJGKXGMHVKMZYZ4c+7nAczg+VRw9SzRnxzTPsMeTkAzaj1 X8jKEC4Mf7oi44RG1jLGqKTvukQh1IUCos42LbL4/ZytECijIjJGdXfzAndsTA3UdkfYi7 /nEEXsL22qe4w7Xgfc+0mq591cxp50X4QHXm5HO+S1gFQdcJocJjee+5ijKwFSfRrJCAXd CZHWOyr/02zB3VvRZeSuizlnWtYGRf9IPPNtofqE8oTLI0SVcoOs2ijirKHV5v/PvlXGpa T5b5xwbsTTpLWeDiB3UTECbb/PbMfFO6XmhUXVept4kXBRDgZWfeM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1670834609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qZPSxMus6QLDShkl7grXS8tprLpvlklpnCnwe6FuInw=; b=Bw1yUoR+3dwQbqK2thKp5VFv9ycCaTtb+0KrCV/Ioy5gDjy5daBPslGPk9Nh1nZKoPv7BH gyAZsHGQRYrREDDw== To: pacman-dev@lists.archlinux.org Subject: [PATCH] libmakepkg: fix compatibility with bash-5.2 patsub_replacement Date: Mon, 12 Dec 2022 18:43:18 +1000 Message-Id: <20221212084318.1592149-1-allan@archlinux.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Message-ID-Hash: A6TPIDN3HGXIHXXTD5NTEVRWNG6METUJ X-Message-ID-Hash: A6TPIDN3HGXIHXXTD5NTEVRWNG6METUJ X-MailFrom: allan@archlinux.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.7 Precedence: list List-Id: Discussion list for pacman development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Rspamd-Action: no action X-Rspamd-Server: mail.archlinux.org X-Rspamd-Queue-Id: F038717AAE19 X-Spamd-Result: default: False [-1.51 / 15.00]; DWL_DNSWL_LOW(-1.00)[archlinux.org:dkim]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DMARC_POLICY_ALLOW(-0.50)[archlinux.org,none]; MAILLIST(-0.20)[mailman]; R_DKIM_ALLOW(-0.20)[archlinux.org:s=dkim-rsa,archlinux.org:s=dkim-ed25519]; RCVD_IN_DNSWL_MED(-0.20)[2a01:4f9:c010:9eb4::1:from]; R_SPF_ALLOW(-0.20)[+ip6:2a01:4f9:c010:9eb4::1:c]; RCVD_IN_DNSWL_LOW(-0.10)[95.216.189.61:received]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f9::/32, country:DE]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; FROM_NEQ_ENVFROM(0.00)[allan@archlinux.org,pacman-dev-bounces@lists.archlinux.org]; DKIM_TRACE(0.00)[archlinux.org:+]; MIME_TRACE(0.00)[0:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; NEURAL_HAM(-0.00)[-1.000]; FORGED_SENDER_MAILLIST(0.00)[] Bash-5.2 introduced the patsub_replacement shell option, which is enabled by default. Apparently is it supposed to handle a sed-like idiom, but what it does achieve is making any substitution involving a "&" requiring special care. For makepkg's DLAGENTS, we replace "%o" and "%u" if present. Any "&" in the replacement fields triggers patsub_replacement unless quoted. This is particularly important for the URL field. Add relevant quotes to avoid issues. Signed-off-by: Allan McRae --- Posting to pacman-dev and not just to our gitlab so that this is flagged for distros to backport when updating bash. scripts/libmakepkg/source/file.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/libmakepkg/source/file.sh.in b/scripts/libmakepkg/source/file.sh.in index fa09d446..10e0026e 100644 --- a/scripts/libmakepkg/source/file.sh.in +++ b/scripts/libmakepkg/source/file.sh.in @@ -60,11 +60,11 @@ download_file() { # replace %o by the temporary dlfile if it exists if [[ ${cmdline[*]} = *%o* ]]; then dlfile=$filename.part - cmdline=("${cmdline[@]//%o/$dlfile}") + cmdline=("${cmdline[@]//%o/"$dlfile"}") fi # add the URL, either in place of %u or at the end if [[ ${cmdline[*]} = *%u* ]]; then - cmdline=("${cmdline[@]//%u/$url}") + cmdline=("${cmdline[@]//%u/"$url"}") else cmdline+=("$url") fi