From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 05135285059; Tue, 17 Jun 2025 16:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750178341; cv=none; b=R2sImE3SV7GAqownktkMckhCvUAI1QO/2qfl5kYVKsO/SZO2+mmluw8h9ez4Jg/w1ridSh8MDoJEwcU2iTOwC1oft1p1z00TKdjI0oJ5swljwvEvzsy6qQOV7uBDLmTxiV9SlNdyZDNT8Cv+tTECHDvcok3j9TtKmpc0mo6wt9g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750178341; c=relaxed/simple; bh=2G89DD0shL4qifgBmqINvGr/IChj/MI8rHw4/4zS0U8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bmEivIAwMmpFybU/NVzbfiZC2Pdxsa+d0+rB1OJ3H09XMkff+FhLwv4RHNacO6U75mrkPboAgf3fujhuMRCwRBATO599PgAgKYod+wOJl0f0SudSlF5p/g4EbnbfBm2r3bBEQrh1S/HhHas2fDKngxL8PGCVbNdxcgF1W2acvQE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=phJwXoEm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="phJwXoEm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A5F0C4CEE3; Tue, 17 Jun 2025 16:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750178340; bh=2G89DD0shL4qifgBmqINvGr/IChj/MI8rHw4/4zS0U8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=phJwXoEm15xOl57zCtTiqEe7i9c2/gYxYT70GqISEfT3ZOqHf3hSVyGGVBXKpSzsU joPtBTtoRDy1KMbi6KEMfLLyMIV8eudi9Hwl/riGjsD0hbwCt+YgBXSSArjj0tr9s7 dmXPUNhZyWC4Dyp3KXrXaTpaqhr+w5d/YPNHqSwE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Adrian Hunter , Alexander Shishkin , Ian Rogers , Jiri Olsa , Kan Liang , Namhyung Kim , Tony Jones , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.15 446/780] perf scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3 Date: Tue, 17 Jun 2025 17:22:34 +0200 Message-ID: <20250617152509.617727133@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152451.485330293@linuxfoundation.org> References: <20250617152451.485330293@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter [ Upstream commit 17e548405a81665fd14cee960db7d093d1396400 ] The script allows the user to enter patterns to find symbols. The pattern matching characters are converted for use in SQL. For PostgreSQL the conversion involves using the Python maketrans() method which is slightly different in Python 3 compared with Python 2. Fix to work in Python 3. Fixes: beda0e725e5f06ac ("perf script python: Add Python3 support to exported-sql-viewer.py") Signed-off-by: Adrian Hunter Cc: Alexander Shishkin Cc: Ian Rogers Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Cc: Tony Jones Link: https://lore.kernel.org/r/20250512093932.79854-4-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/scripts/python/exported-sql-viewer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py index 121cf61ba1b34..e0b2e7268ef68 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py @@ -680,7 +680,10 @@ class CallGraphModelBase(TreeModel): s = value.replace("%", "\\%") s = s.replace("_", "\\_") # Translate * and ? into SQL LIKE pattern characters % and _ - trans = string.maketrans("*?", "%_") + if sys.version_info[0] == 3: + trans = str.maketrans("*?", "%_") + else: + trans = string.maketrans("*?", "%_") match = " LIKE '" + str(s).translate(trans) + "'" else: match = " GLOB '" + str(value) + "'" -- 2.39.5