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 8E750246BC9; Mon, 23 Jun 2025 13:31:15 +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=1750685475; cv=none; b=K9IXbMaEa92g5CbdQ7lsixNf7+1xm287ezzAGbvLaho4xpL0m3kaEy6J8WtgOTvuYYpXr+WTr7tb8rIVcmH/Zd7fAXOpOt6HZmzHXTRK7gnsgDsbnaI7FGb6+lYBLGB65LC/eyzYfPpfEbmHREwDJgzqP7w29XP9QE3Rd+pAiSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750685475; c=relaxed/simple; bh=/AfS6rj3Uk8FdFaPSnnQuiFWCnzIoWKJ1E7ilb+8Vjs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rElamBlUpDNgx6tuUgLrbTTbeCyoGY39uJnueDC+fRVcvGsiQlnXuxNR0vI5sS1yQ0diZfzzbN8VtPjoct76nxwFF9/Bg3VRmL49QZT7caT16Fugi5YoFdxPvnaLLumiFcIMWhQOCP5AV5PGuOUZzJNRlAPMNWc3IfCmbvfwAu8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ldCoclYe; 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="ldCoclYe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20915C4CEEA; Mon, 23 Jun 2025 13:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750685475; bh=/AfS6rj3Uk8FdFaPSnnQuiFWCnzIoWKJ1E7ilb+8Vjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldCoclYeGq7abazL/N5tpyM38KMOpCoA97hmzr/5PLcm3YYi4ZENpNBDZALo4jp14 pF0BAu5BRGfLGpd9VbcSrjxut5vMYjnAKl3jYtjDf/6O4+pSOEzGkTGgdAxdK64Puv pQ9tvut8AeD5oFPXTBQU7ms3bLp7zchf49l6pK3U= 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 5.10 077/355] perf scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3 Date: Mon, 23 Jun 2025 15:04:38 +0200 Message-ID: <20250623130629.136544535@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130626.716971725@linuxfoundation.org> References: <20250623130626.716971725@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-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 711d4f9f5645c..4cea374b284c1 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py @@ -679,7 +679,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