Skip to contentSkip to conversation

treewide: replace /usr/bin/python3 shebangs with env python3

PATCH In review Oli R 5 participants 7 messages May 15 – May 18

Subsystems (8)
lore
Share & tools
lore

Oli R

author
#0 lore raw

PATCH 1/1 treewide: replace /usr/bin/python3 shebangs with env python3

Use /usr/bin/env python3 instead of hardcoded interpreter paths to improve portability across environments where python3 is not installed in /usr/bin.

No functional changes intended.

---
 drivers/gpu/drm/msm/registers/gen_header.py                     | 2 +-
 scripts/macro_checker.py                                        | 2 +-
 tools/crypto/ccp/dbc.py                                         | 2 +-
 tools/crypto/ccp/dbc_cli.py                                     | 2 +-
 tools/crypto/ccp/test_dbc.py                                    | 2 +-
 tools/perf/tests/shell/lib/perf_json_output_lint.py             | 2 +-
 .../selftests/devices/probe/test_discoverable_devices.py        | 2 +-
 tools/testing/selftests/rseq/rseq-slice-hist.py                 | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/registers/gen_header.py +1 -1
index 2acad951f1e2..10316f517a7d 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 #
 # Copyright © 2019-2024 Google, Inc.
 #
scripts/macro_checker.py +1 -1
index ba550982e98f..7dbb114a57d5 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0
 # Author: Julian Sun <[email protected]>
 
tools/crypto/ccp/dbc.py +1 -1
index 2b91415b1940..cd56a63aa8ce 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0
 
 import ctypes
tools/crypto/ccp/dbc_cli.py +1 -1
index bf52233fd038..bfe34f01e619 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0
 import argparse
 import binascii
tools/crypto/ccp/test_dbc.py +1 -1
index bb0e671be96d..0ee3da6c6be7 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0
 import unittest
 import os
tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
index dafbde56cc76..dccafd507bb7 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
 # Basic sanity check of perf JSON output as specified in the man page.
 
tools/testing/selftests/devices/probe/test_discoverable_devices.py +1 -1
index d7a2bb91c807..72a94bbfbc7b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0
 #
 # Copyright (c) 2023 Collabora Ltd
tools/testing/selftests/rseq/rseq-slice-hist.py +1 -1
index b7933eeaefb9..2c43b2e2bf0d 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
 #
 # trace-cmd record -e hrtimer_start -e hrtimer_cancel -e hrtimer_expire_entry -- $cmd
Signature · 1 line
2.54.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Commit message states it replaces `#!/usr/bin/python3` shebangs and causes no functional…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Commit message states it replaces #!/usr/bin/python3 shebangs and causes no functional changes, but actually changes #!/usr/bin/python to #!/usr/bin/env python3 in tools/perf/tests/shell/lib/perf_json_output_lint.py. --

commit 7d3e9689ede53be80434b3ba8cd07c27777d11ad
Author: Oli R <[email protected]>

treewide: replace /usr/bin/python3 shebangs with env python3

This commit replaces hardcoded /usr/bin/python3 interpreter paths with /usr/bin/env python3 to improve portability.

Quoted 1 line

treewide: replace /usr/bin/python3 shebangs with env python3

[ ... ]

Quoted 1 line

No functional changes intended.

Is this description accurate?

[ ... ]

tools/perf/tests/shell/lib/perf_json_output_lint.py line 1

Quoted 7 lines
tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
index dafbde56cc76f..dccafd507bb79 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3

Could this affect functionality on systems where python defaults to Python 2 or is managed differently?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw

Dnia piątek, 15 maja 2026 20:15:47 czas środkowoeuropejski letni piszesz:

Quoted 24 lines

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Commit message states it replaces #!/usr/bin/python3 shebangs and causes no functional changes, but actually changes #!/usr/bin/python to #!/usr/bin/env python3 in tools/perf/tests/shell/lib/perf_json_output_lint.py. --

commit 7d3e9689ede53be80434b3ba8cd07c27777d11ad
Author: Oli R <[email protected]>

treewide: replace /usr/bin/python3 shebangs with env python3

This commit replaces hardcoded /usr/bin/python3 interpreter paths with /usr/bin/env python3 to improve portability.

Quoted 1 line

treewide: replace /usr/bin/python3 shebangs with env python3

[ ... ]

Quoted 1 line

No functional changes intended.

Is this description accurate?

[ ... ]

Quoted 11 lines

tools/perf/tests/shell/lib/perf_json_output_lint.py line 1

Quoted 8 lines
(quoted diff) +0 -0

b/tools/perf/tests/shell/lib/perf_json_output_lint.py index dafbde56cc76f..dccafd507bb79 100644

tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3

Could this affect functionality on systems where python defaults to Python 2 or is managed differently?

I had tested that script with python3 and it worked. The syntax anyways is Python 3 syntax, so it wont work on Python 2, so its safe to use python3.

reviewer
#3 lore raw
In reply to [email protected]
Quoted 21 lines · On Fri, May 15, 2026 at 11:35 AM <[email protected]> wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Commit message states it replaces #!/usr/bin/python3 shebangs and causes no functional changes, but actually changes #!/usr/bin/python to #!/usr/bin/env python3 in tools/perf/tests/shell/lib/perf_json_output_lint.py. --

commit 7d3e9689ede53be80434b3ba8cd07c27777d11ad
Author: Oli R <[email protected]>

treewide: replace /usr/bin/python3 shebangs with env python3

This commit replaces hardcoded /usr/bin/python3 interpreter paths with /usr/bin/env python3 to improve portability.

Quoted 1 line

treewide: replace /usr/bin/python3 shebangs with env python3

[ ... ]

Quoted 1 line

No functional changes intended.

Is this description accurate?

[ ... ]

Quoted 10 lines

