From: Stefan Hajnoczi <stefanha@redhat.com>
To: Nir Soffer <nirsof@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Hanna Reitz <hreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH v2] iotest: Unbreak 302 with python 3.13
Date: Mon, 3 Mar 2025 16:41:56 +0800 [thread overview]
Message-ID: <20250303084156.GB205177@fedora> (raw)
In-Reply-To: <20250228195708.48035-1-nirsof@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]
On Fri, Feb 28, 2025 at 09:57:08PM +0200, Nir Soffer wrote:
> This test depends on TarFile.addfile() to add tar member header without
> writing the member data, which we write ourself using qemu-nbd. Python
> 3.13 changed the function in a backward incompatible way[1] to require a
> file object for tarinfo with non-zero size, breaking the test:
>
> -[{"name": "vm.ovf", "offset": 512, "size": 6}, {"name": "disk", "offset": 1536, "size": 393216}]
> +Traceback (most recent call last):
> + File "/home/stefanha/qemu/tests/qemu-iotests/302", line 118, in <module>
> + tar.addfile(disk)
> + ~~~~~~~~~~~^^^^^^
> + File "/usr/lib64/python3.13/tarfile.py", line 2262, in addfile
> + raise ValueError("fileobj not provided for non zero-size regular file")
> +ValueError: fileobj not provided for non zero-size regular file
>
> The new behavior makes sense for most users, but breaks our unusual
> usage. Fix the test to add the member header directly using public but
> undocumented attributes. This is more fragile but the test works again.
>
> This also fixes a bug in the previous code - when calling addfile()
> without a fileobject, tar.offset points to the start of the member data
> instead of the end.
>
> [1] https://github.com/python/cpython/pull/117988
>
> Signed-off-by: Nir Soffer <nirsof@gmail.com>
> ---
> tests/qemu-iotests/302 | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-03-03 9:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 19:57 [PATCH v2] iotest: Unbreak 302 with python 3.13 Nir Soffer
2025-02-28 20:23 ` Eric Blake
2025-03-03 8:41 ` Stefan Hajnoczi [this message]
2025-03-04 22:41 ` Eric Blake
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=20250303084156.GB205177@fedora \
--to=stefanha@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=nirsof@gmail.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.