tools: hv: lsvmbus: change shebang to use python3
Subsystems (2)
PATCH 1/1 tools: hv: lsvmbus: change shebang to use python3
This patch updates the shebang in the lsvmbus tool to use python3 instead of python. The change is necessary because Python 2 has reached its end of life as of January 1, 2020, and is no longer maintained[1]. Many modern systems do not have python pointing to Python 2, and instead use python3.
By explicitly using python3, we ensure compatibility with modern systems since Python 2 is no longer being shipped by default.
This change also updates the file permissions to make the script executable, so that the script runs out of the box. Also, similar scripts within tools/hv have mode 755:
``` -rwxr-xr-x 1 labuser labuser 930 Jun 28 16:15 hv_get_dhcp_info.sh -rwxr-xr-x 1 labuser labuser 622 Jun 28 16:15 hv_get_dns_info.sh -rwxr-xr-x 1 labuser labuser 1888 Jun 28 16:15 hv_set_ifconfig.sh ```
Before fix, this is what you get when you attempt to run lsvmbus:
``` /usr/bin/env: ‘python’: No such file or directory ```
[1] https://www.python.org/doc/sunset-python-2/
--- tools/hv/lsvmbus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tools/hv/lsvmbus
tools/hv/lsvmbus +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 import os
Signature · 1 line
2.33.8
Wei Liu
maintainerQuoted 21 lines · Anthony Nandaa
This patch updates the shebang in the lsvmbus tool to use python3 instead of python. The change is necessary because Python 2 has reached its end of life as of January 1, 2020, and is no longer maintained[1]. Many modern systems do not have python pointing to Python 2, and instead use python3.
By explicitly using python3, we ensure compatibility with modern systems since Python 2 is no longer being shipped by default.
This change also updates the file permissions to make the script executable, so that the script runs out of the box. Also, similar scripts within
tools/hvhave mode755:```
(quoted diff) +0
-3-rwxr-xr-x 1 labuser labuser 930 Jun 28 16:15 hv_get_dhcp_info.sh -rwxr-xr-x 1 labuser labuser 622 Jun 28 16:15 hv_get_dns_info.sh -rwxr-xr-x 1 labuser labuser 1888 Jun 28 16:15 hv_set_ifconfig.sh``` Before fix, this is what you get when you attempt to run `lsvmbus`: ```
Quoted 6 lines
/usr/bin/env: ‘python’: No such file or directory
```[1] https://www.python.org/doc/sunset-python-2/
Signed-off-by Anthony Nandaa <[email protected]>
Have you checked if the scripts are compatible with python3?
Thanks,
Wei.
Quoted 21 lines
--- tools/hv/lsvmbus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tools/hv/lsvmbustools/hv/lsvmbus +1
-1@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 import osSignature · 1 line
2.33.8
From: Anthony Nandaa <[email protected]> Sent: Monday, July 1, 2024 1:36 AM
Quoted 22 lines
This patch updates the shebang in the lsvmbus tool to use python3 instead of python. The change is necessary because Python 2 has reached its end of life as of January 1, 2020, and is no longer maintained[1]. Many modern systems do not have python pointing to Python 2, and instead use python3.
By explicitly using python3, we ensure compatibility with modern systems since Python 2 is no longer being shipped by default.
This change also updates the file permissions to make the script executable, so that the script runs out of the box. Also, similar scripts within
tools/hvhave mode755:```
(quoted diff) +0
-3-rwxr-xr-x 1 labuser labuser 930 Jun 28 16:15 hv_get_dhcp_info.sh -rwxr-xr-x 1 labuser labuser 622 Jun 28 16:15 hv_get_dns_info.sh -rwxr-xr-x 1 labuser labuser 1888 Jun 28 16:15 hv_set_ifconfig.sh``` Before fix, this is what you get when you attempt to run `lsvmbus`: ```
Quoted 3 lines
/usr/bin/env: 'python': No such file or directory
```
A note about commit message style. The guidelines in Documentation/process/submitting-patches.rst specifically say to use imperative mood and avoid "This patch" (and by extension, "This change"). For a patch that is fixing a problem, I usually describe the problem first, and then start a new paragraph with "Fix this problem by .....". So for your patch, I would suggest something like:
In many modern Linux distros, running "lsvmbus" returns the error:
/usr/bin/env: 'python': No such file or directory
because 'python' doesn't point anywhere. Now that python2 has reached end of life as of January 1, 2020 and is no longer maintained[1], these distros have python3 instead. Also, the script isn't executable by default because the permissions are set to mode 644.
Fix this by updating the shebang in the lsvmbus to use python3 instead of python. Also fix the permissions to be 755 so that it is executable by default, which matches other similar scripts in tools/hv.
Michael
Quoted 46 lines · Michael Kelley
From: Anthony Nandaa <[email protected]> Sent: Monday, July 1, 2024 1:36 AM
Quoted 22 lines
This patch updates the shebang in the lsvmbus tool to use python3 instead of python. The change is necessary because Python 2 has reached its end of life as of January 1, 2020, and is no longer maintained[1]. Many modern systems do not have python pointing to Python 2, and instead use python3.
By explicitly using python3, we ensure compatibility with modern systems since Python 2 is no longer being shipped by default.
This change also updates the file permissions to make the script executable, so that the script runs out of the box. Also, similar scripts within
tools/hvhave mode755:```
(quoted diff) +0
-3-rwxr-xr-x 1 labuser labuser 930 Jun 28 16:15 hv_get_dhcp_info.sh -rwxr-xr-x 1 labuser labuser 622 Jun 28 16:15 hv_get_dns_info.sh -rwxr-xr-x 1 labuser labuser 1888 Jun 28 16:15 hv_set_ifconfig.sh``` Before fix, this is what you get when you attempt to run `lsvmbus`: ```Quoted 3 lines
/usr/bin/env: 'python': No such file or directory
```A note about commit message style. The guidelines in
Documentation/process/submitting-patches.rstspecifically say to use imperative mood and avoid "This patch" (and by extension, "This change"). For a patch that is fixing a problem, I usually describe the problem first, and then start a new paragraph with "Fix this problem by .....". So for your patch, I would suggest something like:In many modern Linux distros, running "lsvmbus" returns the error:
/usr/bin/env: 'python': No such file or directorybecause 'python' doesn't point anywhere. Now that python2 has reached end of life as of January 1, 2020 and is no longer maintained[1], these distros have python3 instead. Also, the script isn't executable by default because the permissions are set to mode 644.
Quoted 5 lines
Fix this by updating the shebang in the lsvmbus to use python3 instead of python. Also fix the permissions to be 755 so that it is executable by default, which matches other similar scripts in
tools/hv.Michael
Thanks Michael for the guidance. This is well noted and I'm going to fix in my revision.
Regards,
Nandaa
Sure, the script is compatible with Python3. I have tested it with the two command options (-v, -vv) and runs okay.
Also, I have run it through the ast module [1] just to make sure that there are no any syntax issues.
Thanks for taking a look!
[1] https://docs.python.org/3/library/ast.html
Regards,
Nandaa
Quoted 56 lines · Wei Liu
Quoted 21 lines · Anthony Nandaa
This patch updates the shebang in the lsvmbus tool to use python3 instead of python. The change is necessary because Python 2 has reached its end of life as of January 1, 2020, and is no longer maintained[1]. Many modern systems do not have python pointing to Python 2, and instead use python3.
By explicitly using python3, we ensure compatibility with modern systems since Python 2 is no longer being shipped by default.
This change also updates the file permissions to make the script executable, so that the script runs out of the box. Also, similar scripts within
tools/hvhave mode755:```
(quoted diff) +0
-3-rwxr-xr-x 1 labuser labuser 930 Jun 28 16:15 hv_get_dhcp_info.sh -rwxr-xr-x 1 labuser labuser 622 Jun 28 16:15 hv_get_dns_info.sh -rwxr-xr-x 1 labuser labuser 1888 Jun 28 16:15 hv_set_ifconfig.sh``` Before fix, this is what you get when you attempt to run `lsvmbus`: ```Quoted 6 lines
/usr/bin/env: ‘python’: No such file or directory
```[1] https://www.python.org/doc/sunset-python-2/
Signed-off-by Anthony Nandaa <[email protected]>Have you checked if the scripts are compatible with python3?
Thanks,
Wei.Quoted 21 lines
--- tools/hv/lsvmbus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tools/hv/lsvmbustools/hv/lsvmbus +1
-2@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 import os --2.33.8
Signature · 2 lines
___ Nandaa Anthony // nandaa.dev