From nobody Fri Nov 14 23:31:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762204353; cv=none; d=zohomail.com; s=zohoarc; b=ldU4VMpXTOx7oJWGfP/dnyWvFM12xU5esNoRyYiPQiocEHl5DoV0dj+hCsYPPdaBrSW8fHjEnOavcvcEJUfjqb/DkC+kfmDPOyHG5vGMXxBuHMCYw3gn/lkYi2BaaW/+IhJhuOsOMexhfYYGb0TV9goznOyt4JfMgMNyWsLc298= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762204353; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=hwX9C0tP/7gGsyStbtD/28gMsfxnFuT7IxMFoaf8X6Ip4Q7F7meZ1CN5aO59EufEfbg01EYIPM3yMnPXIdDxsaEmgE0VSqrnlegmP8lGLtuDK05jrYvayRe6Ob1cYCiPTaAJEbn3ds8goUkgnZTaP+quy/BLT6T6iT3ELsWOsaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1762204353117837.1544127159341; Mon, 3 Nov 2025 13:12:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vG1m0-00017I-VC; Mon, 03 Nov 2025 16:07:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1ly-00016J-0r for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vG1lf-0005QL-M0 for qemu-devel@nongnu.org; Mon, 03 Nov 2025 16:07:29 -0500 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231--Ic1oF0CPEewRklV47pLsg-1; Mon, 03 Nov 2025 16:07:08 -0500 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8a4ef35cc93so1433974285a.3 for ; Mon, 03 Nov 2025 13:07:08 -0800 (PST) Received: from x1.com ([142.188.210.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b0f5468968sm57428185a.19.2025.11.03.13.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 13:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762204029; 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=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=LoPzSRocOYN5LmE7/hj+3XKTfO6l6LqiJ7P/6ZD5ruITksMzSUPAoF32nzIHT77SwgOwB6 8M61pYRZ41S/M2jA4EE/XTu4LB56NdTSObmWp7Ee25+uW9TrDUIwR4Ic0aKZDD/101hCvU lDhOwHub6D8dGVwX56jbS6aCLYYNHtU= X-MC-Unique: -Ic1oF0CPEewRklV47pLsg-1 X-Mimecast-MFC-AGG-ID: -Ic1oF0CPEewRklV47pLsg_1762204028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762204027; x=1762808827; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=Vyt6ZzyauLVYn2XDT8V0VsSvqWiRn0lyuF2TQc/rYtCWcVQD8khyIumdGzjl/ZkpAc XpB4VXFGESCfJ0cImI8xLaYhUQkVOKE1xYSmMumZ5tw7/e1yZl0BkUVKX1rmPj9zIjeh nTuin34EJ9yNwm7bT3pmtDKvBRwb354F2sOqrIiU4ySve0xu8jleF4bJ91Ock+n51pxQ 03EuKQgwv3FRfZv8bAwnYCkxdf6gIgp0lzWlZ3u8FTkGpQJdfLyZCXxHy4RFjK+bAAaG 27+BwHvfJVCqhWIpdYiYSsyLZEUPEEzyIov58tmqA+STmqf/1ujNMZiyDedcfQ1DTHVL NvrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204027; x=1762808827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=78QU1zLKtZBzhS+NWp1ZiPbFKbBWGfv4kQfel61XBDM=; b=Qy2BSFtmC10X2DlYslbe3qcBCDtR+EiR19/GSPvFvNCbbRWYWHLbtNzOQLux3PWKzh HW7VUEHCtvvlB4/l8JQg/rPrbYNjLzwKKLFyK6Q6rUl+G7TeuZ1tmKlmRPt5uwRhKX31 nd2qkYakdf2N6bYh65j2EE2/uqqS7+mXJ665DhfEVEXQvCDvsroKWIHjYajGMZl0blK0 0RQ4BEGsP4Pd/YOuBVwWA5TdVPuDCyXubygsIpMD8xuFOhyGwIIIzXEClO28VPX0fHJr WnsaoAGy1AzTxeTAol3R5cZLVU7iDHwcLp6d1iM/BPslWGF14ZvxNvT+0mdD/q0QLQgu gC/Q== X-Gm-Message-State: AOJu0YxuouKDNgdswltp+wFqtCQ6Uqdcgy7r2lQC0/vckrbq95X5/GTd kMRz0q8zDzJQREKUYn1ApFxPFze5+ci2wyNd+6aKTNxnRHs+V2zLMM2ZfX2jcJnCdT9R2ZYE78H vi9w5F5Q1yvkfG3qdKx43mNW2teIG1cBZ3xorFwHnscj1qQt/SErDNce6B9FEtN3QHkq0JDb/UJ hRJ4hOYx22rYT3spfzbGnsdO9pLI/2nnHv1yffEg== X-Gm-Gg: ASbGncupe00GXmvNevY4TW231908SUpdnbjOpcfrOVugRnCpozvCJJgllma2ev6zbzg UexpA01ZTwgT7UJpIhIVyX+epRy3sni5oMKy7+ew+sDjP38I4oEamZap1PBwpEczs3rRGvlq7IU ohdtbqTVfpw6bTuIu1asF8WD1sVaDxPdKJsNgJyoII4avDN4BzEJt7CHnTVhQL5/ngbOadgj71/ crCltzoQjIJVX277Bf04mkrIAoATPm7XYduO4jxu8Ep9OvvKt3zUB+JtsH5H0fy3r/DODgC0JSc bVDQU/11Y9SndthcRJ771V6jMnNnSwgZkHwM3rmWu+GdMEa+kkfGYHGjWkLPwuzS X-Received: by 2002:a05:620a:4694:b0:89f:b32b:3416 with SMTP id af79cd13be357-8ab9abf941cmr1703194185a.75.1762204027133; Mon, 03 Nov 2025 13:07:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+UgFrud1VaU0z/9ZTengAcyb7EDZAiY2Z8Gat5ulsky5QroJbDs0wKWFeL7aHoXfJt4Tt+g== X-Received: by 2002:a05:620a:4694:b0:89f:b32b:3416 with SMTP id af79cd13be357-8ab9abf941cmr1703188685a.75.1762204026408; Mon, 03 Nov 2025 13:07:06 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , David Hildenbrand , peterx@redhat.com, Paolo Bonzini , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 27/36] scripts/vmstate-static-checker: Fix deprecation warnings with latest argparse Date: Mon, 3 Nov 2025 16:06:16 -0500 Message-ID: <20251103210625.3689448-28-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251103210625.3689448-1-peterx@redhat.com> References: <20251103210625.3689448-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1762204354360154100 From: Thomas Huth The argparse.FileType() type has been deprecated in the latest argparse version (e.g. the one from Fedora 43), now causing the test_bad_vmstate functional test to fail since there are unexpected strings in the output. Change the script to use pathlib.Path instead to fix the test_bad_vmstate test and to be prepared for the future when the deprecated FileType gets removed completely. Reported-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Link: https://lore.kernel.org/r/20251030092638.39505-1-thuth@redhat.com Signed-off-by: Peter Xu --- scripts/vmstate-static-checker.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-che= cker.py index 2335e25f94..89b100e6cc 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -21,6 +21,7 @@ =20 import argparse import json +import pathlib import sys =20 # Count the number of errors found @@ -382,10 +383,10 @@ def main(): help_text =3D "Parse JSON-formatted vmstate dumps from QEMU in files S= RC and DEST. Checks whether migration from SRC to DEST QEMU versions would= break based on the VMSTATE information contained within the JSON outputs. = The JSON output is created from a QEMU invocation with the -dump-vmstate p= arameter and a filename argument to it. Other parameters to QEMU do not ma= tter, except the -M (machine type) parameter." =20 parser =3D argparse.ArgumentParser(description=3Dhelp_text) - parser.add_argument('-s', '--src', type=3Dargparse.FileType('r'), + parser.add_argument('-s', '--src', type=3Dpathlib.Path, required=3DTrue, help=3D'json dump from src qemu') - parser.add_argument('-d', '--dest', type=3Dargparse.FileType('r'), + parser.add_argument('-d', '--dest', type=3Dpathlib.Path, required=3DTrue, help=3D'json dump from dest qemu') parser.add_argument('--reverse', required=3DFalse, default=3DFalse, @@ -393,10 +394,10 @@ def main(): help=3D'reverse the direction') args =3D parser.parse_args() =20 - src_data =3D json.load(args.src) - dest_data =3D json.load(args.dest) - args.src.close() - args.dest.close() + with open(args.src, 'r', encoding=3D'utf-8') as src_fh: + src_data =3D json.load(src_fh) + with open(args.dest, 'r', encoding=3D'utf-8') as dst_fh: + dest_data =3D json.load(dst_fh) =20 if args.reverse: temp =3D src_data --=20 2.50.1