From patchwork Fri Oct 11 10:00:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Mikanovich X-Patchwork-Id: 3867 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Fri, 11 Oct 2024 12:01:16 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-qk1-f186.google.com (mail-qk1-f186.google.com [209.85.222.186]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 49BA1DND008801 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 11 Oct 2024 12:01:14 +0200 Received: by mail-qk1-f186.google.com with SMTP id af79cd13be357-7ae48475234sf459966185a.0 for ; Fri, 11 Oct 2024 03:01:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728640867; cv=pass; d=google.com; s=arc-20240605; b=DulaZn20l8xcdsXflMsc3JSXDkaE3QXK/Af/8YJBmoQGOxo5+W79efqBbz5MFotlKD zoLZ+ta+pdIUfP7fjRVTGneu4MKMGczxql4DPrAySlUa/AY+4XTJfP+vbKbgeyzJ8DS4 b54pAW66JgBVs0ykAu3JE13onHFSkAmL9yLscL9KnLn7WWBh5elOOG/JB5CZbrEcbN9I T8x1T5sI2d7SdDCJk3MG3NUIM5iUV4AzzrZ5XH7N6iNWKaO6mLnwUL6ckKMK4RSK5mHL 7fJfT+U0yj1HFSoc/MVIFFyu+V7k7qwKr1b7mLjYtl5wPB2BSIohwUYn0lM7IMMr7Q7e FjWA== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=NzOesAfV6DU2kRsMJ0UXq3v7iw/78hP9tIRT0ssPL5Q=; fh=IEhoMCG/dCWgSzpHCqn0XJlsH/yqkQmPc9v92P3nmtU=; b=D55111SeTrvges5rFpoNISBTWMKKbD8v6ySe/6lMInJxyNA51CKSgtcORcCszdKPJM U0NyYe35YsULiSgRjdOEY196b5Ad536Mz/jy/yXIsDwdQBKaMufmdLdATk+SSx8Zxpor 7smoamhIYF7Rn4z1oM7pXSo+D6cKTdJYC6X0+PZd7NEgnQkhvdG+ROZioqKkyBZqngmZ n3irhzBRHYkYUfnhcv+JEjyPdeb6X3e2sri8FMJqTKLJe2YmoQOJ4Md03JLK4nl2xETG 1fufCX2t7lFe1ph0yc+ZJ2y9eSeakTHFjk7TAGe7JFXRqYDumRf5Rj4+nQCSfS9u7Z4D c0ng==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1728640867; x=1729245667; darn=isar-build.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:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=NzOesAfV6DU2kRsMJ0UXq3v7iw/78hP9tIRT0ssPL5Q=; b=Hic//QMGW6oJ2CRQUJLlzn4SqjkjcsQRKlZmUfzufXMSttQ02wgzEmRHiAaPzWXrPH maTOh1M5aj6K+im1QJncnzLOZJWmRPaYCLVPJwEoURqSiwLZSnJiY55BTpBieOgjnVfh t7srY6t4jF3MbH4ghPhvHW3yC8uPlx0up4UFExUhZEFy8tBskPVStsETms0h4W1x1YcI TAmb7Del+So4pgAxVYyNCsalcEGkIH5ZdN66+UIamUG0bphdCprdOpq8JFFibjePQ4Y1 /kxp+lMNeoJdnuh1K0fmZNVRdy9zN8/K9ejqoMXwOvjTcBYwpo+vxfQtSR5n1iFhnTmp NxnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728640867; x=1729245667; 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 :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=NzOesAfV6DU2kRsMJ0UXq3v7iw/78hP9tIRT0ssPL5Q=; b=mZQ7fgT20LfTgRIRuwc2k8jNB625fggRkYgcs2EV3Bze9RIiE9ruqAOz1afUw/K8ib crxCOsO4FY6CHnWr4kTQi0lTzFuUHvFIcwj7NENy/jR+5gTydWdSLkA0snTcMINXGxtU 4V3wZdZ9YFDCewonQBx5rGNjTIwJbktdKfJSfHMM/JBLiqa+vlaM12iPZ/3fZM/rMg0L WEXWjWyerPdQs8CbfDE87F70uK9F/Lq26wTJ/bct70GD0gBmym1YLD2KvnvzyMchO6uG WZj5YX9p8aRKhn2Rns6Rv0jrU+E2FVuGnA5D4smEsgqMAWibconL0Vq4/cONagrvmfgt 8qkw== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWsUz1EFtb+q7g6vGUe1NNSE6zy9GFy+eAXRKZ7SMoCwNsbb3CCXHIqbeH5Mur2qiiILYTmQr0=@isar-build.org X-Gm-Message-State: AOJu0YzxfDoG23vSakHdNqmVlRh0UwIwQ/lGelGtZLq4q07x1AWwPLDo nv+coNWHfy6vfIQNRB5sDSbnEAINQLoiRxvVJr5f12QL2h6QNXzd X-Google-Smtp-Source: AGHT+IGlE+uuFJPFxt3KtmEfgaqXtRNBt4CAlRhd5aTg5X+daUflENDDsZloPDuWWba2Bdd+joh2vw== X-Received: by 2002:a05:6214:33c4:b0:6cb:ce4c:1cc2 with SMTP id 6a1803df08f44-6cbeff66007mr33723636d6.29.1728640866990; Fri, 11 Oct 2024 03:01:06 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6214:260e:b0:6b0:862d:9779 with SMTP id 6a1803df08f44-6cbe548f84als29765546d6.0.-pod-prod-04-us; Fri, 11 Oct 2024 03:01:06 -0700 (PDT) X-Received: by 2002:a05:620a:4488:b0:7a9:8876:4217 with SMTP id af79cd13be357-7b11a3843b8mr344078385a.25.1728640866337; Fri, 11 Oct 2024 03:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728640866; cv=none; d=google.com; s=arc-20240605; b=NibRGO+C8FB76KYbnAN2OseDVbWxb9PB1LwQWYzRyUaQJ9o4nqHS080RVeJLPLJKHf jhgpC4pqVAuPsnIwer33xsQ1Gi9BsyoJEKJKai1BkRFixuIYxXJaV7/sp5ngdxvINTd0 xlzarsLAaGsK5v83tLAHLCld9kjnH1bE9GWGru9aEIU4pZLDr0luPC3mK53VhbM4vo9j CR3q8+JPfRucUudVwlAMI7Wpy4T3jTprovPZQW4fX3HDwrNoyJekZ36CFJjvJ9zDAbVH C+PPUKUJ53DRV/IVBVz33bCelNU4O+ngi+WjL8xiouZ1AKGxIVMKCcOkcH+PWOcHIu8c SzWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=LFqdscIyuyH7v9IH973uboDrXiUGQASG8pNGrdgiYcs=; fh=+XrxACcU08BQoTNb4LOPSrVTQ061QS53EcHPaZcNlwA=; b=RKrJX06YHWI4LUg5hMcdC4IxlEMOgmpoUmX95sU5cki5XDji0g3DMmLB4MqynBWdv7 INqhbwXWH+OiPoavRjp/2VNED0/ENyfcoKvPF/LUdqT8YowmtBaOm00pSYE3YT2AY1oU tzFrSWuMf48T6oTvwJOARIwxtvz3w6/SNbCp72MT1Z6RbqJji/SP5fdawewiqML/Fbql ktvddF9C7eIYfGlkrZPs/NV3qxkxrxQEb3f6I8VOBZWfBfdYeuCKyqm+KYUG2dQItuCI wG+m3nhADyP7p7P4RkUYBQJUSN5+MAuqpOv8x8Wx04Ik74DNQThrqD1mQ4Fs+5HPoJsO WoDg==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id d75a77b69052e-4604807bc45si1287261cf.5.2024.10.11.03.01.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Oct 2024 03:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Received: from user-B660.promwad.corp ([159.148.83.114]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 49BA0vWO008632 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 12:01:04 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Florian Bezdeka , Anton Mikanovich Subject: [PATCH v3 7/8] rootfs: Add missing umounts in rootfs_postprocess() and rootfs_install() Date: Fri, 11 Oct 2024 13:00:49 +0300 Message-Id: <20241011100050.322686-8-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241011100050.322686-1-amikan@ilbers.de> References: <20241011100050.322686-1-amikan@ilbers.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, 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-Original-Sender: amikan@ilbers.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Florian Bezdeka Calls to rootfs_do_mounts should always be paired with calls to rootfs_do_umounts. With this change, it is done in do_rootfs_install and do_rootfs_postprocess. 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. To reproduce: . ./isar-init-build-env newbuild mount >01.txt cat >conf/local.conf <02.txt diff -Naurp 01.txt 02.txt +tmpfs on newbuild/tmp/work/debian-bookworm-amd64/sbuild-chroot-target/1.0-r0/rootfs/dev type tmpfs (rw,nosuid,size=4096k,nr_inodes=65536,mode=755,inode64) Signed-off-by: Florian Bezdeka Signed-off-by: Anton Mikanovich --- 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 ef40cbdf..c7011508 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -248,18 +248,21 @@ python do_rootfs_install() { progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights) d.rootfs_progress = progress_reporter - 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 @@ -379,9 +382,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