lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221117182240.39104-1-jonathan.davies@nutanix.com>
Date:   Thu, 17 Nov 2022 18:22:40 +0000
From:   Jonathan Davies <jonathan.davies@...anix.com>
To:     linux-kernel@...r.kernel.org
Cc:     Mike Pagano <mpagano@...too.org>, Michal Marek <mmarek@...e.cz>,
        Jonathan Davies <jonathan.davies@...anix.com>
Subject: [PATCH] scripts/show_delta: port to python3

Although commit f29b5f3e6fc0 ("show_delta: Update script to support python
versions 2.5 through 3.3") claims that show_delta is python3-compatible, it
uses some functions that were removed in python3: string.split, string.atof
and string.find. Replace these with modern equivalents.

Also, to suppress newlines from print(), the 'end' parameter is now required.

With these changes, the script can be used under python3, so update the
shebang line to reflect this.

Signed-off-by: Jonathan Davies <jonathan.davies@...anix.com>
---
 scripts/show_delta | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/show_delta b/scripts/show_delta
index 28e67e178194..10f0c9089611 100755
--- a/scripts/show_delta
+++ b/scripts/show_delta
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0-only
 #
 # show_deltas: Read list of printk messages instrumented with
@@ -46,8 +46,8 @@ def get_time(line):
 		raise ValueError
 
 	# split on closing bracket
-	(time_str, rest) = string.split(line[1:],']',1)
-	time = string.atof(time_str)
+	(time_str, rest) = line[1:].split(']', 1)
+	time = float(time_str)
 
 	#print "time=", time
 	return (time, rest)
@@ -111,7 +111,7 @@ def main():
 					(time, rest) = get_time(line)
 				except:
 					continue
-				if string.find(rest, base_str)==1:
+				if rest.find(base_str)==1:
 					base_time = time
 					found = 1
 					# stop at first match
@@ -123,6 +123,6 @@ def main():
 		base_time = 0.0
 
 	for line in lines:
-		print (convert_line(line, base_time),)
+		print (convert_line(line, base_time), end='')
 
 main()
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