mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Levi Zim <i@kxxt.dev>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Tamir Duberstein <tamird@kernel.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boris-Chengbiao Zhou" <bobo1239@web.de>,
	"Kees Cook" <kees@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Fiona Behrens" <me@kloenk.dev>
Subject: Re: [PATCH] scripts: generate_rust_analyzer.py: avoid FD leak
Date: Tue, 27 Jan 2026 21:09:41 +0800	[thread overview]
Message-ID: <b07a1e07-9265-4b77-9665-0bfae9b506d3@kxxt.dev> (raw)
In-Reply-To: <CANiq72=+2s48M5imZ7tZj-0SN==f_mLmw_2cWfQYKtBhD1ROCA@mail.gmail.com>


On 1/26/26 10:09 AM, Miguel Ojeda wrote:
> On Thu, Jan 22, 2026 at 5:44 PM Tamir Duberstein <tamird@kernel.org> wrote:
>>
>> Use a context manager to avoid leaking file descriptors.
> 
> This may have been intentionally written like that for simplicity,
> since I think CPython closes them immediately in practice even if it
> does not guarantee it (and I think the kernel may be assuming CPython
> given the version requirement?).

Path.read_text from pathlib would be a better choice for keeping the simplicity
while ensuring the file is closed.

https://docs.python.org/3/library/pathlib.html#pathlib.Path.read_text

Best regards,
Levi
 
> Nevertheless, it is better to be explicit and proper, but it is not
> urgent, so I would say let's put this in rust-analyzer after the merge
> window even if you end up considering it a fix.
> 
> Like in the other one, I don't see the Tested-by from Daniel, so I
> would suggest taking the chance to double-check that meanwhile too.
> 
> Thanks!
> 
> Cheers,
> Miguel
> 


  reply	other threads:[~2026-01-27 13:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 16:44 Tamir Duberstein
2026-01-26  2:09 ` Miguel Ojeda
2026-01-27 13:09   ` Levi Zim [this message]
2026-01-27 13:38     ` Tamir Duberstein
2026-01-27 13:38   ` Tamir Duberstein
2026-02-11 13:26     ` Miguel Ojeda

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=b07a1e07-9265-4b77-9665-0bfae9b506d3@kxxt.dev \
    --to=i@kxxt.dev \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=bobo1239@web.de \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=me@kloenk.dev \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    /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

all inboxes | Powered by JetHome®