* [PATCH] tools: hv: lsvmbus: change shebang to use python3
@ 2024-07-01 8:35 Anthony Nandaa
2024-07-01 20:40 ` Wei Liu
2024-07-02 3:15 ` Michael Kelley
0 siblings, 2 replies; 5+ messages in thread
From: Anthony Nandaa @ 2024-07-01 8:35 UTC (permalink / raw)
To: linux-hyperv, decui, mhklinux; +Cc: kys, 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/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/
Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
---
tools/hv/lsvmbus | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
mode change 100644 => 100755 tools/hv/lsvmbus
diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
old mode 100644
new mode 100755
index 55e7374bade0..23dcd8e705be
--- a/tools/hv/lsvmbus
+++ b/tools/hv/lsvmbus
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
import os
--
2.33.8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tools: hv: lsvmbus: change shebang to use python3
2024-07-01 8:35 [PATCH] tools: hv: lsvmbus: change shebang to use python3 Anthony Nandaa
@ 2024-07-01 20:40 ` Wei Liu
2024-07-02 9:32 ` Anthony Nandaa
2024-07-02 3:15 ` Michael Kelley
1 sibling, 1 reply; 5+ messages in thread
From: Wei Liu @ 2024-07-01 20:40 UTC (permalink / raw)
To: Anthony Nandaa; +Cc: linux-hyperv, decui, mhklinux, kys, Wei Liu
On Mon, Jul 01, 2024 at 08:35:55AM +0000, Anthony Nandaa wrote:
> 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/
>
> Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
Have you checked if the scripts are compatible with python3?
Thanks,
Wei.
> ---
> tools/hv/lsvmbus | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> mode change 100644 => 100755 tools/hv/lsvmbus
>
> diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
> old mode 100644
> new mode 100755
> index 55e7374bade0..23dcd8e705be
> --- a/tools/hv/lsvmbus
> +++ b/tools/hv/lsvmbus
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3
> # SPDX-License-Identifier: GPL-2.0
>
> import os
> --
> 2.33.8
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] tools: hv: lsvmbus: change shebang to use python3
2024-07-01 8:35 [PATCH] tools: hv: lsvmbus: change shebang to use python3 Anthony Nandaa
2024-07-01 20:40 ` Wei Liu
@ 2024-07-02 3:15 ` Michael Kelley
2024-07-02 9:29 ` Anthony Nandaa
1 sibling, 1 reply; 5+ messages in thread
From: Michael Kelley @ 2024-07-02 3:15 UTC (permalink / raw)
To: Anthony Nandaa, linux-hyperv@vger.kernel.org, decui@microsoft.com
Cc: kys@microsoft.com
From: Anthony Nandaa <profnandaa@gmail.com> Sent: Monday, July 1, 2024 1:36 AM
>
> 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
> ```
>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tools: hv: lsvmbus: change shebang to use python3
2024-07-02 3:15 ` Michael Kelley
@ 2024-07-02 9:29 ` Anthony Nandaa
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Nandaa @ 2024-07-02 9:29 UTC (permalink / raw)
To: Michael Kelley
Cc: linux-hyperv@vger.kernel.org, decui@microsoft.com,
kys@microsoft.com
On Tue, 2 Jul 2024 at 06:15, Michael Kelley <mhklinux@outlook.com> wrote:
>
> From: Anthony Nandaa <profnandaa@gmail.com> Sent: Monday, July 1, 2024 1:36 AM
> >
> > 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
> > ```
> >
>
> 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
Thanks Michael for the guidance. This is well noted and I'm going to fix
in my revision.
Regards,
Nandaa
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tools: hv: lsvmbus: change shebang to use python3
2024-07-01 20:40 ` Wei Liu
@ 2024-07-02 9:32 ` Anthony Nandaa
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Nandaa @ 2024-07-02 9:32 UTC (permalink / raw)
To: Wei Liu; +Cc: linux-hyperv, decui, mhklinux, kys
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
On Mon, 1 Jul 2024 at 23:41, Wei Liu <wei.liu@kernel.org> wrote:
>
> On Mon, Jul 01, 2024 at 08:35:55AM +0000, Anthony Nandaa wrote:
> > 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/
> >
> > Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
>
> Have you checked if the scripts are compatible with python3?
>
> Thanks,
> Wei.
>
> > ---
> > tools/hv/lsvmbus | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > mode change 100644 => 100755 tools/hv/lsvmbus
> >
> > diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
> > old mode 100644
> > new mode 100755
> > index 55e7374bade0..23dcd8e705be
> > --- a/tools/hv/lsvmbus
> > +++ b/tools/hv/lsvmbus
> > @@ -1,4 +1,4 @@
> > -#!/usr/bin/env python
> > +#!/usr/bin/env python3
> > # SPDX-License-Identifier: GPL-2.0
> >
> > import os
> > --
> > 2.33.8
> >
> >
--
___
Nandaa Anthony // nandaa.dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-02 9:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 8:35 [PATCH] tools: hv: lsvmbus: change shebang to use python3 Anthony Nandaa
2024-07-01 20:40 ` Wei Liu
2024-07-02 9:32 ` Anthony Nandaa
2024-07-02 3:15 ` Michael Kelley
2024-07-02 9:29 ` Anthony Nandaa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).