tools/perf/tests/shell/lib/perf_json_output_lint.py line 1

Quoted 7 lines
tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
index dafbde56cc76f..dccafd507bb79 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3

Could this affect functionality on systems where python defaults to Python 2 or is managed differently?

The change looks good to me, but I wonder it should be split into separate patches for the different subsystems. We do not care about Python 2, so I think some review prompt improvements are necessary.

Thanks!
Ian

Quoted 3 lines

--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1

reviewer
#4 lore raw
Quoted 34 lines · Ian Rogers
Quoted 21 lines · On Fri, May 15, 2026 at 11:35 AM <[email protected]> wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Commit message states it replaces #!/usr/bin/python3 shebangs and causes no functional changes, but actually changes #!/usr/bin/python to #!/usr/bin/env python3 in tools/perf/tests/shell/lib/perf_json_output_lint.py. --

commit 7d3e9689ede53be80434b3ba8cd07c27777d11ad
Author: Oli R <[email protected]>

treewide: replace /usr/bin/python3 shebangs with env python3

This commit replaces hardcoded /usr/bin/python3 interpreter paths with /usr/bin/env python3 to improve portability.

Quoted 1 line

treewide: replace /usr/bin/python3 shebangs with env python3

[ ... ]

Quoted 1 line

No functional changes intended.

Is this description accurate?

[ ... ]

Quoted 10 lines

tools/perf/tests/shell/lib/perf_json_output_lint.py line 1

Quoted 7 lines
tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
index dafbde56cc76f..dccafd507bb79 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3

Could this affect functionality on systems where python defaults to Python 2 or is managed differently?

Quoted 6 lines

The change looks good to me, but I wonder it should be split into separate patches for the different subsystems. We do not care about Python 2, so I think some review prompt improvements are necessary.

Thanks!
Ian

For the review prompts I sent out:
https://github.com/masoncl/review-prompts/pull/62
https://lore.kernel.org/linux-perf-users/CAP-5=fW5Wozj=F2dnXoLTWmUjudNWLyjjg95CuP3Jk9bLcYwww@mail.gmail.com/

In case you are interested, I'm trying to clean up perf's python code in this series (v1 sent Oct. 2025):
https://lore.kernel.org/linux-perf-users/[email protected]/
Testing and reviewing is always appreciated!

Thanks,
Ian

Quoted 3 lines
Quoted 3 lines

--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1

Acked-by on v1 1/1
#5 lore raw
In reply to Oli R
Quoted 9 lines · Oli R

Use /usr/bin/env python3 instead of hardcoded interpreter paths to improve portability across environments where python3 is not installed in /usr/bin.

No functional changes intended.

---
 drivers/gpu/drm/msm/registers/gen_header.py                     | 2 +-
Quoted 8 lines
 scripts/macro_checker.py                                        | 2 +-
 tools/crypto/ccp/dbc.py                                         | 2 +-
 tools/crypto/ccp/dbc_cli.py                                     | 2 +-
 tools/crypto/ccp/test_dbc.py                                    | 2 +-
 tools/perf/tests/shell/lib/perf_json_output_lint.py             | 2 +-
 .../selftests/devices/probe/test_discoverable_devices.py        | 2 +-
 tools/testing/selftests/rseq/rseq-slice-hist.py                 | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v1 1/1
#6 lore raw
In reply to Oli R
Quoted 7 lines · Oli R

Use /usr/bin/env python3 instead of hardcoded interpreter paths to improve portability across environments where python3 is not installed in /usr/bin.

No functional changes intended.

Quoted 91 lines
---
  drivers/gpu/drm/msm/registers/gen_header.py                     | 2 +-
  scripts/macro_checker.py                                        | 2 +-
  tools/crypto/ccp/dbc.py                                         | 2 +-
  tools/crypto/ccp/dbc_cli.py                                     | 2 +-
  tools/crypto/ccp/test_dbc.py                                    | 2 +-
  tools/perf/tests/shell/lib/perf_json_output_lint.py             | 2 +-
  .../selftests/devices/probe/test_discoverable_devices.py        | 2 +-
  tools/testing/selftests/rseq/rseq-slice-hist.py                 | 2 +-
  8 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/registers/gen_header.py +1 -1
index 2acad951f1e2..10316f517a7d 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  #
  # Copyright © 2019-2024 Google, Inc.
  #
scripts/macro_checker.py +1 -1
index ba550982e98f..7dbb114a57d5 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  # SPDX-License-Identifier: GPL-2.0
  # Author: Julian Sun <[email protected]>
 
tools/crypto/ccp/dbc.py +1 -1
index 2b91415b1940..cd56a63aa8ce 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  # SPDX-License-Identifier: GPL-2.0
 
  import ctypes
tools/crypto/ccp/dbc_cli.py +1 -1
index bf52233fd038..bfe34f01e619 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  # SPDX-License-Identifier: GPL-2.0
  import argparse
  import binascii
tools/crypto/ccp/test_dbc.py +1 -1
index bb0e671be96d..0ee3da6c6be7 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  # SPDX-License-Identifier: GPL-2.0
  import unittest
  import os
tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
index dafbde56cc76..dccafd507bb7 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
  # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
  # Basic sanity check of perf JSON output as specified in the man page.
 
tools/testing/selftests/devices/probe/test_discoverable_devices.py +1 -1
index d7a2bb91c807..72a94bbfbc7b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
  # SPDX-License-Identifier: GPL-2.0
  #
  # Copyright (c) 2023 Collabora Ltd
tools/testing/selftests/rseq/rseq-slice-hist.py +1 -1
index b7933eeaefb9..2c43b2e2bf0d 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
  #
  # trace-cmd record -e hrtimer_start -e hrtimer_cancel -e hrtimer_expire_entry -- $cmd