public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: linux-integrity@vger.kernel.org, peterhuewe@gmx.de,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	skhan@linuxfoundation.org, Stefan Berger <stefanb@linux.ibm.com>,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH] selftests: tpm2: Implement class desstructor to close file descriptor
Date: Tue, 20 Sep 2022 07:31:56 +0300	[thread overview]
Message-ID: <YylCPAGbn7MgICau@kernel.org> (raw)
In-Reply-To: <20220909152056.1335261-1-stefanb@linux.vnet.ibm.com>

s/desstructor/destructor/

I'd change it to "selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle"

On Fri, Sep 09, 2022 at 11:20:56AM -0400, Stefan Berger wrote:
> From: Stefan Berger <stefanb@linux.ibm.com>
> 
> Implement a class destructor to close the open TPM file descriptor
> and avoid the following error message:
> 
>  test_flush_context (tpm2_tests.SpaceTest) ... \
>    /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
>    unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True>

I don't recall seeing this. Does this happen on every test case?

Should better describe what is going on, e.g.

"
The following output can bee seen when the test is executed:

  test_flush_context (tpm2_tests.SpaceTest) ... \
    /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
    unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True>

An instance of Client does not implicitly close /dev/tpm* handle, once it
gets destroyed. Close the file handle in the class destructor
Client.__del__().
"

> 
> Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests")
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-kselftest@vger.kernel.org
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

BR, Jarkko

  parent reply	other threads:[~2022-09-20  4:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 15:20 [PATCH] selftests: tpm2: Implement class desstructor to close file descriptor Stefan Berger
2022-09-09 15:39 ` R Nageswara Sastry
2022-09-20  4:31 ` Jarkko Sakkinen [this message]
2022-09-20 13:14   ` Stefan Berger

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=YylCPAGbn7MgICau@kernel.org \
    --to=jarkko@kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stefanb@linux.ibm.com \
    --cc=stefanb@linux.vnet.ibm.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