From patchwork Wed Oct 2 20:31:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Bezdeka X-Patchwork-Id: 3842 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Wed, 02 Oct 2024 22:32:28 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-yb1-f191.google.com (mail-yb1-f191.google.com [209.85.219.191]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 492KWRCf020796 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 2 Oct 2024 22:32:28 +0200 Received: by mail-yb1-f191.google.com with SMTP id 3f1490d57ef6-e2608234531sf393561276.1 for ; Wed, 02 Oct 2024 13:32:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1727901140; cv=pass; d=google.com; s=arc-20240605; b=Q7vIEg2R1CypEOqaf16TXUamaYnajhpY+/qdg9vKbDq3yPcvIcazfhpU2Yn6AnfaUi embtMlccRGwr+2Dmh9BIQ4o/+2RVNgPPyNyUNFrYkUWwUsmeZU+F5fhkT9NCPyiX/9qE diZAlICICkGXGSFGyeXTYiA1AZ1EUawmEht/P3Cm52JeUUGDO7eFeIotzUUSxrRS1Xpm ai1lAPvlLOLaNep1AcpXGvYGFIG1mV4qR0ZrcatNq4g3AHaIi6mPzhP0mcyXEYPxtXM7 m27zad4b1w9uoJVO2+Rk/cq+ZlHqab2MhnMjXPKVAeBzX67otOa+kD/hj6hk5klfI9zt cHjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1hsudDjOyuRFfzzbGiM4xmfPibvb2weaImalcK1c330=; fh=v+nmw81/Wpm2pIXh9LxqR/rzwLK8cXxxFc5e5JFImKE=; b=M6hHbH964Qd82jXDCs64j/Kxqk6DkA+/asR8fSiGqcBfq5+616UYmN8ZPmwrVJQGnp LcuZpaFryGzgsAg+n/B2vcs9PbwjFVEuub0Iywl7segfpUiNbmmyqVdFwJGCd/OfMQz1 Kt3jM5YfBMJAwi/ZfZ8EmvV6l4Zivtu9i08XWUVO5HYYGeZeXOTpN3FpRLm8HYAbFADf W51M/1eX01KZj4MTNkfXgvrg0ih4Cz9vab3DhMrhYptUFSUir3gtWfNgU82NqPEQv9V0 1R5o3SW+8s3/t4Qftv0UKuTCJDtwj/Q7sDQmkMswcefjSc5tauiyz97JOgPuImOQ3I4i sXuw==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Xneg4SC+; spf=pass (google.com: domain of fm-68982-20241002203217536c2dd1abab60accf-_dprz7@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-68982-20241002203217536c2dd1abab60accf-_dPRZ7@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1727901140; x=1728505940; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=1hsudDjOyuRFfzzbGiM4xmfPibvb2weaImalcK1c330=; b=l22xBqshLHAotmvAXBIuiqecJ3Nk3gTa/FdwZTGnRIcy2sBJHFLgcNkBpQH141PWcy MoIUzEsGHZFu69kn8/Oo/ymaPa7cyiVdbPZBF6Up8oXedaU0FpEAHtq6zmu/6PzmjTmJ hnLGhlCQIvD5QBmJVUlVx9XyIDnPp8zpcyhrw5bg74i0JX/RgDVzigi9CDAhDQNiZw5N Dw5KU1PD6ciW9VGjDqFxWjayxo1qvhX6RmSoAJonONWnMbbf63J2hm1y/lc9G0Wm8WWl VboBrFfTpH80JLMEzawZHiLgkjSt8ZUkRebp2WkFDvERl7Avj9+nEgK8FYl4IQmxxzrf Uupw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727901140; x=1728505940; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1hsudDjOyuRFfzzbGiM4xmfPibvb2weaImalcK1c330=; b=pYo9mZZPheDmVcCOz1Vfegf+a2dKlfiw7+7aKx0wew4qHYzTEPwGLxZ8w4IM3rmQMs dhoHP4Jw0Tem3DnMZw7Eqd4CNvGQbePBk9NNknfQE4JAemHCqWMyE0jsSsQdwdFjoeNq 1xrS4SzRcCdLC2T1PEIv+Q1Pn+6qFqb+XCJqDYgK3RK++338gtCFTEb0bOg7QNfxBdYj kH8giMk9H3HeLDTcGvSjAdiP4tovL7XOzAKRFwbaS7sZ4m4HlMxrMrpiuIXxHGPO556z BPh6vSHK8EUeixoR12pMlN5VMb9qSWqZ9F9wdUBzm87Y9t6hGtzKvSX54mJ2f1H7V5lY f/+A== X-Forwarded-Encrypted: i=2; AJvYcCX1b1tQTXimVV/cUtLn4gHqcsd/pA00fT6q7kSNI7yPmQG8rxFaofNnxXnAOAoyggWjveL3OEQ=@isar-build.org X-Gm-Message-State: AOJu0YwJTWA0gDoD/hy5V1Bpp9pEOiyitbbAV/qEjDue/Nm9WklcDz+2 mkdHuwKRGGBJtW9lSav3wDAtSTIQKqIhYOnptCqDuCAubzqDy1ON X-Google-Smtp-Source: AGHT+IHXbu3zgVwoIk8skkCE2ittMd27OtyTJkXsYK2/yWCj6BPOh7obexs59kHfEwMNUorg5F9ycQ== X-Received: by 2002:a05:6902:2608:b0:e26:46f:967d with SMTP id 3f1490d57ef6-e26383b1034mr4155175276.23.1727901140477; Wed, 02 Oct 2024 13:32:20 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6902:18cc:b0:e03:aded:7d3a with SMTP id 3f1490d57ef6-e286fa4dd1fls435281276.1.-pod-prod-06-us; Wed, 02 Oct 2024 13:32:19 -0700 (PDT) X-Received: by 2002:a05:690c:94:b0:6de:2ae:811f with SMTP id 00721157ae682-6e2a2e052f9mr40941097b3.35.1727901139652; Wed, 02 Oct 2024 13:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727901139; cv=none; d=google.com; s=arc-20240605; b=Bc1xpnYYBGsLm9/NFQKsru7AEiskYO0KyGLfbZKdGCJP1RAVoxUblUAyPQbyBdcIFd IUKtq1obZ1E2M67P2y8TSCtT4tT/W0Pf1OJSdM95v+U5RKkVzS3fouI0wAyBruURPE/S IZuG6iGN1AjS+QY5qwt6GEys7dtvX+6sc7onGVhjLRtqsIHq/JPOAcYiBnRwLabo+Grf 6LpH5IG8JyatM9Zn7bjC0EneOJnvd5tV/fFXTSw8RE+fks7tULAT+RUbMOHQv1bPbo2N l9s2hof3jXbOdjLTvYftA4JGMH/q/koATSdUF2Qh8IGNylh7ZnuMLeMvx/MUF8LJd/LU QDTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=3kw7gvRWc1M2oGZmSY9anqJtiVVZV+g12EJcMpV7nvA=; fh=3XHIu/InRAzp3Rp7l/ptHNRaAKFVDHN18ga8bDsOpak=; b=HikBP+IYVoBM1r629kqxS6K7qNBJWIxSHvA0JoxEJ58amOR3vP7iNs8RKZX5m5ZyZz OqAinYmZ/jBzXVjMprxz0978NlOe0URxgggOY8iJEMqOzWfaszJOzFDTBBJncUYh/v8q i+/O1ju3mSz7ADs+a8g6CqZhxVVyBR3p1AdFRYVxziFXn+eMLGCir8GOalZ78uiL+Gl8 wqkok6m9J+gsFpDiGwirR6EXxOfY2y8XTGx3ftxcDlUOruX690/Wpqn9rTE4u3pqlvTn LdJpaxqlh9NCZbC2JP2ujnEYyFOLPQMS7J6R6mTI1lprPJwVy5dKor0JyoOIaaioUOYH cV9A==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Xneg4SC+; spf=pass (google.com: domain of fm-68982-20241002203217536c2dd1abab60accf-_dprz7@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-68982-20241002203217536c2dd1abab60accf-_dPRZ7@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net. [185.136.64.228]) by gmr-mx.google.com with ESMTPS id 00721157ae682-6e245380df1si10540827b3.2.2024.10.02.13.32.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Oct 2024 13:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-68982-20241002203217536c2dd1abab60accf-_dprz7@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) client-ip=185.136.64.228; Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 20241002203217536c2dd1abab60accf for ; Wed, 02 Oct 2024 22:32:17 +0200 X-Patchwork-Original-From: "'Florian Bezdeka' via isar-users" From: Florian Bezdeka To: isar-users@googlegroups.com Cc: Florian Bezdeka Subject: [PATCH 1/2] rootfs: Add missing umounts in rootfs_postprocess() and rootfs_install() Date: Wed, 2 Oct 2024 22:31:55 +0200 Message-Id: <20241002203156.149572-2-florian.bezdeka@siemens.com> In-Reply-To: <20241002203156.149572-1-florian.bezdeka@siemens.com> References: <20241002203156.149572-1-florian.bezdeka@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-68982:519-21489:flowmailer X-Original-Sender: florian.bezdeka@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=Xneg4SC+; spf=pass (google.com: domain of fm-68982-20241002203217536c2dd1abab60accf-_dprz7@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-68982-20241002203217536c2dd1abab60accf-_dPRZ7@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Florian Bezdeka Reply-To: Florian Bezdeka Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= Calls to rootfs_do_mounts should always be paired with calls to rootfs_do_umounts. In case there was an exception thrown within the try blocks they will be re-raised after the finally block has been processed. This way we try to avoid leaking mounts but unmounting might still fail. In any case we tried our best to clean up. Signed-off-by: Florian Bezdeka --- meta/classes/rootfs.bbclass | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass index c67d3bb8..e359d529 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -235,18 +235,21 @@ python do_rootfs_install() { progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights) - for cmd in cmds: - progress_reporter.next_stage() + try: + for cmd in cmds: + progress_reporter.next_stage() - if (d.getVarFlag(cmd, 'isar-apt-lock') or "") == "acquire-before": - lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock", - shared=True) + if (d.getVarFlag(cmd, 'isar-apt-lock') or "") == "acquire-before": + lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock", + shared=True) - bb.build.exec_func(cmd, d) + bb.build.exec_func(cmd, d) - if (d.getVarFlag(cmd, 'isar-apt-lock') or "") == "release-after": - bb.utils.unlockfile(lock) - progress_reporter.finish() + if (d.getVarFlag(cmd, 'isar-apt-lock') or "") == "release-after": + bb.utils.unlockfile(lock) + progress_reporter.finish() + finally: + bb.build.exec_func('rootfs_do_umounts', d) } addtask rootfs_install before do_rootfs_postprocess after do_unpack @@ -366,9 +369,13 @@ python do_rootfs_postprocess() { if cmds is None or not cmds.strip(): return cmds = cmds.split() - for i, cmd in enumerate(cmds): - bb.build.exec_func(cmd, d) - progress_reporter.update(int(i / len(cmds) * 100)) + + try: + for i, cmd in enumerate(cmds): + bb.build.exec_func(cmd, d) + progress_reporter.update(int(i / len(cmds) * 100)) + finally: + bb.build.exec_func('rootfs_do_umounts', d) } addtask rootfs_postprocess before do_rootfs after do_unpack