From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kxxt.dev (mail.kxxt.dev [74.48.220.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24A8221ADC7; Tue, 27 Jan 2026 13:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.48.220.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769519723; cv=none; b=tLqYzqFuTRH1P/xw6xYjTXG5KQTYQqn4+m2B2c34QfkCmncu/yNIZSiXWnXtye6ejwVLBDtoqIS2yMgsG7RVKe1TFoiT8bco0zaI3t8E8PVFEvPIKEB1PSXaEZV5sPT8t8/uk8sJytXVo8G40/7Wg+E4VwLnvn5qZyDyOkxZLW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769519723; c=relaxed/simple; bh=mFButoGHQZcrOyrgWBvTDZrcCDzB5RoEFmjHO/hbw1E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nFTfsxDqhP1lIE11kY8BR+3xcA7gdebO5fPFd/zSMg0yTAM40ky/tabAdCzHXBcwzCc4weK+TN+GasYa+8mFalNAtcYcPnxTAapvGJdDo8rQQo7JJaz+bZJ/geGHDoRArUDq6wARc1xE2zIm+CZlGZEDJHWmWVIJn/9B47KRIZc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kxxt.dev; spf=pass smtp.mailfrom=kxxt.dev; dkim=pass (1024-bit key) header.d=kxxt.dev header.i=@kxxt.dev header.b=ZODZwldz; arc=none smtp.client-ip=74.48.220.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kxxt.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kxxt.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kxxt.dev header.i=@kxxt.dev header.b="ZODZwldz" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kxxt.dev; s=mail; t=1769519392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTbWecwoErc7fpelSZ8kiImPL5MfmGQxCTtL9RFgpUc=; b=ZODZwldzPkeme8lmvl0AHh2DB5PSVZ/Fbs7CTXIcpCmm7FQlRU8SwK0dBYocITFfpoiF0W KVS0yUe4KBh3nz/Al2Qx5wCuGoJHgbC7Tdsn4vEFELLKqxXIJE2Cdkb2dC0nSo5ERU5kei 5YTtjtxLqOHP/3w3Tn7fhHiUU4C4v1E= Date: Tue, 27 Jan 2026 21:09:41 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] scripts: generate_rust_analyzer.py: avoid FD leak To: Miguel Ojeda , Tamir Duberstein Cc: Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Alex Gaynor , Boris-Chengbiao Zhou , Kees Cook , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Daniel Almeida , Fiona Behrens References: <20260122-rust-analyzer-fd-leak-v1-1-945577813b20@kernel.org> Content-Language: en-US From: Levi Zim In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 1/26/26 10:09 AM, Miguel Ojeda wrote: > On Thu, Jan 22, 2026 at 5:44 PM Tamir Duberstein 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 >