From: "'Clara Kowalsky' via isar-users" <isar-users@googlegroups.com>
To: "Moessbauer,
Felix (FT RPD CPC OES-DE)" <felix.moessbauer@siemens.com>,
"isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: Re: [PATCH 3/8] isar-events: close /proc/mounts after cleanup
Date: Wed, 11 Nov 2026 15:38:11 +0100 [thread overview]
Message-ID: <8e6d767c-0c61-4a38-a9a4-665b63ca984f@siemens.com> (raw)
In-Reply-To: <f899ffac089d62885189de31c9770cce168d7427.camel@siemens.com>
On 11/10/26 12:22, Moessbauer, Felix (FT RPD CPC OES-DE) wrote:
> On Mon, 2026-11-09 at 10:17 +0100, 'Clara Kowalsky' via isar-users
> wrote:
>> Running the UUID unittest:
>>
>> python3 -m unittest discover -s testsuite/unittests \
>> -p test_build_uuid.py -v
>>
>> emits the warning:
>>
>> /isar/meta/classes-global/isar-events.bbclass:65:
>> ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/mounts'
>> mode='r' encoding='UTF-8'>
>>
>> The test_completion_resets_only_default_multiconfig exercises the
>> BuildCompleted handler, which reads /proc/mounts using open() without
>> closing the file. Fix this by reading the mount entries within a context
>> manager for deterministic file closure.
>
> This fix is relevant independent of the unit test that triggered the
> warning. Please move it prior to the test and also consider just
> sending it as a standalone fix.
>
> Felix
I'll send this fix separately from the series.
Clara
>
>>
>> Fixes: e596cdf97198 ("isar-events: Unhide mounts left behind")
>> Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
>> ---
>> meta/classes-global/isar-events.bbclass | 37 +++++++++++++------------
>> 1 file changed, 19 insertions(+), 18 deletions(-)
>>
>> diff --git a/meta/classes-global/isar-events.bbclass b/meta/classes-global/isar-events.bbclass
>> index 9b66796e..48f5f441 100644
>> --- a/meta/classes-global/isar-events.bbclass
>> +++ b/meta/classes-global/isar-events.bbclass
>> @@ -62,24 +62,25 @@ python build_completed() {
>>
>> basepath = tmpdir + '/work/'
>>
>> - for line in reversed(list(open('/proc/mounts'))):
>> - if basepath not in line:
>> - continue
>> - msg_line = f"{line.split()[1]} left mounted"
>> - # If bitbake is started manually, bb.warn and bb.error go to stdout;
>> - # with bb.error, bitbake additionally fails the build. Under CI,
>> - # bb.warn and bb.error currently go to a file.
>> - if fail_on_cleanup:
>> - bb.error(msg_line)
>> - else:
>> - msg_line += ', unmounting...'
>> - bb.warn(msg_line)
>> - try:
>> - subprocess.run(
>> - f"sudo umount {line.split()[1]}", shell=True, check=True
>> - )
>> - except subprocess.CalledProcessError as e:
>> - bb.error(str(e))
>> + with open('/proc/mounts') as mounts:
>> + for line in reversed(mounts.readlines()):
>> + if basepath not in line:
>> + continue
>> + msg_line = f"{line.split()[1]} left mounted"
>> + # If bitbake is started manually, bb.warn and bb.error go to stdout;
>> + # with bb.error, bitbake additionally fails the build. Under CI,
>> + # bb.warn and bb.error currently go to a file.
>> + if fail_on_cleanup:
>> + bb.error(msg_line)
>> + else:
>> + msg_line += ', unmounting...'
>> + bb.warn(msg_line)
>> + try:
>> + subprocess.run(
>> + f"sudo umount {line.split()[1]}", shell=True, check=True
>> + )
>> + except subprocess.CalledProcessError as e:
>> + bb.error(str(e))
>>
>> # Cleanup build UUID, the next bitbake run will generate new one
>> bb.utils.exec_flat_python_func('clear_build_uuid', d)
>> --
>> 2.56.0
>>
>> --
>> You received this message because you are subscribed to the Google Groups "isar-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
>> To view this discussion visit https://groups.google.com/d/msgid/isar-users/20261109091802.202521-4-clara.kowalsky%40siemens.com.
>
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/8e6d767c-0c61-4a38-a9a4-665b63ca984f%40siemens.com.
next prev parent reply other threads:[~2026-11-11 14:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 9:17 [PATCH 0/8] Update BitBake in Isar to v2.20.0 'Clara Kowalsky' via isar-users
2026-11-09 9:17 ` [PATCH 1/8] base: replace BitBake's outdated persist_data 'Clara Kowalsky' via isar-users
2026-11-10 11:18 ` 'Moessbauer, Felix' via isar-users
2026-11-11 14:37 ` 'Clara Kowalsky' via isar-users
2026-11-09 9:17 ` [PATCH 2/8] isar-events: preserve cleanup for default multiconfig 'Clara Kowalsky' via isar-users
2026-11-09 9:17 ` [PATCH 3/8] isar-events: close /proc/mounts after cleanup 'Clara Kowalsky' via isar-users
2026-11-10 11:22 ` 'Moessbauer, Felix' via isar-users
2026-11-11 14:38 ` 'Clara Kowalsky' via isar-users [this message]
2026-11-09 9:17 ` [PATCH 4/8] meta: migrate fetcher references to bb.fetch 'Clara Kowalsky' via isar-users
2026-11-09 9:17 ` [PATCH 5/8] wic: run the Python driver outside the imaging chroot 'Clara Kowalsky' via isar-users
2026-11-10 11:39 ` 'Moessbauer, Felix' via isar-users
2026-11-11 14:39 ` 'Clara Kowalsky' via isar-users
2026-11-09 9:17 ` [PATCH 6/8] bitbake.conf: explicitly exclude export and func from signatures 'Clara Kowalsky' via isar-users
2026-11-09 9:18 ` [PATCH 7/8] meta: add missing whitespace around assignment operators 'Clara Kowalsky' via isar-users
2026-11-09 9:18 ` [PATCH 8/8] bitbake: update to v2.20.0 'Clara Kowalsky' via isar-users
2026-11-13 14:41 ` [PATCH 0/8] Update BitBake in Isar " Anton Mikanovich
2026-11-13 17:19 ` 'Clara Kowalsky' via isar-users
2026-11-16 8:46 ` 'Moessbauer, Felix' via isar-users
2026-11-16 10:44 ` 'Clara Kowalsky' via isar-users
2026-11-16 12:12 ` 'Moessbauer, Felix' via isar-users
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e6d767c-0c61-4a38-a9a4-665b63ca984f@siemens.com \
--to=isar-users@googlegroups.com \
--cc=clara.kowalsky@siemens.com \
--cc=felix.moessbauer@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox