From patchwork Mon Mar 4 07:15:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1907398 X-Patchwork-Delegate: zajec5@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ABh1I2Xl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=fJOl7aPJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tp95N1G6mz23l2 for ; Mon, 4 Mar 2024 18:17:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=i9/ExoGslhfS35k/UnsUAX1VOfOpbaIY6xmlFSXTH1o=; b=ABh1I2XlINnaj3 oJjJ3e8iIL+1B9y4JV99C+9kNS9ZcVo7lL+2cH6M2dNMTcwNFJVs/vkDdho6ZAqd53BzJ7oOtbYfH D9GiIr32D8+61IgGhKwVXjCatxIPayGwk4COO8xZz6zxKpoPq/mM94vxMKApnOdoExLPbj9ky2DKm 85cepNj9FPy52dht9ZrBz4H0tCbMmwQ8fbPJtK070bmIxbOIh/Bxa6W4R22RH4fXCwmjuUmeEvSpf yb41APcnYeEDiurxzN0PxWmTyakvqEnLivvOkD52ytM8XDmNb2bVTrSuv2d2fyZU2L8EM1fFS083W 0o3tnfXFxJEzMFtEGVCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rh2Yh-00000007uEe-3Ll1; Mon, 04 Mar 2024 07:16:23 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rh2Ye-00000007uDF-2OLG for openwrt-devel@lists.openwrt.org; Mon, 04 Mar 2024 07:16:22 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a44f2d894b7so142416366b.1 for ; Sun, 03 Mar 2024 23:16:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709536578; x=1710141378; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=E7pkY2v/K7Hg5V6PSzSovcJCYk+c4c8VJ064bJJXV4U=; b=fJOl7aPJZE03EDHK9Zm5iqw95DF1Jl6EQcXuLTwbGrsSRyKmW1shu2fhwhAbW40zNn wcJqtl8F/pyTcmKRT+Fc8oGibWy4N0+f4tweiQC9bWhnN58W4mQLaKq70a16b08TwzGQ gYgNWyuYVN5QoAsU2wrgzNLh09YtzZ9ueZAGf01umeCsXXdbi7qvC5zUpecuMp1Pzdp6 YrrwVEVALYjWHWOO59kP4hmh6VvA1/Onlq51+2QPjed4L7cUDxZqsIINPvcZXoA8H3sh HAWOXMr3kEdC8p2dtTnx/yj1C52Yt/jrEaMPvaDCm+6QZYRavHc9viwAw94iFMe7dMNR /cHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709536578; x=1710141378; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E7pkY2v/K7Hg5V6PSzSovcJCYk+c4c8VJ064bJJXV4U=; b=euLNTEZABbPER9Dh+RBXm1fFaDFyAYJTqwbarmEOsZ/yMIaHkIf+SnwiT5EAQTn01o pMbg6nNMDz5Vz7OHwM3qaPuBFvXAdb/WZD+T2yDoHp5Mcgd42H6Mkb3OEzPZB4VKk9z0 OGAhJsFds8fpfRKmjgt2ZlbmxgSmhZ/7EVh18mVJdM3yMAL829I/UR5v72sJ+Rnwj9da sYZqL6jSASMokNb2fVIVbooE9jMspcOBV6chDnnteku+0GTT5K0rjWwcWCG8W0SVHxuC xcCH0YMPq/3Jfr6WVkJMoIVN7DT0vHubNUW2MFY/gu3IWfjpXc6j21KHUah958mZa7Py V6fw== X-Gm-Message-State: AOJu0YzdFh55oejHuzyAEw5K350pu3K4W9abv/TLqHeDzmmBjjg7MOwq 0Y0hUQ1HwBj+QFs4hPY3+dV4BksW/jJNfU2O65j7QrSyZAM8LaSg0tiBtqUz X-Google-Smtp-Source: AGHT+IFTexrt4sOX5dDHfexNT/zy0b99MIpvQn+ttBtkVPwDAhOZfSAq6FC0bFkhLr/tp7O1TR2IMA== X-Received: by 2002:a17:906:b79a:b0:a44:1103:eee9 with SMTP id dt26-20020a170906b79a00b00a441103eee9mr5692371ejb.51.1709536578111; Sun, 03 Mar 2024 23:16:18 -0800 (PST) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id k3-20020a17090646c300b00a3fbca02e17sm4407743ejs.75.2024.03.03.23.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 23:16:17 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: openwrt-devel@lists.openwrt.org Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Jo-Philipp Wich Subject: [PATCH] base-files: sysupgrade: fix generating backup to stdout Date: Mon, 4 Mar 2024 08:15:58 +0100 Message-Id: <20240304071558.28825-1-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240303_231620_640104_93048D49 X-CRM114-Status: GOOD ( 12.09 ) X-Spam-Score: 0.0 (/) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__From=3A_Rafa=C5=82_Mi=C5=82ecki_Before?= =?unknown-8bit?q?_recent_change_=22tar=22_command_was?= =?unknown-8bit?q?_called_with_an_=22-f=22_argument_which_accepts_=22-=22_for?= =?unknown-8bit?q?_stdout_output=2E_Bring_back?= =?unknown-8bit?q?_support_for_that_feature_with_new_code=2E_Fixes=3A_e36cc53?= =?unknown-8bit?q?0927c_=28=22base-files=3A?= =?unknown-8bit?q?_sysupgrade=3A_use_tar_helper_to_include_installed=5Fpackag?= =?unknown-8bit?q?es=2Etxt=22=29_Fixes=3A_https=3A//github=2Ecom/openwrt/ope?= =?unknown-8bit?q?nwrt/issues/14773?= =?unknown-8bit?b?IENjOiBKby1QaGlsaXBwIFdpY2ggU2lnbmVkLW9mZi1ieTogUmFmYcWC?= =?unknown-8bit?b?IE1pxYIgWy4uLl0g?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=280=2E0_points=2C_5=2E0_req?= =?unknown-8bit?q?uired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C_no?= =?unknown-8bit?q?_trust?= =?unknown-8bit?b?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDo2MmQgbGlzdGVkIGluXQ==?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_an_SPF_Record?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FAU__________Message_has_a_valid_DKIM?= =?unknown-8bit?q?_or_DK_signature_from_author=27s?= =?unknown-8bit?q?_domain?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FEF__________Message_has_a_valid_DKIM?= =?unknown-8bit?q?_or_DK_signature_from?= =?unknown-8bit?q?_envelope-from_domain?= =?unknown-8bit?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_si?= =?unknown-8bit?q?gnature=2C_not_necessarily_valid?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_v?= =?unknown-8bit?q?alid_DKIM_or_DK_signature?= =?unknown-8bit?q?_0=2E0_FREEMAIL=5FFROM__________Sender_email_is_commonly_ab?= =?unknown-8bit?q?used_enduser_mail_provider?= =?unknown-8bit?q?_=5Bzajec5=28at=29gmail=2Ecom=5D?= =?unknown-8bit?q?_0=2E2_FREEMAIL=5FENVFROM=5FEND=5FDIGIT_Envelope-from_freem?= =?unknown-8bit?q?ail_username_ends_in?= =?unknown-8bit?q?_digit?= =?unknown-8bit?q?_=5Bzajec5=28at=29gmail=2Ecom=5D?= =?unknown-8bit?q?_-0=2E0_T=5FSCC=5FBODY=5FTEXT=5FLINE___No_description_avail?= =?unknown-8bit?q?able=2E?= X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Rafał Miłecki Before recent change "tar" command was called with an "-f" argument which accepts "-" for stdout output. Bring back support for that feature with new code. Fixes: e36cc530927c ("base-files: sysupgrade: use tar helper to include installed_packages.txt") Fixes: https://github.com/openwrt/openwrt/issues/14773 Cc: Jo-Philipp Wich Signed-off-by: Rafał Miłecki --- package/base-files/files/sbin/sysupgrade | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 78ec455067..b1a7335bc0 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -236,12 +236,15 @@ include /lib/upgrade create_backup_archive() { local conf_tar="$1" + local output_file="" local disabled + [ "$conf_tar" != "-" ] && output_file="$conf_tar" + [ "$(rootfs_type)" = "tmpfs" ] && { echo "Cannot save config while running from ramdisk." >&2 ask_bool 0 "Abort" && exit - rm -f "$conf_tar" + [ -n "$output_file" ] && rm -f "$output_file" return 0 } run_hooks "$CONFFILES" $sysupgrade_init_conffiles @@ -272,12 +275,12 @@ create_backup_archive() { # Rest of archive with config files and ending padding tar c${TAR_V} -C / -T "$CONFFILES" - } | gzip > "$conf_tar" + } | gzip > "${output_file:-/dev/stdout}" local err=$? if [ "$err" -ne 0 ]; then echo "Failed to create the configuration backup." - rm -f "$conf_tar" + [ -n "$output_file" ] && rm -f "$output_file" fi rm -f "$CONFFILES"