From patchwork Tue Nov 10 02:22:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397218 X-Patchwork-Delegate: yszhou4tech@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=RzrN9BtP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=meyNICFT; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::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 ozlabs.org (Postfix) with ESMTPS id 4CVWsR5hshz9sRK for ; Tue, 10 Nov 2020 13:24:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pKNDEQCpNB6pTeXIgu90kPDdavUY6uhwUhG7ZxguDtA=; b=RzrN9BtPXxBxHYRKm9DmQ5mtj J6Idv/cpohk1PAfeauY/AeTCmm0SAWyv9yY6BvRLOqLAauFS8y1ZzgHLEGnTXCnmVgDl30CDaFpu/ MccVtoqRs7aXhouzyK1L/MnBYSLEqu7HGYno96iszXj4Vbfa1DCRQkURi9GylntVyGgZJC3s+rmHi f0EUarj34mw6h39E6FCEtVzLEdna9XDTMZG90rNQSqHgpvJbqO1cbWSrYRDJYA2b4KctfKkvvB/rj o8MlGtOl0N2LLtAp4Ph2o6bEV14hGuW7+tdlBVB1OOjuoS1hTT6SUu7JonaNgOn1YJ+jBNb4+ZC/p q4ILleg0w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJE-0005LX-W8; Tue, 10 Nov 2020 02:23:01 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJ4-0005HJ-93 for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:22:51 +0000 Received: by mail-pg1-x52c.google.com with SMTP id i13so4038045pgm.9 for ; Mon, 09 Nov 2020 18:22:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NXJjYToM1gs3xXGXRa/6AOXm7f/kf48mg7mpvhTc66M=; b=meyNICFTkwxnNqdS0AKj2W0EAzAxhhE1kF2EzIPxIJrE+ku/Zgp2oxX3IAPEuVN0k8 QfYW1YNifurds7qinf2Bklrd/rxZ3sDAvibKShBbypwVA9DbeJj0usZQhjYjTT72PUXn jHTQkVYLpAMtJuIvafzfm8iKpFuy5WECBo3NmYPiqlOcNCEeHud8tySOn8rIga/QZ7HZ QchyOvsZyJE77++5ME25tT3+VZTjCznaOVde/Qr2zpqp+SRtu043vfn9/iJfS8ZCdEtD t/+EYSezLl2efY7niZjGKOdPuqN7kCssKOuLg9hyM/0YQS+IpdT+dLHtgpih0p1v+qpJ BRWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NXJjYToM1gs3xXGXRa/6AOXm7f/kf48mg7mpvhTc66M=; b=VYLQm5XcBJ+qUwH+/STHr9XmCsR7xN0t5ii0X71PfLd37j+ACdo75TP4KTgJn6OO7M oQwME573Pt7xCTMwBRtRM6Iv+/nnJDGKAISKEihjfMBeMgZTroZBp+gdeC+W39lVlWGS TyVIotE1DEMnmQaf6vk+pZqeDVCNRBZqvX8k2GUbZbvQyODNRqxgDWtqOBGwuoK2h2q1 Rge4A4zPKm7JtHNB4kRTMZRlW8ROU5GzcWebfG5QySe1Qv83UrIPJ2J1xwC8F3gQxNL7 WlrzWNfis7S4jnAwil8DQwOgD8Xw8KpkBMyfI+AnS1VKILywVAinDSi0mRXIXG+L3aud pqEg== X-Gm-Message-State: AOAM531/4WAHwN818OgkAji1xUWG8Uv97pJTTKo8xVgw/VHMzWWizzy9 bu7b1OsqvhQAXeZP89X0Gec= X-Google-Smtp-Source: ABdhPJywNJbsZd7JsjH4yNPMTRf6w7GDdyZpFMs/oIfGfCH6l/nglGivNZdLC3h7fLMSUcopI83g8g== X-Received: by 2002:a63:4006:: with SMTP id n6mr14986412pga.171.1604974968277; Mon, 09 Nov 2020 18:22:48 -0800 (PST) Received: from titan.office.yunion.io ([103.119.177.162]) by smtp.gmail.com with ESMTPSA id ck4sm863197pjb.50.2020.11.09.18.22.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:47 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 03/10] base-files: upgrade: add get_image_dd() Date: Tue, 10 Nov 2020 10:22:16 +0800 Message-Id: <20201110022223.41175-4-yszhou4tech@gmail.com> In-Reply-To: <20201110022223.41175-1-yszhou4tech@gmail.com> References: <20201110022223.41175-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_212250_410372_31750A4C X-CRM114-Status: GOOD ( 10.52 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:52c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [yszhou4tech[at]gmail.com] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , OpenWrt Development List Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This is mainly to handle stderr message "Broken pipe", "F+P records in/out" by common pattern "xcat | dd .." Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville Signed-off-by: Yousong Zhou --- package/base-files/files/lib/upgrade/common.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index e12dfc9678..6c09908ee3 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -94,6 +94,12 @@ get_image() { # [ ] $cmd <"$from" } +get_image_dd() { + local from="$1"; shift + + ( get_image "$from" | dd "$@" ) 2>&1 | grep -v -E ': Broken pipe| records (in|out)' +} + get_magic_word() { (get_image "$@" | dd bs=2 count=1 | hexdump -v -n 2 -e '1/1 "%02x"') 2>/dev/null }