From patchwork Wed Jul 31 00:37:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1966798 X-Patchwork-Delegate: sbabic@denx.de 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; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=QmPx5V4i; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2001:4860:4864:20::3c; helo=mail-oa1-x3c.google.com; envelope-from=swupdate+bncbcwivbv7sugrbp4ou22qmgqer62edpi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-oa1-x3c.google.com (mail-oa1-x3c.google.com [IPv6:2001:4860:4864:20::3c]) (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 4WYY8L3c8Pz1ybb for ; Wed, 31 Jul 2024 10:37:22 +1000 (AEST) Received: by mail-oa1-x3c.google.com with SMTP id 586e51a60fabf-2642c1ef374sf5990307fac.2 for ; Tue, 30 Jul 2024 17:37:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1722386240; cv=pass; d=google.com; s=arc-20160816; b=sPdSK1AidcnBL4aeprDshVsrJoQWMv1D8AySBzcc2TD+NMremthcscFzIyaQBxanUm QsoqGn9a40lqNxDnfMf1ALiitb14MWt36Xy8ggr7mxSoEwqm4ZNtafZdFdgoycAmSFPx uYdrIlKDODi6G6J9d7rPz4KW61IKFWc2HGvXUxUnDE/HdNTMLZjPuUBqV1tRH2BdbUjT iogDW4Q/6GtQ13KhtnWED3HVJD8PKD1jvpM30XJ03fuwiYDPH9317WtAYTv8O1GGOoL6 2Z+oVEddppzq+YS7D2i5C/KTL5AhRAMhi6SRPpLe6RASdRW9PlWjY1SJl9jH9iCMdWOt uAEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=V2ThqeYmytOhOvx3UL8PSqxPc02OHZlcrcl6U5k1QLw=; fh=6Pa+8HQx/FlsbmfhNZ/nzvZf7d8ujtMPzy4lPXUpw3g=; b=YxDPsxFSN60EDYze+zlV8eTRh+xyHBQ+dj/fQlk/FmNDr7zfiwqwcIKGgHqvU2wnhw fdyuK5Uo8yJmvzSX1SpqO+4DQiIdhx/OSKf1+JOJn3yyObDc0u8KP+h90MXwdmRaw6A7 pyxlYoF1sCSYgjJ6ZqemB+twNYjbbLoPPrVGO3sMZSgg0kofS8AH/ygFh1IkPu/41KGz iHuhzknrJq5f8ydH9tQbkdguTbOQoc3LeWqvCihg39aitbDrVtv83lw+4KFnjMT6LeOP iJusW2Hi8xuRGyssjKBGOZ0DDmHthryHdHXRRbd2NPGDOIKJM5pOGk6zPVwRhPqdPCNv 7xQg==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=l38G4x8D; dkim=pass header.i=@atmark-techno.com header.s=google header.b=YdujrLOw; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com; dara=fail header.i=@googlegroups.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1722386240; x=1722991040; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=V2ThqeYmytOhOvx3UL8PSqxPc02OHZlcrcl6U5k1QLw=; b=QmPx5V4iLnALgdj2zXQ3Ezpq/9B3unRZM8STMRpWESLqjc0C5ZSBsY9GpO6EhODxtD Wy7XVxmkuaBZTqrzFUNF/+/V51Pm/QS4iGW6tAPQz5Fohrd146K6A91oGIFdUjUcXbvr GZsFnwwb7bwOuVloh7Wb4ucJGZt5OuN7CyxoxKbVtCHCNM+s5dcZJoh6xf8KFAmua4PY 4BAISC/I15ul6sYl6x74/X0l9FneVZmdO4NPx5N4Q4x+Jzc+mXwMlydX4A8Cnp7bl9Et pRg0EIxH3+ytQz19rVgla3j6MpnuPrE7d1bKocjPBHcLHffym2Bb3vWxzPE2xRoi9lK4 dB6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722386240; x=1722991040; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=V2ThqeYmytOhOvx3UL8PSqxPc02OHZlcrcl6U5k1QLw=; b=WHAH/8j56CPhkhPp2Gwl+v/4HhopYnYwweNjnoRSNT+2ozfIvJsvvOp4srMTizUEwF stHpSFtz5cNoqBGxjECsubIeXBDLF2pILwYNtQNRczXfDUmMhhOOZnj17fUkI6YhFiVR AfI/DdMTsO6fXSBAzdu9or8xXbNUGGm+NTLN6Welu5CvRSL8ATPIREbj9b3/2vphPen8 zOWQd5gYnMo5/Y7TRCniTsyNU7pdxqxcZ4/kqmwlDzUnXOqdQBQndYnHn+OF8g996Z8u Ji6gtwWKnXXRez9qB/jpGHA3rg233DEDmfL1Q9AOiUUcGKwfoYD8sDCy7hnsxhxorA1Z fSLg== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCW0xH/s3vTNZV22T1Ywwru+vGeOTJVNGeaSeljgfuIXypG6VS/P71Vehb1UucTpnGoMr2OzBBwVibgEQzll6hcaIN8G89vpo9ESbolz3Q== X-Gm-Message-State: AOJu0YwnxZNWThnbONdPtwmJ60w7+s+MD7t9M6yca8dezkVe2W8n4kMS 1v0vjVBxszNU4Lj1MvvwZtraIuoGzDOkTWVVLFU8UpL8J/NW7VvB X-Google-Smtp-Source: AGHT+IF6wK23cdwTLsXTJ43YmiG6Kr7HyOGBx/6o/U/3fsW6lip9ck5GFL4+/wbbNqs7RvBQPo2f4w== X-Received: by 2002:a05:6870:41ce:b0:261:236c:2bc0 with SMTP id 586e51a60fabf-267d4d2eeb5mr16552332fac.13.1722386240336; Tue, 30 Jul 2024 17:37:20 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6871:2009:b0:264:3056:9e20 with SMTP id 586e51a60fabf-2649f86571als7204964fac.0.-pod-prod-09-us; Tue, 30 Jul 2024 17:37:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4I/bJMO5MHXTNYB27yrMgnxGfjkwiqiMWJy4wUIYw4xmjiPk+CenmfWLNyuNEg/GN+eRPzAu999MQIWh9Y1hnFoa+RJXq12sp X-Received: by 2002:a05:6808:2123:b0:3db:25f6:a62f with SMTP id 5614622812f47-3db25f6aeecmr14933333b6e.28.1722386239331; Tue, 30 Jul 2024 17:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722386239; cv=none; d=google.com; s=arc-20160816; b=wNJn79MWztVoeUV/9PUgPF5EJOXDxkz+ThzS6ysAv5JXOjvqLBP8qO3gz8delYfb9/ a+05MyWAk/aOnw390Tj4kdI3o49hFnZQ8y8cH+dVTgeVjcQKeDUZ7MtR9B02bsJnXucq 5drCWwPj1isR7sq+Ts3KAWIFHLWhL4n1kYpZsp/hfSYvUiVxr3sQHend+gVha5y9u6S6 kmTL7/lp7s4z0rxukBQI4jM47hmdA5OBJWnbYS0WlAv9IpwYgE1WbeJQoK0APNdgZ2hz iKipOSOA0vQ0v6NXOsJsb57raxKC5Q/ssUmWtAe6jN6WkrrGh6DKcJUqiWBWQudIwZ52 U44A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-signature; bh=C0EHWvrxGgIXPxwVHsGTFO36MEx30EUGqliPzEKWmxM=; fh=TFaUQnwonv64yiQ6PQO6NyPKhcQgeS6V7L+fJb0Lf9U=; b=mmq/xAqSHI0pzJYYK4a85H48+piketWl6CKEZJg1upZQ3rVxQzwdGwLwWCjS6Ef2hI 9x7l2vEqf20M7Cu/lP2BtotpaMxtCSJEOiKZwTxX86lZvdtUhQGLH6OtY6Mwu3Fk6ui2 xj/ll6fVT6CiG/rcr3nV23jL4gepnwlv9NT6krXkGaz0tySSZZa/Iz9EpfEYH1OZZ1CA EarzVqbDG9JWQF6O0DhXdmtXgUAEe9A0+PqjhL/QVOU8X1eVfrlmopuXvb79y9tsw0/a BFpkXqdkUeoO6JfSkt8iMQF2yaFB3sAv1SuF25xk7QJ4OMUE+jp4mxRTNcscpJjDuzp4 qRyA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=l38G4x8D; dkim=pass header.i=@atmark-techno.com header.s=google header.b=YdujrLOw; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com; dara=fail header.i=@googlegroups.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTPS id 5614622812f47-3db41ecfe94si150320b6e.2.2024.07.30.17.37.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 17:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 1B2F61DF for ; Wed, 31 Jul 2024 09:37:17 +0900 (JST) Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id C5F70AA for ; Wed, 31 Jul 2024 09:37:16 +0900 (JST) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-70d3777de60so4035830b3a.0 for ; Tue, 30 Jul 2024 17:37:16 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUC3+O8sq+hBzs5DE1qe0ZICvxts/1QAe8rm5lHZAiKwYDOgUAKXr/ZN17T3PFBOjKN7XX57TjQYqeM9V7kvtgXpXpSoKYlmqyl X-Received: by 2002:a05:6a00:3d14:b0:70e:91ca:32ab with SMTP id d2e1a72fcca58-70ece9fc226mr10512443b3a.6.1722386235764; Tue, 30 Jul 2024 17:37:15 -0700 (PDT) X-Received: by 2002:a05:6a00:3d14:b0:70e:91ca:32ab with SMTP id d2e1a72fcca58-70ece9fc226mr10512427b3a.6.1722386235292; Tue, 30 Jul 2024 17:37:15 -0700 (PDT) Received: from pc-0182.atmarktech (145.82.198.104.bc.googleusercontent.com. [104.198.82.145]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7a9f7c7451csm9360202a12.13.2024.07.30.17.37.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jul 2024 17:37:14 -0700 (PDT) Received: from [::1] (helo=pc-0182.atmark.tech) by pc-0182.atmarktech with esmtp (Exim 4.96) (envelope-from ) id 1sYxL6-00GhA1-34; Wed, 31 Jul 2024 09:37:12 +0900 From: Dominique Martinet To: stefano.babic@swupdate.org, swupdate@googlegroups.com Cc: Dominique Martinet , James Hilliard Subject: [swupdate] [PATCH] util: swupdate_remove_directory: remove error if target is missing Date: Wed, 31 Jul 2024 09:37:08 +0900 Message-Id: <20240731003708.3979149-1-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=l38G4x8D; dkim=pass header.i=@atmark-techno.com header.s=google header.b=YdujrLOw; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com; dara=fail header.i=@googlegroups.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , commit a6ad222f58a5 ("util: Ensure swupdate_remove_directory unmounts path") added a check for swupdate_remove_directory() to umount the target if it is a mount point, but if it had already been cleaned up then an error will now be printed. If the file is already missing there is just nothing to do, do not print an error message. Cc: James Hilliard Signed-off-by: Dominique Martinet --- our update script was already removing the path, so this error started showing up after upgrading; I guess we could keep the error if parent is missing and perhaps a trace if the dir itself is missing? Happy to adjust the patch if these messages are deemed useful. (I guess I could also remove the cleanup on our side, I'm taking care to not descend into submounts but since this runs afterwards anyway it's not like that's any help; do we want to set FTW_MOUNT to the nftw call?) core/util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/util.c b/core/util.c index 33a9af7114a3..09bdf93b1e51 100644 --- a/core/util.c +++ b/core/util.c @@ -173,12 +173,10 @@ static int _is_mount_point(const char *path, const char *parent_path) { struct stat path_stat, parent_stat; if (stat(path, &path_stat)) { - ERROR("stat for path %s failed: %s", path, strerror(errno)); return -errno; } if (stat(parent_path, &parent_stat)) { - ERROR("stat for parent path %s failed: %s", parent_path, strerror(errno)); return -errno; } @@ -209,8 +207,11 @@ int swupdate_remove_directory(const char* path) } ret = _is_mount_point(dpath, get_tmpdir()); - if (ret < 0) + if (ret < 0) { + // directory already removed + ret = 0; goto out; + } if (ret) { WARN("Unexpected mountpoint, unmounting: %s", dpath);