From patchwork Tue Sep 7 22:42:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Champetier X-Patchwork-Id: 1525565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=bombadil.20210309 header.b=nnpkYKcV; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=iXIeEuZy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 4H40hr57Ntz9t10 for ; Wed, 8 Sep 2021 08:45:14 +1000 (AEST) 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:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=oOmH2lIo2TjclapdZrAqimPcPXvlmNN1MTbGX22qOqo=; b=nnpkYKcV/I7aLq R91wP7g1byBlGfjQdf1VoXVDkH+G4iOpW8kOo2TKcvcWcm8d9fzQmNelCccKCf17l9YUKajKwL1ml S0zb5iEZqj3kkHekAzfer70QwUvxlgU2xHUD1xQEHxjZCdXLSnY4y6THCAbbQn913zwuhq0q3XQqa HmuMX3ILQGKX5cgGBE68paxyoMDMq2bTxebFxCgTH7jfxfr4Y6+v097ANf8rvw5sVty7NFHZD+Xf0 mjz7FVTn4btvbCilDf0Sl45zBt+lY4UultoKuXQ7yV4GWvXNk5aTSxjsKio1nxfTmsz5640Zd66ll wv6HeUJlNEUADzv3VeBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNjnp-004yBw-H6; Tue, 07 Sep 2021 22:42:53 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNjnl-004yBZ-Td for openwrt-devel@lists.openwrt.org; Tue, 07 Sep 2021 22:42:51 +0000 Received: by mail-io1-xd2f.google.com with SMTP id f6so676956iox.0 for ; Tue, 07 Sep 2021 15:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cvi7kZ4PGkdamziCrR8Quwcea+853g4duj1ML7Ba4Kg=; b=iXIeEuZy3mp5NlKSSf8lFlk+KSDdACWu5lP4wi9qgDSaml+l/8fMds/QI9sKlvO/yD 2f+keq0DIze8piS4IiHdVZ1W0P5a2rChQxLxNyzuKGB6xxh5bVUbINt0AWMv4T3eS9U0 fbLe//Edi/2tJvJ1RHrBae3oUvCglPf6l2S6q5B4fzDRGbbHALRzeg+WRNPoBmHWYiEH +7TWprzS/JDimMgYHn9vbOBXcbXNrMMk1pW0/US1VoSWv01RkjKq1KqSo6qmb1ILO4lO VDh8BNDX0fugFTMNQJo1F39XbCHpFH747F5UY+3aAbDKGNfg5HhaH2xKl/Jz8zRwvTZv qzsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cvi7kZ4PGkdamziCrR8Quwcea+853g4duj1ML7Ba4Kg=; b=GRUWnIDNt+KIQqsituPhIZcDAnUXtk5EGHlPXfNHUo6FpHfEnPBUGYZCjvlo0AKzVk GV1xU9TpX35agEwEenjGa/CBfY6x8yIRK9j4Cz7j8riXcHqrOX3F7MxEBDWdiLUi9U9g akpgx4y6niAv5YWvQrOm7ihq+pwsowErFI0XC5l7NaXULAKB/YkGdZdhwzIPbGsqThwO L1M8ngT2KCxaVBLfc925TqCwTge020xQ3DpkfGcb8ILqiFJIeBR7Ouq6m1m/fB2Hbvp3 29ivKuuKfTEc0UtCZY9YgNjCoZRB2XoXPJMlt4BrZEzo+P9gl4VnlnMvVG6YPNnceMjO rCBQ== X-Gm-Message-State: AOAM531sUiK8LT1YgWHH2kbiCWTdAGxMh2ciwGXb/BXjSfwJVy/9Hnxs b6/WomF3wztyezuVEgNwwmpFpGqxkgxM2g== X-Google-Smtp-Source: ABdhPJyjttgSNTwi4zJE7p5XzsMQygYjd1svHxPqzuigA69o1rfwABO+nxRkZW9Drl0MNYZUn+cloQ== X-Received: by 2002:a02:a10b:: with SMTP id f11mr646324jag.16.1631054567148; Tue, 07 Sep 2021 15:42:47 -0700 (PDT) Received: from echampetier.lan ([2607:fea8:1bc0:36::d9a]) by smtp.gmail.com with ESMTPSA id c5sm228411ilk.48.2021.09.07.15.42.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 15:42:46 -0700 (PDT) From: Etienne Champetier To: openwrt-devel@lists.openwrt.org Subject: [PATCH, opkg-lede] opkg_remove: avoid remove pkg repeatly with option --force-removal-of-dependent-packages Date: Tue, 7 Sep 2021 18:42:45 -0400 Message-Id: <20210907224245.4993-1-champetier.etienne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210907_154250_000698_DF94756F X-CRM114-Status: GOOD ( 10.72 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Hongxu Jia While remove pkg with '--force-removal-of-dependent-packages', pkg may be added to pkgs remove list multiple times, add status check to make sure pkg only be removed once. Signed-off-by: Hongxu Jia Signed-off-by: Paul Barker (Cherry picked from https://git.yoctoproject.org/cgit/cgit.cgi/opkg/commit/?id=e8996180833aa35d101fbeadec3d787ce0bbda5c) (Fixes https://dev.arc [...] Content analysis details: (-0.2 points, 5.0 required) 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:d2f 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 [champetier.etienne[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: Hongxu Jia While remove pkg with '--force-removal-of-dependent-packages', pkg may be added to pkgs remove list multiple times, add status check to make sure pkg only be removed once. Signed-off-by: Hongxu Jia Signed-off-by: Paul Barker (Cherry picked from https://git.yoctoproject.org/cgit/cgit.cgi/opkg/commit/?id=e8996180833aa35d101fbeadec3d787ce0bbda5c) (Fixes https://dev.archive.openwrt.org/ticket/18320 and openwrt/packages CI) --- libopkg/opkg_remove.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c index 96ca558..c2abf81 100644 --- a/libopkg/opkg_remove.c +++ b/libopkg/opkg_remove.c @@ -249,6 +249,14 @@ int opkg_remove_pkg(pkg_t * pkg, int from_upgrade) if ((parent_pkg = pkg->parent) == NULL) return 0; + /* While remove pkg with '--force-removal-of-dependent-packages', + pkg may be added to remove list multiple times, add status + check to make sure pkg only be removed once. */ + if (conf->force_removal_of_dependent_packages && + pkg->state_flag & SF_FILELIST_CHANGED && + pkg->state_status == SS_NOT_INSTALLED) + return 0; + /* only attempt to remove dependent installed packages if * force_depends is not specified or the package is being * replaced.