From nobody Mon Apr 7 10:03:27 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1739372790; cv=none; d=zohomail.com; s=zohoarc; b=bJbUwyexykOrU5/wxZUOrnS4fAfqTlcz3tOPzrVKP34WlbEWcH9PhOLgr/rh5VuNeywUGeHLj5xDL/nLyIhhHxFllgMK+txHqo2jZKiDfD9YivzzV+OdHMcAdA5SZXs/hkZIJc8YPOzn8IRT3XTxgdSoKDZ469yWdWsAbaQgdgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1739372790; 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=1plaUmj74XcAc2CwN9OhRWfahHgLn2DxwUeq/HMPwAg=; b=AZJLGeHXm5d+abhw806l5g5fa3eH8rMyGGJZkKKq4cd2ncHL4NPmycz8tRtstzKmWN2m2+OO4SJ72CtfN36p2eJDc9f3ZnQzEmhh6bBt8gi69F3Nk1OwS2blhn0nk1bu3sdwNp9o7Sfp2SugwNaC5pVE3JNuTrogDZ9Bukj6htU= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1739372790214307.94246753743573; Wed, 12 Feb 2025 07:06:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tiEJ1-0005XZ-Lh; Wed, 12 Feb 2025 10:05:39 -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 1tiEIz-0005X4-Hz for qemu-devel@nongnu.org; Wed, 12 Feb 2025 10:05:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tiEIx-0005MJ-06 for qemu-devel@nongnu.org; Wed, 12 Feb 2025 10:05:36 -0500 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-PODrlE61NOqNtirQjqfK8g-1; Wed, 12 Feb 2025 10:05:30 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DFC5F1955BD4; Wed, 12 Feb 2025 15:05:27 +0000 (UTC) Received: from localhost (unknown [10.2.16.66]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5A7781800876; Wed, 12 Feb 2025 15:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739372733; 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=1plaUmj74XcAc2CwN9OhRWfahHgLn2DxwUeq/HMPwAg=; b=fEEIue+cYPqY0MYkkMkrt4VQJE7H+/Fi3rTlhM19OgRGQNpDYA2pZl8ujjwyFWyUyBfyIa 42IdCEqIrgzNKJzaNOp0CQ7c3vkdzrSt43tFcR031wb+U6FQA1vGeEOnW/E6C8Vt0+7n3H TkQ93cHTmFLS7lG+Uvp/SlS4AQKMEk4= X-MC-Unique: PODrlE61NOqNtirQjqfK8g-1 X-Mimecast-MFC-AGG-ID: PODrlE61NOqNtirQjqfK8g From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Mads Ynddal , Stefan Hajnoczi , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 1/1] scripts: improve error from qemu-trace-stap on missing 'stap' Date: Wed, 12 Feb 2025 10:05:22 -0500 Message-ID: <20250212150522.202022-2-stefanha@redhat.com> In-Reply-To: <20250212150522.202022-1-stefanha@redhat.com> References: <20250212150522.202022-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.495, 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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=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: 1739372793895019000 From: Daniel P. Berrang=C3=A9 If the 'stap' binary is missing in $PATH, a huge trace is thrown $ qemu-trace-stap list /usr/bin/qemu-system-x86_64 Traceback (most recent call last): File "/usr/bin/qemu-trace-stap", line 169, in main() File "/usr/bin/qemu-trace-stap", line 165, in main args.func(args) File "/usr/bin/qemu-trace-stap", line 83, in cmd_run subprocess.call(stapargs) File "/usr/lib64/python3.12/subprocess.py", line 389, in call with Popen(*popenargs, **kwargs) as p: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/subprocess.py", line 1026, in {}init{} self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib64/python3.12/subprocess.py", line 1955, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'stap' With this change the user now gets $ qemu-trace-stap list /usr/bin/qemu-system-x86_64 Unable to find 'stap' in $PATH Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20241206114524.1666664-1-berrange@redhat.com Signed-off-by: Stefan Hajnoczi --- scripts/qemu-trace-stap | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-trace-stap b/scripts/qemu-trace-stap index eb6e951ff2..e983460ee7 100755 --- a/scripts/qemu-trace-stap +++ b/scripts/qemu-trace-stap @@ -56,6 +56,7 @@ def tapset_dir(binary): =20 =20 def cmd_run(args): + stap =3D which("stap") prefix =3D probe_prefix(args.binary) tapsets =3D tapset_dir(args.binary) =20 @@ -76,7 +77,7 @@ def cmd_run(args): =20 # We request an 8MB buffer, since the stap default 1MB buffer # can be easily overflowed by frequently firing QEMU traces - stapargs =3D ["stap", "-s", "8", "-I", tapsets ] + stapargs =3D [stap, "-s", "8", "-I", tapsets ] if args.pid is not None: stapargs.extend(["-x", args.pid]) stapargs.extend(["-e", script]) @@ -84,6 +85,7 @@ def cmd_run(args): =20 =20 def cmd_list(args): + stap =3D which("stap") tapsets =3D tapset_dir(args.binary) =20 if args.verbose: @@ -96,7 +98,7 @@ def cmd_list(args): =20 if verbose: print("Listing probes with name '%s'" % script) - proc =3D subprocess.Popen(["stap", "-I", tapsets, "-l", script], + proc =3D subprocess.Popen([stap, "-I", tapsets, "-l", script], stdout=3Dsubprocess.PIPE, universal_newlines=3DTrue) out, err =3D proc.communicate() --=20 2.48.1