diff mbox series

[ovs-dev] python: Fixup python shebangs to python3

Message ID 1597769119-3350-1-git-send-email-gvrose8192@gmail.com
State Superseded
Headers show
Series [ovs-dev] python: Fixup python shebangs to python3 | expand

Commit Message

Gregory Rose Aug. 18, 2020, 4:45 p.m. UTC
Builds on RHEL 8.2 systems are failing due to this issue.

See [1] as to why this is necessary.

I used the following command to identify files that need this fix:
find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs

I also updated the copyright notices as needed.

1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 ipsec/ovs-monitor-ipsec.in                            |  4 ++--
 ofproto/ipfix-gen-entities                            |  4 ++--
 ovsdb/dot2pic                                         |  4 ++--
 ovsdb/ovsdb-doc                                       |  4 ++--
 ovsdb/ovsdb-dot.in                                    |  2 +-
 ovsdb/ovsdb-idlc.in                                   |  2 +-
 python/build/soutil.py                                |  4 ++--
 tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
 tests/sendpkt.py                                      |  4 ++--
 tests/test-l7.py                                      |  4 ++--
 tests/uuidfilt.py                                     | 18 +++++++++++++++++-
 utilities/bugtool/ovs-bugtool.in                      |  4 ++--
 utilities/ovs-check-dead-ifs.in                       |  2 +-
 utilities/ovs-dev.py                                  |  4 ++--
 utilities/ovs-dpctl-top.in                            |  4 ++--
 utilities/ovs-l3ping.in                               |  2 +-
 utilities/ovs-parse-backtrace.in                      |  4 ++--
 utilities/ovs-pcap.in                                 |  4 ++--
 utilities/ovs-pipegen.py                              |  4 ++--
 utilities/ovs-tcpdump.in                              |  2 +-
 utilities/ovs-tcpundump.in                            |  4 ++--
 utilities/ovs-test.in                                 |  2 +-
 utilities/ovs-vlan-test.in                            |  4 ++--
 vtep/ovs-vtep.in                                      |  4 ++--
 xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
 xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
 xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
 27 files changed, 74 insertions(+), 46 deletions(-)

Comments

Yi-Hung Wei Aug. 18, 2020, 6:02 p.m. UTC | #1
On Tue, Aug 18, 2020 at 9:45 AM Greg Rose <gvrose8192@gmail.com> wrote:
>
> Builds on RHEL 8.2 systems are failing due to this issue.
>
> See [1] as to why this is necessary.
>
> I used the following command to identify files that need this fix:
> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>
> I also updated the copyright notices as needed.
>
> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> ---

Thanks for the patch.  LGTM.

Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Gregory Rose Aug. 18, 2020, 6:08 p.m. UTC | #2
On 8/18/2020 11:02 AM, Yi-Hung Wei wrote:
> On Tue, Aug 18, 2020 at 9:45 AM Greg Rose <gvrose8192@gmail.com> wrote:
>>
>> Builds on RHEL 8.2 systems are failing due to this issue.
>>
>> See [1] as to why this is necessary.
>>
>> I used the following command to identify files that need this fix:
>> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>>
>> I also updated the copyright notices as needed.
>>
>> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>> ---
> 
> Thanks for the patch.  LGTM.
> 
> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
> 

Thanks for the expedited review!

- Greg
Ilya Maximets Aug. 18, 2020, 6:31 p.m. UTC | #3
On 8/18/20 6:45 PM, Greg Rose wrote:
> Builds on RHEL 8.2 systems are failing due to this issue.
> 
> See [1] as to why this is necessary.
> 
> I used the following command to identify files that need this fix:
> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
> 
> I also updated the copyright notices as needed.
> 
> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
> 
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> ---
>  ipsec/ovs-monitor-ipsec.in                            |  4 ++--
>  ofproto/ipfix-gen-entities                            |  4 ++--
>  ovsdb/dot2pic                                         |  4 ++--
>  ovsdb/ovsdb-doc                                       |  4 ++--
>  ovsdb/ovsdb-dot.in                                    |  2 +-
>  ovsdb/ovsdb-idlc.in                                   |  2 +-
>  python/build/soutil.py                                |  4 ++--
>  tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>  tests/sendpkt.py                                      |  4 ++--
>  tests/test-l7.py                                      |  4 ++--
>  tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>  utilities/bugtool/ovs-bugtool.in                      |  4 ++--
>  utilities/ovs-check-dead-ifs.in                       |  2 +-
>  utilities/ovs-dev.py                                  |  4 ++--
>  utilities/ovs-dpctl-top.in                            |  4 ++--
>  utilities/ovs-l3ping.in                               |  2 +-
>  utilities/ovs-parse-backtrace.in                      |  4 ++--
>  utilities/ovs-pcap.in                                 |  4 ++--
>  utilities/ovs-pipegen.py                              |  4 ++--
>  utilities/ovs-tcpdump.in                              |  2 +-
>  utilities/ovs-tcpundump.in                            |  4 ++--
>  utilities/ovs-test.in                                 |  2 +-
>  utilities/ovs-vlan-test.in                            |  4 ++--
>  vtep/ovs-vtep.in                                      |  4 ++--
>  xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>  xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>  xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>  27 files changed, 74 insertions(+), 46 deletions(-)
> 
> diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
> index 37e3703..32e8e90 100755
> --- a/ipsec/ovs-monitor-ipsec.in
> +++ b/ipsec/ovs-monitor-ipsec.in
> @@ -1,5 +1,5 @@
> -#! @PYTHON3@
> -# Copyright (c) 2017 Nicira, Inc.
> +#!/usr/bin/env python3
> +# Copyright (c) 2017, 2020 Nicira, Inc.
>  #
>  # Licensed under the Apache License, Version 2.0 (the "License");
>  # you may not use this file except in compliance with the License.
> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
> index 0be7199..d5abe9c 100755
> --- a/ofproto/ipfix-gen-entities
> +++ b/ofproto/ipfix-gen-entities
> @@ -1,6 +1,6 @@
> -#! /usr/bin/env python
> +#!/usr/bin/env python3
>  #
> -# Copyright (C) 2012 Nicira, Inc.
> +# Copyright (C) 2012, 2020 Nicira, Inc.
>  #
>  # Copying and distribution of this file, with or without modification,
>  # are permitted in any medium without royalty provided the copyright
> diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
> index de67261..2f858e1 100755
> --- a/ovsdb/dot2pic
> +++ b/ovsdb/dot2pic
> @@ -1,6 +1,6 @@
> -#! /usr/bin/env python
> +#!/usr/bin/env python3
>  
> -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
> +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
>  #
>  # Licensed under the Apache License, Version 2.0 (the "License");
>  # you may not use this file except in compliance with the License.
> diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
> index 406c293..10d0c0c 100755
> --- a/ovsdb/ovsdb-doc
> +++ b/ovsdb/ovsdb-doc
> @@ -1,6 +1,6 @@
> -#! /usr/bin/python
> +#!/usr/bin/python3
>  
> -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
> +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
>  #
>  # Licensed under the Apache License, Version 2.0 (the "License");
>  # you may not use this file except in compliance with the License.
> diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
> index 41b986c..571601e 100755
> --- a/ovsdb/ovsdb-dot.in
> +++ b/ovsdb/ovsdb-dot.in
> @@ -1,4 +1,4 @@
> -#! @PYTHON3@
> +#!/usr/bin/env python3

Hmm.  This doesn't look right.

All the *.in files are used to generate actual scripts out of them
and '@PYTHON3@' is a placeholder for an actual python3 binary location
determind at the ./configure stage.  So, I don't think that we should
replace them.

Best regards, Ilya Maximets.
Gregory Rose Aug. 18, 2020, 7:17 p.m. UTC | #4
On 8/18/2020 11:31 AM, Ilya Maximets wrote:
> On 8/18/20 6:45 PM, Greg Rose wrote:
>> Builds on RHEL 8.2 systems are failing due to this issue.
>>
>> See [1] as to why this is necessary.
>>
>> I used the following command to identify files that need this fix:
>> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>>
>> I also updated the copyright notices as needed.
>>
>> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>> ---
>>   ipsec/ovs-monitor-ipsec.in                            |  4 ++--
>>   ofproto/ipfix-gen-entities                            |  4 ++--
>>   ovsdb/dot2pic                                         |  4 ++--
>>   ovsdb/ovsdb-doc                                       |  4 ++--
>>   ovsdb/ovsdb-dot.in                                    |  2 +-
>>   ovsdb/ovsdb-idlc.in                                   |  2 +-
>>   python/build/soutil.py                                |  4 ++--
>>   tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>>   tests/sendpkt.py                                      |  4 ++--
>>   tests/test-l7.py                                      |  4 ++--
>>   tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>>   utilities/bugtool/ovs-bugtool.in                      |  4 ++--
>>   utilities/ovs-check-dead-ifs.in                       |  2 +-
>>   utilities/ovs-dev.py                                  |  4 ++--
>>   utilities/ovs-dpctl-top.in                            |  4 ++--
>>   utilities/ovs-l3ping.in                               |  2 +-
>>   utilities/ovs-parse-backtrace.in                      |  4 ++--
>>   utilities/ovs-pcap.in                                 |  4 ++--
>>   utilities/ovs-pipegen.py                              |  4 ++--
>>   utilities/ovs-tcpdump.in                              |  2 +-
>>   utilities/ovs-tcpundump.in                            |  4 ++--
>>   utilities/ovs-test.in                                 |  2 +-
>>   utilities/ovs-vlan-test.in                            |  4 ++--
>>   vtep/ovs-vtep.in                                      |  4 ++--
>>   xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>>   xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>>   xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>>   27 files changed, 74 insertions(+), 46 deletions(-)
>>
>> diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
>> index 37e3703..32e8e90 100755
>> --- a/ipsec/ovs-monitor-ipsec.in
>> +++ b/ipsec/ovs-monitor-ipsec.in
>> @@ -1,5 +1,5 @@
>> -#! @PYTHON3@
>> -# Copyright (c) 2017 Nicira, Inc.
>> +#!/usr/bin/env python3
>> +# Copyright (c) 2017, 2020 Nicira, Inc.
>>   #
>>   # Licensed under the Apache License, Version 2.0 (the "License");
>>   # you may not use this file except in compliance with the License.
>> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
>> index 0be7199..d5abe9c 100755
>> --- a/ofproto/ipfix-gen-entities
>> +++ b/ofproto/ipfix-gen-entities
>> @@ -1,6 +1,6 @@
>> -#! /usr/bin/env python
>> +#!/usr/bin/env python3
>>   #
>> -# Copyright (C) 2012 Nicira, Inc.
>> +# Copyright (C) 2012, 2020 Nicira, Inc.
>>   #
>>   # Copying and distribution of this file, with or without modification,
>>   # are permitted in any medium without royalty provided the copyright
>> diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
>> index de67261..2f858e1 100755
>> --- a/ovsdb/dot2pic
>> +++ b/ovsdb/dot2pic
>> @@ -1,6 +1,6 @@
>> -#! /usr/bin/env python
>> +#!/usr/bin/env python3
>>   
>> -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
>> +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
>>   #
>>   # Licensed under the Apache License, Version 2.0 (the "License");
>>   # you may not use this file except in compliance with the License.
>> diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
>> index 406c293..10d0c0c 100755
>> --- a/ovsdb/ovsdb-doc
>> +++ b/ovsdb/ovsdb-doc
>> @@ -1,6 +1,6 @@
>> -#! /usr/bin/python
>> +#!/usr/bin/python3
>>   
>> -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
>> +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
>>   #
>>   # Licensed under the Apache License, Version 2.0 (the "License");
>>   # you may not use this file except in compliance with the License.
>> diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
>> index 41b986c..571601e 100755
>> --- a/ovsdb/ovsdb-dot.in
>> +++ b/ovsdb/ovsdb-dot.in
>> @@ -1,4 +1,4 @@
>> -#! @PYTHON3@
>> +#!/usr/bin/env python3
> 
> Hmm.  This doesn't look right.
> 
> All the *.in files are used to generate actual scripts out of them
> and '@PYTHON3@' is a placeholder for an actual python3 binary location
> determind at the ./configure stage.  So, I don't think that we should
> replace them.
> 
> Best regards, Ilya Maximets.
> 

Hi Ilya,

Thanks for the review.

The shebang check occurs before the expansion of @PYTHON3@ and causes
build failures.  We have no control over when the shebang check runs
because it is part of the RPM build environment supplied by Red Hat.
Moreover, the shebang check also substitutes #!/usr/bin/env python3
with someting like '/usr/libexec/platform-python'.

If we are only supporting python 3 then I think it's OK to explictly
say so.  And if we don't do something to fix it then it won't be long
before builds are failing on Fedora and RHEL systems.

Do you have any alternative suggestions?  Also, what do you think the 
problems will be if we use this patch?  It's quite possible I'm missing
something.

Thanks,

- Greg
Ilya Maximets Aug. 18, 2020, 8:10 p.m. UTC | #5
On 8/18/20 9:17 PM, Gregory Rose wrote:
> 
> On 8/18/2020 11:31 AM, Ilya Maximets wrote:
>> On 8/18/20 6:45 PM, Greg Rose wrote:
>>> Builds on RHEL 8.2 systems are failing due to this issue.
>>>
>>> See [1] as to why this is necessary.
>>>
>>> I used the following command to identify files that need this fix:
>>> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>>>
>>> I also updated the copyright notices as needed.
>>>
>>> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>>>
>>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>>> ---
>>>   ipsec/ovs-monitor-ipsec.in                            |  4 ++--
>>>   ofproto/ipfix-gen-entities                            |  4 ++--
>>>   ovsdb/dot2pic                                         |  4 ++--
>>>   ovsdb/ovsdb-doc                                       |  4 ++--
>>>   ovsdb/ovsdb-dot.in                                    |  2 +-
>>>   ovsdb/ovsdb-idlc.in                                   |  2 +-
>>>   python/build/soutil.py                                |  4 ++--
>>>   tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>>>   tests/sendpkt.py                                      |  4 ++--
>>>   tests/test-l7.py                                      |  4 ++--
>>>   tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>>>   utilities/bugtool/ovs-bugtool.in                      |  4 ++--
>>>   utilities/ovs-check-dead-ifs.in                       |  2 +-
>>>   utilities/ovs-dev.py                                  |  4 ++--
>>>   utilities/ovs-dpctl-top.in                            |  4 ++--
>>>   utilities/ovs-l3ping.in                               |  2 +-
>>>   utilities/ovs-parse-backtrace.in                      |  4 ++--
>>>   utilities/ovs-pcap.in                                 |  4 ++--
>>>   utilities/ovs-pipegen.py                              |  4 ++--
>>>   utilities/ovs-tcpdump.in                              |  2 +-
>>>   utilities/ovs-tcpundump.in                            |  4 ++--
>>>   utilities/ovs-test.in                                 |  2 +-
>>>   utilities/ovs-vlan-test.in                            |  4 ++--
>>>   vtep/ovs-vtep.in                                      |  4 ++--
>>>   xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>>>   xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>>>   xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>>>   27 files changed, 74 insertions(+), 46 deletions(-)
>>>
>>> diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
>>> index 37e3703..32e8e90 100755
>>> --- a/ipsec/ovs-monitor-ipsec.in
>>> +++ b/ipsec/ovs-monitor-ipsec.in
>>> @@ -1,5 +1,5 @@
>>> -#! @PYTHON3@
>>> -# Copyright (c) 2017 Nicira, Inc.
>>> +#!/usr/bin/env python3
>>> +# Copyright (c) 2017, 2020 Nicira, Inc.
>>>   #
>>>   # Licensed under the Apache License, Version 2.0 (the "License");
>>>   # you may not use this file except in compliance with the License.
>>> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
>>> index 0be7199..d5abe9c 100755
>>> --- a/ofproto/ipfix-gen-entities
>>> +++ b/ofproto/ipfix-gen-entities
>>> @@ -1,6 +1,6 @@
>>> -#! /usr/bin/env python
>>> +#!/usr/bin/env python3
>>>   #
>>> -# Copyright (C) 2012 Nicira, Inc.
>>> +# Copyright (C) 2012, 2020 Nicira, Inc.
>>>   #
>>>   # Copying and distribution of this file, with or without modification,
>>>   # are permitted in any medium without royalty provided the copyright
>>> diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
>>> index de67261..2f858e1 100755
>>> --- a/ovsdb/dot2pic
>>> +++ b/ovsdb/dot2pic
>>> @@ -1,6 +1,6 @@
>>> -#! /usr/bin/env python
>>> +#!/usr/bin/env python3
>>>   -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
>>> +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
>>>   #
>>>   # Licensed under the Apache License, Version 2.0 (the "License");
>>>   # you may not use this file except in compliance with the License.
>>> diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
>>> index 406c293..10d0c0c 100755
>>> --- a/ovsdb/ovsdb-doc
>>> +++ b/ovsdb/ovsdb-doc
>>> @@ -1,6 +1,6 @@
>>> -#! /usr/bin/python
>>> +#!/usr/bin/python3
>>>   -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
>>> +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
>>>   #
>>>   # Licensed under the Apache License, Version 2.0 (the "License");
>>>   # you may not use this file except in compliance with the License.
>>> diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
>>> index 41b986c..571601e 100755
>>> --- a/ovsdb/ovsdb-dot.in
>>> +++ b/ovsdb/ovsdb-dot.in
>>> @@ -1,4 +1,4 @@
>>> -#! @PYTHON3@
>>> +#!/usr/bin/env python3
>>
>> Hmm.  This doesn't look right.
>>
>> All the *.in files are used to generate actual scripts out of them
>> and '@PYTHON3@' is a placeholder for an actual python3 binary location
>> determind at the ./configure stage.  So, I don't think that we should
>> replace them.
>>
>> Best regards, Ilya Maximets.
>>
> 
> Hi Ilya,
> 
> Thanks for the review.
> 
> The shebang check occurs before the expansion of @PYTHON3@ and causes
> build failures.

This is strange.  I just tried to build rpms on rhel 8.2 and on fedora 31.
On both systems shebang check was triggered after the actual build and
only on resulted executable files (without .in).  I think, something
goes terribly wrong if shebang check invoked before the build and on
files that should not be part of a binary distribution.

Could you provide more information on how to reproduce?

> We have no control over when the shebang check runs
> because it is part of the RPM build environment supplied by Red Hat.
> Moreover, the shebang check also substitutes #!/usr/bin/env python3
> with someting like '/usr/libexec/platform-python'.

I see messages like this:
mangling shebang in /usr/bin/ovs-pcap from /usr/bin/python3 to #!/usr/libexec/platform-python

But these are not errors nor even warnings, so should not affect the build.
In fact /usr/bin/python3 is a symlink to /usr/libexec/platform-python.

> 
> If we are only supporting python 3 then I think it's OK to explictly
> say so.  And if we don't do something to fix it then it won't be long
> before builds are failing on Fedora and RHEL systems.

User might specify different versions of python3 if one of them is more
preferred, i.e. you could explicitly set PYTHON3=/usr/bin/python3.6
for ./configure script while having python3.8 by default in a system.

> 
> Do you have any alternative suggestions?  Also, what do you think the problems will be if we use this patch?  It's quite possible I'm missing
> something.
> 
> Thanks,
> 
> - Greg
Gregory Rose Aug. 18, 2020, 8:29 p.m. UTC | #6
On 8/18/2020 1:10 PM, Ilya Maximets wrote:
> On 8/18/20 9:17 PM, Gregory Rose wrote:
>>
>> On 8/18/2020 11:31 AM, Ilya Maximets wrote:
>>> On 8/18/20 6:45 PM, Greg Rose wrote:
>>>> Builds on RHEL 8.2 systems are failing due to this issue.
>>>>
>>>> See [1] as to why this is necessary.
>>>>
>>>> I used the following command to identify files that need this fix:
>>>> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>>>>
>>>> I also updated the copyright notices as needed.
>>>>
>>>> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>>>>
>>>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>>>> ---
>>>>    ipsec/ovs-monitor-ipsec.in                            |  4 ++--
>>>>    ofproto/ipfix-gen-entities                            |  4 ++--
>>>>    ovsdb/dot2pic                                         |  4 ++--
>>>>    ovsdb/ovsdb-doc                                       |  4 ++--
>>>>    ovsdb/ovsdb-dot.in                                    |  2 +-
>>>>    ovsdb/ovsdb-idlc.in                                   |  2 +-
>>>>    python/build/soutil.py                                |  4 ++--
>>>>    tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>>>>    tests/sendpkt.py                                      |  4 ++--
>>>>    tests/test-l7.py                                      |  4 ++--
>>>>    tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>>>>    utilities/bugtool/ovs-bugtool.in                      |  4 ++--
>>>>    utilities/ovs-check-dead-ifs.in                       |  2 +-
>>>>    utilities/ovs-dev.py                                  |  4 ++--
>>>>    utilities/ovs-dpctl-top.in                            |  4 ++--
>>>>    utilities/ovs-l3ping.in                               |  2 +-
>>>>    utilities/ovs-parse-backtrace.in                      |  4 ++--
>>>>    utilities/ovs-pcap.in                                 |  4 ++--
>>>>    utilities/ovs-pipegen.py                              |  4 ++--
>>>>    utilities/ovs-tcpdump.in                              |  2 +-
>>>>    utilities/ovs-tcpundump.in                            |  4 ++--
>>>>    utilities/ovs-test.in                                 |  2 +-
>>>>    utilities/ovs-vlan-test.in                            |  4 ++--
>>>>    vtep/ovs-vtep.in                                      |  4 ++--
>>>>    xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>>>>    xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>>>>    xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>>>>    27 files changed, 74 insertions(+), 46 deletions(-)
>>>>
>>>> diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
>>>> index 37e3703..32e8e90 100755
>>>> --- a/ipsec/ovs-monitor-ipsec.in
>>>> +++ b/ipsec/ovs-monitor-ipsec.in
>>>> @@ -1,5 +1,5 @@
>>>> -#! @PYTHON3@
>>>> -# Copyright (c) 2017 Nicira, Inc.
>>>> +#!/usr/bin/env python3
>>>> +# Copyright (c) 2017, 2020 Nicira, Inc.
>>>>    #
>>>>    # Licensed under the Apache License, Version 2.0 (the "License");
>>>>    # you may not use this file except in compliance with the License.
>>>> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
>>>> index 0be7199..d5abe9c 100755
>>>> --- a/ofproto/ipfix-gen-entities
>>>> +++ b/ofproto/ipfix-gen-entities
>>>> @@ -1,6 +1,6 @@
>>>> -#! /usr/bin/env python
>>>> +#!/usr/bin/env python3
>>>>    #
>>>> -# Copyright (C) 2012 Nicira, Inc.
>>>> +# Copyright (C) 2012, 2020 Nicira, Inc.
>>>>    #
>>>>    # Copying and distribution of this file, with or without modification,
>>>>    # are permitted in any medium without royalty provided the copyright
>>>> diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
>>>> index de67261..2f858e1 100755
>>>> --- a/ovsdb/dot2pic
>>>> +++ b/ovsdb/dot2pic
>>>> @@ -1,6 +1,6 @@
>>>> -#! /usr/bin/env python
>>>> +#!/usr/bin/env python3
>>>>    -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
>>>> +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
>>>>    #
>>>>    # Licensed under the Apache License, Version 2.0 (the "License");
>>>>    # you may not use this file except in compliance with the License.
>>>> diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
>>>> index 406c293..10d0c0c 100755
>>>> --- a/ovsdb/ovsdb-doc
>>>> +++ b/ovsdb/ovsdb-doc
>>>> @@ -1,6 +1,6 @@
>>>> -#! /usr/bin/python
>>>> +#!/usr/bin/python3
>>>>    -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
>>>> +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
>>>>    #
>>>>    # Licensed under the Apache License, Version 2.0 (the "License");
>>>>    # you may not use this file except in compliance with the License.
>>>> diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
>>>> index 41b986c..571601e 100755
>>>> --- a/ovsdb/ovsdb-dot.in
>>>> +++ b/ovsdb/ovsdb-dot.in
>>>> @@ -1,4 +1,4 @@
>>>> -#! @PYTHON3@
>>>> +#!/usr/bin/env python3
>>>
>>> Hmm.  This doesn't look right.
>>>
>>> All the *.in files are used to generate actual scripts out of them
>>> and '@PYTHON3@' is a placeholder for an actual python3 binary location
>>> determind at the ./configure stage.  So, I don't think that we should
>>> replace them.
>>>
>>> Best regards, Ilya Maximets.
>>>
>>
>> Hi Ilya,
>>
>> Thanks for the review.
>>
>> The shebang check occurs before the expansion of @PYTHON3@ and causes
>> build failures.
> 
> This is strange.  I just tried to build rpms on rhel 8.2 and on fedora 31.
> On both systems shebang check was triggered after the actual build and
> only on resulted executable files (without .in).  I think, something
> goes terribly wrong if shebang check invoked before the build and on
> files that should not be part of a binary distribution.
> 
> Could you provide more information on how to reproduce?
> 
>> We have no control over when the shebang check runs
>> because it is part of the RPM build environment supplied by Red Hat.
>> Moreover, the shebang check also substitutes #!/usr/bin/env python3
>> with someting like '/usr/libexec/platform-python'.
> 
> I see messages like this:
> mangling shebang in /usr/bin/ovs-pcap from /usr/bin/python3 to #!/usr/libexec/platform-python
> 
> But these are not errors nor even warnings, so should not affect the build.
> In fact /usr/bin/python3 is a symlink to /usr/libexec/platform-python.

Yes - but @PYTHON3@ is an error.  That's what I have to find some way
to fix.

> 
>>
>> If we are only supporting python 3 then I think it's OK to explictly
>> say so.  And if we don't do something to fix it then it won't be long
>> before builds are failing on Fedora and RHEL systems.
> 
> User might specify different versions of python3 if one of them is more
> preferred, i.e. you could explicitly set PYTHON3=/usr/bin/python3.6
> for ./configure script while having python3.8 by default in a system.

True - users may do any number of things with multiple versions of
python on their system but that doesn't do anything to fix the build
failures they'll soon be seeing if they try to build on newer Fedora
or RHEL 8.2 systems.  I'm still at a loss as to what to do about that.

Sooner or later we'll have to fix it one way or another as pointed
out in the commit message.  Right now this is the only way I can
figure out but if someone has a better idea I'm all ears.

- Greg
Flavio Leitner Aug. 19, 2020, 2:21 a.m. UTC | #7
On Tue, Aug 18, 2020 at 01:29:33PM -0700, Gregory Rose wrote:
> On 8/18/2020 1:10 PM, Ilya Maximets wrote:
> > On 8/18/20 9:17 PM, Gregory Rose wrote:
> > > 
> > > On 8/18/2020 11:31 AM, Ilya Maximets wrote:
> > > > On 8/18/20 6:45 PM, Greg Rose wrote:
> > > > > Builds on RHEL 8.2 systems are failing due to this issue.
> > > > > 
> > > > > See [1] as to why this is necessary.
> > > > > 
> > > > > I used the following command to identify files that need this fix:
> > > > > find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
> > > > > 
> > > > > I also updated the copyright notices as needed.
> > > > > 
> > > > > 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
> > > > > 
> > > > > Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> > > > > ---
> > > > >    ipsec/ovs-monitor-ipsec.in                            |  4 ++--
> > > > >    ofproto/ipfix-gen-entities                            |  4 ++--
> > > > >    ovsdb/dot2pic                                         |  4 ++--
> > > > >    ovsdb/ovsdb-doc                                       |  4 ++--
> > > > >    ovsdb/ovsdb-dot.in                                    |  2 +-
> > > > >    ovsdb/ovsdb-idlc.in                                   |  2 +-
> > > > >    python/build/soutil.py                                |  4 ++--
> > > > >    tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
> > > > >    tests/sendpkt.py                                      |  4 ++--
> > > > >    tests/test-l7.py                                      |  4 ++--
> > > > >    tests/uuidfilt.py                                     | 18 +++++++++++++++++-
> > > > >    utilities/bugtool/ovs-bugtool.in                      |  4 ++--
> > > > >    utilities/ovs-check-dead-ifs.in                       |  2 +-
> > > > >    utilities/ovs-dev.py                                  |  4 ++--
> > > > >    utilities/ovs-dpctl-top.in                            |  4 ++--
> > > > >    utilities/ovs-l3ping.in                               |  2 +-
> > > > >    utilities/ovs-parse-backtrace.in                      |  4 ++--
> > > > >    utilities/ovs-pcap.in                                 |  4 ++--
> > > > >    utilities/ovs-pipegen.py                              |  4 ++--
> > > > >    utilities/ovs-tcpdump.in                              |  2 +-
> > > > >    utilities/ovs-tcpundump.in                            |  4 ++--
> > > > >    utilities/ovs-test.in                                 |  2 +-
> > > > >    utilities/ovs-vlan-test.in                            |  4 ++--
> > > > >    vtep/ovs-vtep.in                                      |  4 ++--
> > > > >    xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
> > > > >    xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
> > > > >    xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
> > > > >    27 files changed, 74 insertions(+), 46 deletions(-)
> > > > > 
> > > > > diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
> > > > > index 37e3703..32e8e90 100755
> > > > > --- a/ipsec/ovs-monitor-ipsec.in
> > > > > +++ b/ipsec/ovs-monitor-ipsec.in
> > > > > @@ -1,5 +1,5 @@
> > > > > -#! @PYTHON3@
> > > > > -# Copyright (c) 2017 Nicira, Inc.
> > > > > +#!/usr/bin/env python3
> > > > > +# Copyright (c) 2017, 2020 Nicira, Inc.
> > > > >    #
> > > > >    # Licensed under the Apache License, Version 2.0 (the "License");
> > > > >    # you may not use this file except in compliance with the License.
> > > > > diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
> > > > > index 0be7199..d5abe9c 100755
> > > > > --- a/ofproto/ipfix-gen-entities
> > > > > +++ b/ofproto/ipfix-gen-entities
> > > > > @@ -1,6 +1,6 @@
> > > > > -#! /usr/bin/env python
> > > > > +#!/usr/bin/env python3
> > > > >    #
> > > > > -# Copyright (C) 2012 Nicira, Inc.
> > > > > +# Copyright (C) 2012, 2020 Nicira, Inc.
> > > > >    #
> > > > >    # Copying and distribution of this file, with or without modification,
> > > > >    # are permitted in any medium without royalty provided the copyright
> > > > > diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
> > > > > index de67261..2f858e1 100755
> > > > > --- a/ovsdb/dot2pic
> > > > > +++ b/ovsdb/dot2pic
> > > > > @@ -1,6 +1,6 @@
> > > > > -#! /usr/bin/env python
> > > > > +#!/usr/bin/env python3
> > > > >    -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
> > > > > +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
> > > > >    #
> > > > >    # Licensed under the Apache License, Version 2.0 (the "License");
> > > > >    # you may not use this file except in compliance with the License.
> > > > > diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
> > > > > index 406c293..10d0c0c 100755
> > > > > --- a/ovsdb/ovsdb-doc
> > > > > +++ b/ovsdb/ovsdb-doc
> > > > > @@ -1,6 +1,6 @@
> > > > > -#! /usr/bin/python
> > > > > +#!/usr/bin/python3
> > > > >    -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
> > > > > +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
> > > > >    #
> > > > >    # Licensed under the Apache License, Version 2.0 (the "License");
> > > > >    # you may not use this file except in compliance with the License.
> > > > > diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
> > > > > index 41b986c..571601e 100755
> > > > > --- a/ovsdb/ovsdb-dot.in
> > > > > +++ b/ovsdb/ovsdb-dot.in
> > > > > @@ -1,4 +1,4 @@
> > > > > -#! @PYTHON3@
> > > > > +#!/usr/bin/env python3
> > > > 
> > > > Hmm.  This doesn't look right.
> > > > 
> > > > All the *.in files are used to generate actual scripts out of them
> > > > and '@PYTHON3@' is a placeholder for an actual python3 binary location
> > > > determind at the ./configure stage.  So, I don't think that we should
> > > > replace them.
> > > > 
> > > > Best regards, Ilya Maximets.
> > > > 
> > > 
> > > Hi Ilya,
> > > 
> > > Thanks for the review.
> > > 
> > > The shebang check occurs before the expansion of @PYTHON3@ and causes
> > > build failures.
> > 
> > This is strange.  I just tried to build rpms on rhel 8.2 and on fedora 31.
> > On both systems shebang check was triggered after the actual build and
> > only on resulted executable files (without .in).  I think, something
> > goes terribly wrong if shebang check invoked before the build and on
> > files that should not be part of a binary distribution.
> > 
> > Could you provide more information on how to reproduce?
> > 
> > > We have no control over when the shebang check runs
> > > because it is part of the RPM build environment supplied by Red Hat.
> > > Moreover, the shebang check also substitutes #!/usr/bin/env python3
> > > with someting like '/usr/libexec/platform-python'.
> > 
> > I see messages like this:
> > mangling shebang in /usr/bin/ovs-pcap from /usr/bin/python3 to #!/usr/libexec/platform-python
> > 
> > But these are not errors nor even warnings, so should not affect the build.
> > In fact /usr/bin/python3 is a symlink to /usr/libexec/platform-python.
> 
> Yes - but @PYTHON3@ is an error.  That's what I have to find some way
> to fix.

I agree with Ilya here that this is strange.

I just built ovs RPMs on RHEL-8.2 and it worked just fine,
same on Fedora 32.

Those below are the only message related to shebangs and as
you can see no python issues:
[...]
Bytecompiling .py files below /root/ovs/rpm/rpmbuild/BUILDROOT/openvswitch-2.14.90-1.el8.x86_64/usr/lib/python3.6 using /usr/libexec/platform-python
+ /usr/lib/rpm/brp-python-hardlink
+ PYTHON3=/usr/libexec/platform-python
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
*** WARNING: ./usr/lib64/libopenvswitch.la is executable but has empty or no shebang, removing executable bit
*** WARNING: ./usr/lib64/libsflow.la is executable but has empty or no shebang, removing executable bit
*** WARNING: ./usr/lib64/libofproto.la is executable but has empty or no shebang, removing executable bit
*** WARNING: ./usr/lib64/libovsdb.la is executable but has empty or no shebang, removing executable bit
*** WARNING: ./usr/lib64/libvtep.la is executable but has empty or no shebang, removing executable bit
*** WARNING: ./etc/bash_completion.d/ovs-appctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
*** WARNING: ./etc/bash_completion.d/ovs-vsctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.plv5lw
[...]


fbl
Gregory Rose Aug. 19, 2020, 3:44 a.m. UTC | #8
On 8/18/2020 7:21 PM, Flavio Leitner wrote:
> On Tue, Aug 18, 2020 at 01:29:33PM -0700, Gregory Rose wrote:
>> On 8/18/2020 1:10 PM, Ilya Maximets wrote:
>>> On 8/18/20 9:17 PM, Gregory Rose wrote:
>>>>
>>>> On 8/18/2020 11:31 AM, Ilya Maximets wrote:
>>>>> On 8/18/20 6:45 PM, Greg Rose wrote:
>>>>>> Builds on RHEL 8.2 systems are failing due to this issue.
>>>>>>
>>>>>> See [1] as to why this is necessary.
>>>>>>
>>>>>> I used the following command to identify files that need this fix:
>>>>>> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>>>>>>
>>>>>> I also updated the copyright notices as needed.
>>>>>>
>>>>>> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>>>>>>
>>>>>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>>>>>> ---
>>>>>>     ipsec/ovs-monitor-ipsec.in                            |  4 ++--
>>>>>>     ofproto/ipfix-gen-entities                            |  4 ++--
>>>>>>     ovsdb/dot2pic                                         |  4 ++--
>>>>>>     ovsdb/ovsdb-doc                                       |  4 ++--
>>>>>>     ovsdb/ovsdb-dot.in                                    |  2 +-
>>>>>>     ovsdb/ovsdb-idlc.in                                   |  2 +-
>>>>>>     python/build/soutil.py                                |  4 ++--
>>>>>>     tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>>>>>>     tests/sendpkt.py                                      |  4 ++--
>>>>>>     tests/test-l7.py                                      |  4 ++--
>>>>>>     tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>>>>>>     utilities/bugtool/ovs-bugtool.in                      |  4 ++--
>>>>>>     utilities/ovs-check-dead-ifs.in                       |  2 +-
>>>>>>     utilities/ovs-dev.py                                  |  4 ++--
>>>>>>     utilities/ovs-dpctl-top.in                            |  4 ++--
>>>>>>     utilities/ovs-l3ping.in                               |  2 +-
>>>>>>     utilities/ovs-parse-backtrace.in                      |  4 ++--
>>>>>>     utilities/ovs-pcap.in                                 |  4 ++--
>>>>>>     utilities/ovs-pipegen.py                              |  4 ++--
>>>>>>     utilities/ovs-tcpdump.in                              |  2 +-
>>>>>>     utilities/ovs-tcpundump.in                            |  4 ++--
>>>>>>     utilities/ovs-test.in                                 |  2 +-
>>>>>>     utilities/ovs-vlan-test.in                            |  4 ++--
>>>>>>     vtep/ovs-vtep.in                                      |  4 ++--
>>>>>>     xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>>>>>>     xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>>>>>>     xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>>>>>>     27 files changed, 74 insertions(+), 46 deletions(-)
>>>>>>
>>>>>> diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
>>>>>> index 37e3703..32e8e90 100755
>>>>>> --- a/ipsec/ovs-monitor-ipsec.in
>>>>>> +++ b/ipsec/ovs-monitor-ipsec.in
>>>>>> @@ -1,5 +1,5 @@
>>>>>> -#! @PYTHON3@
>>>>>> -# Copyright (c) 2017 Nicira, Inc.
>>>>>> +#!/usr/bin/env python3
>>>>>> +# Copyright (c) 2017, 2020 Nicira, Inc.
>>>>>>     #
>>>>>>     # Licensed under the Apache License, Version 2.0 (the "License");
>>>>>>     # you may not use this file except in compliance with the License.
>>>>>> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
>>>>>> index 0be7199..d5abe9c 100755
>>>>>> --- a/ofproto/ipfix-gen-entities
>>>>>> +++ b/ofproto/ipfix-gen-entities
>>>>>> @@ -1,6 +1,6 @@
>>>>>> -#! /usr/bin/env python
>>>>>> +#!/usr/bin/env python3
>>>>>>     #
>>>>>> -# Copyright (C) 2012 Nicira, Inc.
>>>>>> +# Copyright (C) 2012, 2020 Nicira, Inc.
>>>>>>     #
>>>>>>     # Copying and distribution of this file, with or without modification,
>>>>>>     # are permitted in any medium without royalty provided the copyright
>>>>>> diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
>>>>>> index de67261..2f858e1 100755
>>>>>> --- a/ovsdb/dot2pic
>>>>>> +++ b/ovsdb/dot2pic
>>>>>> @@ -1,6 +1,6 @@
>>>>>> -#! /usr/bin/env python
>>>>>> +#!/usr/bin/env python3
>>>>>>     -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
>>>>>> +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
>>>>>>     #
>>>>>>     # Licensed under the Apache License, Version 2.0 (the "License");
>>>>>>     # you may not use this file except in compliance with the License.
>>>>>> diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
>>>>>> index 406c293..10d0c0c 100755
>>>>>> --- a/ovsdb/ovsdb-doc
>>>>>> +++ b/ovsdb/ovsdb-doc
>>>>>> @@ -1,6 +1,6 @@
>>>>>> -#! /usr/bin/python
>>>>>> +#!/usr/bin/python3
>>>>>>     -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
>>>>>> +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
>>>>>>     #
>>>>>>     # Licensed under the Apache License, Version 2.0 (the "License");
>>>>>>     # you may not use this file except in compliance with the License.
>>>>>> diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
>>>>>> index 41b986c..571601e 100755
>>>>>> --- a/ovsdb/ovsdb-dot.in
>>>>>> +++ b/ovsdb/ovsdb-dot.in
>>>>>> @@ -1,4 +1,4 @@
>>>>>> -#! @PYTHON3@
>>>>>> +#!/usr/bin/env python3
>>>>>
>>>>> Hmm.  This doesn't look right.
>>>>>
>>>>> All the *.in files are used to generate actual scripts out of them
>>>>> and '@PYTHON3@' is a placeholder for an actual python3 binary location
>>>>> determind at the ./configure stage.  So, I don't think that we should
>>>>> replace them.
>>>>>
>>>>> Best regards, Ilya Maximets.
>>>>>
>>>>
>>>> Hi Ilya,
>>>>
>>>> Thanks for the review.
>>>>
>>>> The shebang check occurs before the expansion of @PYTHON3@ and causes
>>>> build failures.
>>>
>>> This is strange.  I just tried to build rpms on rhel 8.2 and on fedora 31.
>>> On both systems shebang check was triggered after the actual build and
>>> only on resulted executable files (without .in).  I think, something
>>> goes terribly wrong if shebang check invoked before the build and on
>>> files that should not be part of a binary distribution.
>>>
>>> Could you provide more information on how to reproduce?
>>>
>>>> We have no control over when the shebang check runs
>>>> because it is part of the RPM build environment supplied by Red Hat.
>>>> Moreover, the shebang check also substitutes #!/usr/bin/env python3
>>>> with someting like '/usr/libexec/platform-python'.
>>>
>>> I see messages like this:
>>> mangling shebang in /usr/bin/ovs-pcap from /usr/bin/python3 to #!/usr/libexec/platform-python
>>>
>>> But these are not errors nor even warnings, so should not affect the build.
>>> In fact /usr/bin/python3 is a symlink to /usr/libexec/platform-python.
>>
>> Yes - but @PYTHON3@ is an error.  That's what I have to find some way
>> to fix.
> 
> I agree with Ilya here that this is strange.
> 
> I just built ovs RPMs on RHEL-8.2 and it worked just fine,
> same on Fedora 32.
> 
> Those below are the only message related to shebangs and as
> you can see no python issues:
> [...]
> Bytecompiling .py files below /root/ovs/rpm/rpmbuild/BUILDROOT/openvswitch-2.14.90-1.el8.x86_64/usr/lib/python3.6 using /usr/libexec/platform-python
> + /usr/lib/rpm/brp-python-hardlink
> + PYTHON3=/usr/libexec/platform-python
> + /usr/lib/rpm/redhat/brp-mangle-shebangs
> *** WARNING: ./usr/lib64/libopenvswitch.la is executable but has empty or no shebang, removing executable bit
> *** WARNING: ./usr/lib64/libsflow.la is executable but has empty or no shebang, removing executable bit
> *** WARNING: ./usr/lib64/libofproto.la is executable but has empty or no shebang, removing executable bit
> *** WARNING: ./usr/lib64/libovsdb.la is executable but has empty or no shebang, removing executable bit
> *** WARNING: ./usr/lib64/libvtep.la is executable but has empty or no shebang, removing executable bit
> *** WARNING: ./etc/bash_completion.d/ovs-appctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
> *** WARNING: ./etc/bash_completion.d/ovs-vsctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
> Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.plv5lw
> [...]
> 
> 
> fbl
> 

Hi Flavio,

This is truly curious because here's what we're getting:

2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/tests/sendpkt.py: 
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/tests/test-l7.py: 
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** WARNING: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/tests/checkpatch.at is 
executable but has empty or no shebang, removing executable bit
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/tests/ovsdb-monitor-sort.py: 
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/tests/uuidfilt.py: 
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
mangling shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/tests/flowgen.py from 
/usr/bin/env python3 to #!/usr/libexec/platform-python
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/ofproto/ipfix-gen-entities: 
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-dot.in has 
shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-idlc.in has 
shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-doc: 
#!/usr/bin/python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: ambiguous python shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/dot2pic: 
#!/usr/bin/env python. Change it to python3 (or python2) explicitly.
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/ipsec/ovs-monitor-ipsec.in 
has shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-vlan-test.in 
has shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-tcpdump.in 
has shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-tcpundump.in 
has shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/bugtool/ovs-bugtool.in 
has shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-pcap.in has 
shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-check-dead-ifs.in 
has shebang which doesn't start with '/' (@PYTHON3@)
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
mangling shebang in 
/usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/checkpatch.py from 
/usr/bin/env python3 to #!/usr/libexec/platform-python
2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) 
*** ERROR: 
./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-parse-backtrace.in 
has shebang which doesn't start with '/' (@PYTHON3@)


Any idea what we could do to fix this?  Maybe it's a chroot thing?
Although I have no idea why it would have anything to do with chroot,
but frankly I'm grasping at straws here.

And I want to say again, on a RHEL 8.2 system that I have, executing
this, 'find . -type f -executable | 
/usr/lib/rpm/redhat/brp-mangle-shebangs', produces many errors.  So 
maybe my RHEL 8.2 system
is different in some way?

Thanks,

- Greg
Flavio Leitner Aug. 19, 2020, 4:41 a.m. UTC | #9
On Tue, Aug 18, 2020 at 08:44:45PM -0700, Gregory Rose wrote:
> 
> On 8/18/2020 7:21 PM, Flavio Leitner wrote:
> > On Tue, Aug 18, 2020 at 01:29:33PM -0700, Gregory Rose wrote:
> > > On 8/18/2020 1:10 PM, Ilya Maximets wrote:
> > > > On 8/18/20 9:17 PM, Gregory Rose wrote:
> > > > > 
> > > > > On 8/18/2020 11:31 AM, Ilya Maximets wrote:
> > > > > > On 8/18/20 6:45 PM, Greg Rose wrote:
> > > > > > > Builds on RHEL 8.2 systems are failing due to this issue.
> > > > > > > 
> > > > > > > See [1] as to why this is necessary.
> > > > > > > 
> > > > > > > I used the following command to identify files that need this fix:
> > > > > > > find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
> > > > > > > 
> > > > > > > I also updated the copyright notices as needed.
> > > > > > > 
> > > > > > > 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
> > > > > > > 
> > > > > > > Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> > > > > > > ---
> > > > > > >     ipsec/ovs-monitor-ipsec.in                            |  4 ++--
> > > > > > >     ofproto/ipfix-gen-entities                            |  4 ++--
> > > > > > >     ovsdb/dot2pic                                         |  4 ++--
> > > > > > >     ovsdb/ovsdb-doc                                       |  4 ++--
> > > > > > >     ovsdb/ovsdb-dot.in                                    |  2 +-
> > > > > > >     ovsdb/ovsdb-idlc.in                                   |  2 +-
> > > > > > >     python/build/soutil.py                                |  4 ++--
> > > > > > >     tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
> > > > > > >     tests/sendpkt.py                                      |  4 ++--
> > > > > > >     tests/test-l7.py                                      |  4 ++--
> > > > > > >     tests/uuidfilt.py                                     | 18 +++++++++++++++++-
> > > > > > >     utilities/bugtool/ovs-bugtool.in                      |  4 ++--
> > > > > > >     utilities/ovs-check-dead-ifs.in                       |  2 +-
> > > > > > >     utilities/ovs-dev.py                                  |  4 ++--
> > > > > > >     utilities/ovs-dpctl-top.in                            |  4 ++--
> > > > > > >     utilities/ovs-l3ping.in                               |  2 +-
> > > > > > >     utilities/ovs-parse-backtrace.in                      |  4 ++--
> > > > > > >     utilities/ovs-pcap.in                                 |  4 ++--
> > > > > > >     utilities/ovs-pipegen.py                              |  4 ++--
> > > > > > >     utilities/ovs-tcpdump.in                              |  2 +-
> > > > > > >     utilities/ovs-tcpundump.in                            |  4 ++--
> > > > > > >     utilities/ovs-test.in                                 |  2 +-
> > > > > > >     utilities/ovs-vlan-test.in                            |  4 ++--
> > > > > > >     vtep/ovs-vtep.in                                      |  4 ++--
> > > > > > >     xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
> > > > > > >     xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
> > > > > > >     xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
> > > > > > >     27 files changed, 74 insertions(+), 46 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
> > > > > > > index 37e3703..32e8e90 100755
> > > > > > > --- a/ipsec/ovs-monitor-ipsec.in
> > > > > > > +++ b/ipsec/ovs-monitor-ipsec.in
> > > > > > > @@ -1,5 +1,5 @@
> > > > > > > -#! @PYTHON3@
> > > > > > > -# Copyright (c) 2017 Nicira, Inc.
> > > > > > > +#!/usr/bin/env python3
> > > > > > > +# Copyright (c) 2017, 2020 Nicira, Inc.
> > > > > > >     #
> > > > > > >     # Licensed under the Apache License, Version 2.0 (the "License");
> > > > > > >     # you may not use this file except in compliance with the License.
> > > > > > > diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
> > > > > > > index 0be7199..d5abe9c 100755
> > > > > > > --- a/ofproto/ipfix-gen-entities
> > > > > > > +++ b/ofproto/ipfix-gen-entities
> > > > > > > @@ -1,6 +1,6 @@
> > > > > > > -#! /usr/bin/env python
> > > > > > > +#!/usr/bin/env python3
> > > > > > >     #
> > > > > > > -# Copyright (C) 2012 Nicira, Inc.
> > > > > > > +# Copyright (C) 2012, 2020 Nicira, Inc.
> > > > > > >     #
> > > > > > >     # Copying and distribution of this file, with or without modification,
> > > > > > >     # are permitted in any medium without royalty provided the copyright
> > > > > > > diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
> > > > > > > index de67261..2f858e1 100755
> > > > > > > --- a/ovsdb/dot2pic
> > > > > > > +++ b/ovsdb/dot2pic
> > > > > > > @@ -1,6 +1,6 @@
> > > > > > > -#! /usr/bin/env python
> > > > > > > +#!/usr/bin/env python3
> > > > > > >     -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
> > > > > > > +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
> > > > > > >     #
> > > > > > >     # Licensed under the Apache License, Version 2.0 (the "License");
> > > > > > >     # you may not use this file except in compliance with the License.
> > > > > > > diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
> > > > > > > index 406c293..10d0c0c 100755
> > > > > > > --- a/ovsdb/ovsdb-doc
> > > > > > > +++ b/ovsdb/ovsdb-doc
> > > > > > > @@ -1,6 +1,6 @@
> > > > > > > -#! /usr/bin/python
> > > > > > > +#!/usr/bin/python3
> > > > > > >     -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
> > > > > > > +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
> > > > > > >     #
> > > > > > >     # Licensed under the Apache License, Version 2.0 (the "License");
> > > > > > >     # you may not use this file except in compliance with the License.
> > > > > > > diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
> > > > > > > index 41b986c..571601e 100755
> > > > > > > --- a/ovsdb/ovsdb-dot.in
> > > > > > > +++ b/ovsdb/ovsdb-dot.in
> > > > > > > @@ -1,4 +1,4 @@
> > > > > > > -#! @PYTHON3@
> > > > > > > +#!/usr/bin/env python3
> > > > > > 
> > > > > > Hmm.  This doesn't look right.
> > > > > > 
> > > > > > All the *.in files are used to generate actual scripts out of them
> > > > > > and '@PYTHON3@' is a placeholder for an actual python3 binary location
> > > > > > determind at the ./configure stage.  So, I don't think that we should
> > > > > > replace them.
> > > > > > 
> > > > > > Best regards, Ilya Maximets.
> > > > > > 
> > > > > 
> > > > > Hi Ilya,
> > > > > 
> > > > > Thanks for the review.
> > > > > 
> > > > > The shebang check occurs before the expansion of @PYTHON3@ and causes
> > > > > build failures.
> > > > 
> > > > This is strange.  I just tried to build rpms on rhel 8.2 and on fedora 31.
> > > > On both systems shebang check was triggered after the actual build and
> > > > only on resulted executable files (without .in).  I think, something
> > > > goes terribly wrong if shebang check invoked before the build and on
> > > > files that should not be part of a binary distribution.
> > > > 
> > > > Could you provide more information on how to reproduce?
> > > > 
> > > > > We have no control over when the shebang check runs
> > > > > because it is part of the RPM build environment supplied by Red Hat.
> > > > > Moreover, the shebang check also substitutes #!/usr/bin/env python3
> > > > > with someting like '/usr/libexec/platform-python'.
> > > > 
> > > > I see messages like this:
> > > > mangling shebang in /usr/bin/ovs-pcap from /usr/bin/python3 to #!/usr/libexec/platform-python
> > > > 
> > > > But these are not errors nor even warnings, so should not affect the build.
> > > > In fact /usr/bin/python3 is a symlink to /usr/libexec/platform-python.
> > > 
> > > Yes - but @PYTHON3@ is an error.  That's what I have to find some way
> > > to fix.
> > 
> > I agree with Ilya here that this is strange.
> > 
> > I just built ovs RPMs on RHEL-8.2 and it worked just fine,
> > same on Fedora 32.
> > 
> > Those below are the only message related to shebangs and as
> > you can see no python issues:
> > [...]
> > Bytecompiling .py files below /root/ovs/rpm/rpmbuild/BUILDROOT/openvswitch-2.14.90-1.el8.x86_64/usr/lib/python3.6 using /usr/libexec/platform-python
> > + /usr/lib/rpm/brp-python-hardlink
> > + PYTHON3=/usr/libexec/platform-python
> > + /usr/lib/rpm/redhat/brp-mangle-shebangs
> > *** WARNING: ./usr/lib64/libopenvswitch.la is executable but has empty or no shebang, removing executable bit
> > *** WARNING: ./usr/lib64/libsflow.la is executable but has empty or no shebang, removing executable bit
> > *** WARNING: ./usr/lib64/libofproto.la is executable but has empty or no shebang, removing executable bit
> > *** WARNING: ./usr/lib64/libovsdb.la is executable but has empty or no shebang, removing executable bit
> > *** WARNING: ./usr/lib64/libvtep.la is executable but has empty or no shebang, removing executable bit
> > *** WARNING: ./etc/bash_completion.d/ovs-appctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
> > *** WARNING: ./etc/bash_completion.d/ovs-vsctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
> > Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.plv5lw
> > [...]
> > 
> > 
> > fbl
> > 
> 
> Hi Flavio,
> 
> This is truly curious because here's what we're getting:
> 
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/sendpkt.py: #!/usr/bin/env
> python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/test-l7.py: #!/usr/bin/env
> python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) ***
> WARNING: ./usr/src/openvswitch-2.13.1.rhel82.39060899/tests/checkpatch.at is
> executable but has empty or no shebang, removing executable bit
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/ovsdb-monitor-sort.py:
> #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/uuidfilt.py:
> #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) mangling
> shebang in /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/flowgen.py from
> /usr/bin/env python3 to #!/usr/libexec/platform-python
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/ofproto/ipfix-gen-entities:
> #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-dot.in has shebang
> which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-idlc.in has shebang
> which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-doc:
> #!/usr/bin/python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ambiguous python shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/dot2pic: #!/usr/bin/env
> python. Change it to python3 (or python2) explicitly.
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/ipsec/ovs-monitor-ipsec.in has
> shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-vlan-test.in has
> shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-tcpdump.in has
> shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-tcpundump.in has
> shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/bugtool/ovs-bugtool.in
> has shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-pcap.in has
> shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-check-dead-ifs.in
> has shebang which doesn't start with '/' (@PYTHON3@)
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) mangling
> shebang in
> /usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/checkpatch.py from
> /usr/bin/env python3 to #!/usr/libexec/platform-python
> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-parse-backtrace.in
> has shebang which doesn't start with '/' (@PYTHON3@)
> 
> 
> Any idea what we could do to fix this?  Maybe it's a chroot thing?

Well, that seems to be a different spec since it's packaging files
that OVS normally does not install.

Are you packaging the OVS sources?

> Although I have no idea why it would have anything to do with chroot,
> but frankly I'm grasping at straws here.

Right, but there is no sense in having ovs-check-dead-ifs.in packaged
with execution permission. So, this is definitely a packaging issue.

Assuming that you want to package the sources, then you need to tell
RPM to ignore them, because they are not normal installable files.

The following line tells RPM to ignore files under your sources
directory:
%global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899

Most probably you need to replace those versions with RPM macros.

fbl

> And I want to say again, on a RHEL 8.2 system that I have, executing
> this, 'find . -type f -executable |
> /usr/lib/rpm/redhat/brp-mangle-shebangs', produces many errors.  So maybe my
> RHEL 8.2 system
> is different in some way?
> 
> Thanks,
> 
> - Greg
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Gregory Rose Aug. 19, 2020, 3 p.m. UTC | #10
On 8/18/2020 9:41 PM, Flavio Leitner wrote:
> On Tue, Aug 18, 2020 at 08:44:45PM -0700, Gregory Rose wrote:
>>
>> On 8/18/2020 7:21 PM, Flavio Leitner wrote:
>>> On Tue, Aug 18, 2020 at 01:29:33PM -0700, Gregory Rose wrote:
>>>> On 8/18/2020 1:10 PM, Ilya Maximets wrote:
>>>>> On 8/18/20 9:17 PM, Gregory Rose wrote:
>>>>>>
>>>>>> On 8/18/2020 11:31 AM, Ilya Maximets wrote:
>>>>>>> On 8/18/20 6:45 PM, Greg Rose wrote:
>>>>>>>> Builds on RHEL 8.2 systems are failing due to this issue.
>>>>>>>>
>>>>>>>> See [1] as to why this is necessary.
>>>>>>>>
>>>>>>>> I used the following command to identify files that need this fix:
>>>>>>>> find . -type f -executable | /usr/lib/rpm/redhat/brp-mangle-shebangs
>>>>>>>>
>>>>>>>> I also updated the copyright notices as needed.
>>>>>>>>
>>>>>>>> 1. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
>>>>>>>>
>>>>>>>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>>>>>>>> ---
>>>>>>>>      ipsec/ovs-monitor-ipsec.in                            |  4 ++--
>>>>>>>>      ofproto/ipfix-gen-entities                            |  4 ++--
>>>>>>>>      ovsdb/dot2pic                                         |  4 ++--
>>>>>>>>      ovsdb/ovsdb-doc                                       |  4 ++--
>>>>>>>>      ovsdb/ovsdb-dot.in                                    |  2 +-
>>>>>>>>      ovsdb/ovsdb-idlc.in                                   |  2 +-
>>>>>>>>      python/build/soutil.py                                |  4 ++--
>>>>>>>>      tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>>>>>>>>      tests/sendpkt.py                                      |  4 ++--
>>>>>>>>      tests/test-l7.py                                      |  4 ++--
>>>>>>>>      tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>>>>>>>>      utilities/bugtool/ovs-bugtool.in                      |  4 ++--
>>>>>>>>      utilities/ovs-check-dead-ifs.in                       |  2 +-
>>>>>>>>      utilities/ovs-dev.py                                  |  4 ++--
>>>>>>>>      utilities/ovs-dpctl-top.in                            |  4 ++--
>>>>>>>>      utilities/ovs-l3ping.in                               |  2 +-
>>>>>>>>      utilities/ovs-parse-backtrace.in                      |  4 ++--
>>>>>>>>      utilities/ovs-pcap.in                                 |  4 ++--
>>>>>>>>      utilities/ovs-pipegen.py                              |  4 ++--
>>>>>>>>      utilities/ovs-tcpdump.in                              |  2 +-
>>>>>>>>      utilities/ovs-tcpundump.in                            |  4 ++--
>>>>>>>>      utilities/ovs-test.in                                 |  2 +-
>>>>>>>>      utilities/ovs-vlan-test.in                            |  4 ++--
>>>>>>>>      vtep/ovs-vtep.in                                      |  4 ++--
>>>>>>>>      xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>>>>>>>>      xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>>>>>>>>      xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>>>>>>>>      27 files changed, 74 insertions(+), 46 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
>>>>>>>> index 37e3703..32e8e90 100755
>>>>>>>> --- a/ipsec/ovs-monitor-ipsec.in
>>>>>>>> +++ b/ipsec/ovs-monitor-ipsec.in
>>>>>>>> @@ -1,5 +1,5 @@
>>>>>>>> -#! @PYTHON3@
>>>>>>>> -# Copyright (c) 2017 Nicira, Inc.
>>>>>>>> +#!/usr/bin/env python3
>>>>>>>> +# Copyright (c) 2017, 2020 Nicira, Inc.
>>>>>>>>      #
>>>>>>>>      # Licensed under the Apache License, Version 2.0 (the "License");
>>>>>>>>      # you may not use this file except in compliance with the License.
>>>>>>>> diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
>>>>>>>> index 0be7199..d5abe9c 100755
>>>>>>>> --- a/ofproto/ipfix-gen-entities
>>>>>>>> +++ b/ofproto/ipfix-gen-entities
>>>>>>>> @@ -1,6 +1,6 @@
>>>>>>>> -#! /usr/bin/env python
>>>>>>>> +#!/usr/bin/env python3
>>>>>>>>      #
>>>>>>>> -# Copyright (C) 2012 Nicira, Inc.
>>>>>>>> +# Copyright (C) 2012, 2020 Nicira, Inc.
>>>>>>>>      #
>>>>>>>>      # Copying and distribution of this file, with or without modification,
>>>>>>>>      # are permitted in any medium without royalty provided the copyright
>>>>>>>> diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
>>>>>>>> index de67261..2f858e1 100755
>>>>>>>> --- a/ovsdb/dot2pic
>>>>>>>> +++ b/ovsdb/dot2pic
>>>>>>>> @@ -1,6 +1,6 @@
>>>>>>>> -#! /usr/bin/env python
>>>>>>>> +#!/usr/bin/env python3
>>>>>>>>      -# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
>>>>>>>> +# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
>>>>>>>>      #
>>>>>>>>      # Licensed under the Apache License, Version 2.0 (the "License");
>>>>>>>>      # you may not use this file except in compliance with the License.
>>>>>>>> diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
>>>>>>>> index 406c293..10d0c0c 100755
>>>>>>>> --- a/ovsdb/ovsdb-doc
>>>>>>>> +++ b/ovsdb/ovsdb-doc
>>>>>>>> @@ -1,6 +1,6 @@
>>>>>>>> -#! /usr/bin/python
>>>>>>>> +#!/usr/bin/python3
>>>>>>>>      -# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
>>>>>>>> +# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
>>>>>>>>      #
>>>>>>>>      # Licensed under the Apache License, Version 2.0 (the "License");
>>>>>>>>      # you may not use this file except in compliance with the License.
>>>>>>>> diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
>>>>>>>> index 41b986c..571601e 100755
>>>>>>>> --- a/ovsdb/ovsdb-dot.in
>>>>>>>> +++ b/ovsdb/ovsdb-dot.in
>>>>>>>> @@ -1,4 +1,4 @@
>>>>>>>> -#! @PYTHON3@
>>>>>>>> +#!/usr/bin/env python3
>>>>>>>
>>>>>>> Hmm.  This doesn't look right.
>>>>>>>
>>>>>>> All the *.in files are used to generate actual scripts out of them
>>>>>>> and '@PYTHON3@' is a placeholder for an actual python3 binary location
>>>>>>> determind at the ./configure stage.  So, I don't think that we should
>>>>>>> replace them.
>>>>>>>
>>>>>>> Best regards, Ilya Maximets.
>>>>>>>
>>>>>>
>>>>>> Hi Ilya,
>>>>>>
>>>>>> Thanks for the review.
>>>>>>
>>>>>> The shebang check occurs before the expansion of @PYTHON3@ and causes
>>>>>> build failures.
>>>>>
>>>>> This is strange.  I just tried to build rpms on rhel 8.2 and on fedora 31.
>>>>> On both systems shebang check was triggered after the actual build and
>>>>> only on resulted executable files (without .in).  I think, something
>>>>> goes terribly wrong if shebang check invoked before the build and on
>>>>> files that should not be part of a binary distribution.
>>>>>
>>>>> Could you provide more information on how to reproduce?
>>>>>
>>>>>> We have no control over when the shebang check runs
>>>>>> because it is part of the RPM build environment supplied by Red Hat.
>>>>>> Moreover, the shebang check also substitutes #!/usr/bin/env python3
>>>>>> with someting like '/usr/libexec/platform-python'.
>>>>>
>>>>> I see messages like this:
>>>>> mangling shebang in /usr/bin/ovs-pcap from /usr/bin/python3 to #!/usr/libexec/platform-python
>>>>>
>>>>> But these are not errors nor even warnings, so should not affect the build.
>>>>> In fact /usr/bin/python3 is a symlink to /usr/libexec/platform-python.
>>>>
>>>> Yes - but @PYTHON3@ is an error.  That's what I have to find some way
>>>> to fix.
>>>
>>> I agree with Ilya here that this is strange.
>>>
>>> I just built ovs RPMs on RHEL-8.2 and it worked just fine,
>>> same on Fedora 32.
>>>
>>> Those below are the only message related to shebangs and as
>>> you can see no python issues:
>>> [...]
>>> Bytecompiling .py files below /root/ovs/rpm/rpmbuild/BUILDROOT/openvswitch-2.14.90-1.el8.x86_64/usr/lib/python3.6 using /usr/libexec/platform-python
>>> + /usr/lib/rpm/brp-python-hardlink
>>> + PYTHON3=/usr/libexec/platform-python
>>> + /usr/lib/rpm/redhat/brp-mangle-shebangs
>>> *** WARNING: ./usr/lib64/libopenvswitch.la is executable but has empty or no shebang, removing executable bit
>>> *** WARNING: ./usr/lib64/libsflow.la is executable but has empty or no shebang, removing executable bit
>>> *** WARNING: ./usr/lib64/libofproto.la is executable but has empty or no shebang, removing executable bit
>>> *** WARNING: ./usr/lib64/libovsdb.la is executable but has empty or no shebang, removing executable bit
>>> *** WARNING: ./usr/lib64/libvtep.la is executable but has empty or no shebang, removing executable bit
>>> *** WARNING: ./etc/bash_completion.d/ovs-appctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
>>> *** WARNING: ./etc/bash_completion.d/ovs-vsctl-bashcomp.bash is executable but has empty or no shebang, removing executable bit
>>> Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.plv5lw
>>> [...]
>>>
>>>
>>> fbl
>>>
>>
>> Hi Flavio,
>>
>> This is truly curious because here's what we're getting:
>>
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/sendpkt.py: #!/usr/bin/env
>> python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/test-l7.py: #!/usr/bin/env
>> python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) ***
>> WARNING: ./usr/src/openvswitch-2.13.1.rhel82.39060899/tests/checkpatch.at is
>> executable but has empty or no shebang, removing executable bit
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/ovsdb-monitor-sort.py:
>> #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/uuidfilt.py:
>> #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) mangling
>> shebang in /usr/src/openvswitch-2.13.1.rhel82.39060899/tests/flowgen.py from
>> /usr/bin/env python3 to #!/usr/libexec/platform-python
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/ofproto/ipfix-gen-entities:
>> #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-dot.in has shebang
>> which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-idlc.in has shebang
>> which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/ovsdb-doc:
>> #!/usr/bin/python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ambiguous python shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/ovsdb/dot2pic: #!/usr/bin/env
>> python. Change it to python3 (or python2) explicitly.
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/ipsec/ovs-monitor-ipsec.in has
>> shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-vlan-test.in has
>> shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-tcpdump.in has
>> shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-tcpundump.in has
>> shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/bugtool/ovs-bugtool.in
>> has shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-pcap.in has
>> shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-check-dead-ifs.in
>> has shebang which doesn't start with '/' (@PYTHON3@)
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) mangling
>> shebang in
>> /usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/checkpatch.py from
>> /usr/bin/env python3 to #!/usr/libexec/platform-python
>> 2020-08-13 23:12:44 | [23:12:44     INFO] (chroot: rhel82_x86_64) *** ERROR:
>> ./usr/src/openvswitch-2.13.1.rhel82.39060899/utilities/ovs-parse-backtrace.in
>> has shebang which doesn't start with '/' (@PYTHON3@)
>>
>>
>> Any idea what we could do to fix this?  Maybe it's a chroot thing?
> 
> Well, that seems to be a different spec since it's packaging files
> that OVS normally does not install.
> 
> Are you packaging the OVS sources?
> 
>> Although I have no idea why it would have anything to do with chroot,
>> but frankly I'm grasping at straws here.
> 
> Right, but there is no sense in having ovs-check-dead-ifs.in packaged
> with execution permission. So, this is definitely a packaging issue.
> 
> Assuming that you want to package the sources, then you need to tell
> RPM to ignore them, because they are not normal installable files.
> 
> The following line tells RPM to ignore files under your sources
> directory:
> %global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899
> 
> Most probably you need to replace those versions with RPM macros.

Let me work with our build team to see if that will fix the problem.
Thanks for the suggestion.

- Greg


> 
> fbl
> 
>> And I want to say again, on a RHEL 8.2 system that I have, executing
>> this, 'find . -type f -executable |
>> /usr/lib/rpm/redhat/brp-mangle-shebangs', produces many errors.  So maybe my
>> RHEL 8.2 system
>> is different in some way?
>>
>> Thanks,
>>
>> - Greg
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Gregory Rose Aug. 20, 2020, 3:56 p.m. UTC | #11
On 8/18/2020 9:41 PM, Flavio Leitner wrote:
> 
> Right, but there is no sense in having ovs-check-dead-ifs.in packaged
> with execution permission. So, this is definitely a packaging issue.
> 
> Assuming that you want to package the sources, then you need to tell
> RPM to ignore them, because they are not normal installable files.
> 
> The following line tells RPM to ignore files under your sources
> directory:
> %global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899
> 
> Most probably you need to replace those versions with RPM macros.
> 
> fbl
> 

Hi Flavio,

Thank you - this did the trick.  Our internal build team has a script
that adds this line to the rhel/openvswitch-dkms.spec.in file and the
build now passes without problems.

Your help is much appreciated!

- Greg
Ilya Maximets Aug. 21, 2020, 11:32 a.m. UTC | #12
On 8/20/20 5:56 PM, Gregory Rose wrote:
> 
> 
> On 8/18/2020 9:41 PM, Flavio Leitner wrote:
>>
>> Right, but there is no sense in having ovs-check-dead-ifs.in packaged
>> with execution permission. So, this is definitely a packaging issue.
>>
>> Assuming that you want to package the sources, then you need to tell
>> RPM to ignore them, because they are not normal installable files.
>>
>> The following line tells RPM to ignore files under your sources
>> directory:
>> %global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899
>>
>> Most probably you need to replace those versions with RPM macros.
>>
>> fbl
>>
> 
> Hi Flavio,
> 
> Thank you - this did the trick.  Our internal build team has a script
> that adds this line to the rhel/openvswitch-dkms.spec.in file and the
> build now passes without problems.
> 
> Your help is much appreciated!

Good to know that it works!

BTW, I think that half of this patch is still valid, i.e. we probably
still need to fix shebangs for actual python files:

 ofproto/ipfix-gen-entities                            |  4 ++--
 ovsdb/dot2pic                                         |  4 ++--
 ovsdb/ovsdb-doc                                       |  4 ++--
 python/build/soutil.py                                |  4 ++--
 tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
 tests/sendpkt.py                                      |  4 ++--
 tests/test-l7.py                                      |  4 ++--
 tests/uuidfilt.py                                     | 18 +++++++++++++++++-
 xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
 xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
 xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--

Otherwise we coud have issues with unit tests and some other things on systems
without 'python' symlink.

Would you mind submitting v2?

Best regards, Ilya Maximets.
Gregory Rose Aug. 21, 2020, 3:50 p.m. UTC | #13
On 8/21/2020 4:32 AM, Ilya Maximets wrote:
> On 8/20/20 5:56 PM, Gregory Rose wrote:
>>
>>
>> On 8/18/2020 9:41 PM, Flavio Leitner wrote:
>>>
>>> Right, but there is no sense in having ovs-check-dead-ifs.in packaged
>>> with execution permission. So, this is definitely a packaging issue.
>>>
>>> Assuming that you want to package the sources, then you need to tell
>>> RPM to ignore them, because they are not normal installable files.
>>>
>>> The following line tells RPM to ignore files under your sources
>>> directory:
>>> %global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899
>>>
>>> Most probably you need to replace those versions with RPM macros.
>>>
>>> fbl
>>>
>>
>> Hi Flavio,
>>
>> Thank you - this did the trick.  Our internal build team has a script
>> that adds this line to the rhel/openvswitch-dkms.spec.in file and the
>> build now passes without problems.
>>
>> Your help is much appreciated!
> 
> Good to know that it works!
> 
> BTW, I think that half of this patch is still valid, i.e. we probably
> still need to fix shebangs for actual python files:
> 
>   ofproto/ipfix-gen-entities                            |  4 ++--
>   ovsdb/dot2pic                                         |  4 ++--
>   ovsdb/ovsdb-doc                                       |  4 ++--
>   python/build/soutil.py                                |  4 ++--
>   tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>   tests/sendpkt.py                                      |  4 ++--
>   tests/test-l7.py                                      |  4 ++--
>   tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>   xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>   xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>   xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
> 
> Otherwise we coud have issues with unit tests and some other things on systems
> without 'python' symlink.
> 
> Would you mind submitting v2?
> 
> Best regards, Ilya Maximets.
> 

Hi Ilya,

I'll be happy to do that.

Thanks,

- Greg
Flavio Leitner Aug. 21, 2020, 4:58 p.m. UTC | #14
On Fri, Aug 21, 2020 at 08:50:49AM -0700, Gregory Rose wrote:
> 
> 
> On 8/21/2020 4:32 AM, Ilya Maximets wrote:
> > On 8/20/20 5:56 PM, Gregory Rose wrote:
> > > 
> > > 
> > > On 8/18/2020 9:41 PM, Flavio Leitner wrote:
> > > > 
> > > > Right, but there is no sense in having ovs-check-dead-ifs.in packaged
> > > > with execution permission. So, this is definitely a packaging issue.
> > > > 
> > > > Assuming that you want to package the sources, then you need to tell
> > > > RPM to ignore them, because they are not normal installable files.
> > > > 
> > > > The following line tells RPM to ignore files under your sources
> > > > directory:
> > > > %global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899
> > > > 
> > > > Most probably you need to replace those versions with RPM macros.
> > > > 
> > > > fbl
> > > > 
> > > 
> > > Hi Flavio,
> > > 
> > > Thank you - this did the trick.  Our internal build team has a script
> > > that adds this line to the rhel/openvswitch-dkms.spec.in file and the
> > > build now passes without problems.
> > > 
> > > Your help is much appreciated!
> > 
> > Good to know that it works!
> > 
> > BTW, I think that half of this patch is still valid, i.e. we probably
> > still need to fix shebangs for actual python files:
> > 
> >   ofproto/ipfix-gen-entities                            |  4 ++--
> >   ovsdb/dot2pic                                         |  4 ++--
> >   ovsdb/ovsdb-doc                                       |  4 ++--
> >   python/build/soutil.py                                |  4 ++--
> >   tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
> >   tests/sendpkt.py                                      |  4 ++--
> >   tests/test-l7.py                                      |  4 ++--
> >   tests/uuidfilt.py                                     | 18 +++++++++++++++++-
> >   xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
> >   xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
> >   xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
> > 
> > Otherwise we coud have issues with unit tests and some other things on systems
> > without 'python' symlink.
> > 
> > Would you mind submitting v2?
> > 
> > Best regards, Ilya Maximets.
> > 
> 
> Hi Ilya,
> 
> I'll be happy to do that.

It seems we don't want to remove the executable permission and
the shebang will be @PYTHON@, so we can exclude that as mentioned
in the doc[1].

I think the line fixing rhel/openvswitch-dkms.spec.in could also
proposed to fix the spec for everyone, then no one needs to run
any scripts.

[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/
Gregory Rose Aug. 21, 2020, 5:05 p.m. UTC | #15
On 8/21/2020 9:58 AM, Flavio Leitner wrote:
> On Fri, Aug 21, 2020 at 08:50:49AM -0700, Gregory Rose wrote:
>>
>>
>> On 8/21/2020 4:32 AM, Ilya Maximets wrote:
>>> On 8/20/20 5:56 PM, Gregory Rose wrote:
>>>>
>>>>
>>>> On 8/18/2020 9:41 PM, Flavio Leitner wrote:
>>>>>
>>>>> Right, but there is no sense in having ovs-check-dead-ifs.in packaged
>>>>> with execution permission. So, this is definitely a packaging issue.
>>>>>
>>>>> Assuming that you want to package the sources, then you need to tell
>>>>> RPM to ignore them, because they are not normal installable files.
>>>>>
>>>>> The following line tells RPM to ignore files under your sources
>>>>> directory:
>>>>> %global __brp_mangle_shebangs_exclude_from /usr/src/openvswitch-2.13.1.rhel82.39060899
>>>>>
>>>>> Most probably you need to replace those versions with RPM macros.
>>>>>
>>>>> fbl
>>>>>
>>>>
>>>> Hi Flavio,
>>>>
>>>> Thank you - this did the trick.  Our internal build team has a script
>>>> that adds this line to the rhel/openvswitch-dkms.spec.in file and the
>>>> build now passes without problems.
>>>>
>>>> Your help is much appreciated!
>>>
>>> Good to know that it works!
>>>
>>> BTW, I think that half of this patch is still valid, i.e. we probably
>>> still need to fix shebangs for actual python files:
>>>
>>>    ofproto/ipfix-gen-entities                            |  4 ++--
>>>    ovsdb/dot2pic                                         |  4 ++--
>>>    ovsdb/ovsdb-doc                                       |  4 ++--
>>>    python/build/soutil.py                                |  4 ++--
>>>    tests/ovsdb-monitor-sort.py                           | 16 ++++++++++++++--
>>>    tests/sendpkt.py                                      |  4 ++--
>>>    tests/test-l7.py                                      |  4 ++--
>>>    tests/uuidfilt.py                                     | 18 +++++++++++++++++-
>>>    xenserver/etc_xapi.d_plugins_openvswitch-cfg-update   |  4 ++--
>>>    xenserver/opt_xensource_libexec_interface-reconfigure |  2 +-
>>>    xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync |  4 ++--
>>>
>>> Otherwise we coud have issues with unit tests and some other things on systems
>>> without 'python' symlink.
>>>
>>> Would you mind submitting v2?
>>>
>>> Best regards, Ilya Maximets.
>>>
>>
>> Hi Ilya,
>>
>> I'll be happy to do that.
> 
> It seems we don't want to remove the executable permission and
> the shebang will be @PYTHON@, so we can exclude that as mentioned
> in the doc[1].
> 
> I think the line fixing rhel/openvswitch-dkms.spec.in could also
> proposed to fix the spec for everyone, then no one needs to run
> any scripts.
> 
> [1] https://docs.fedoraproject.org/en-US/packaging-guidelines/
> 

Hi Flavio,

I wondered if we should just unconditionally add it to openvswitch-dkms
but didn't know if some folks might want that behavior.

I'll submit a patch to do this separately when I get back from PTO
in a couple of weeks.  Unless someone beats me to it.

Thanks,

- Greg
diff mbox series

Patch

diff --git a/ipsec/ovs-monitor-ipsec.in b/ipsec/ovs-monitor-ipsec.in
index 37e3703..32e8e90 100755
--- a/ipsec/ovs-monitor-ipsec.in
+++ b/ipsec/ovs-monitor-ipsec.in
@@ -1,5 +1,5 @@ 
-#! @PYTHON3@
-# Copyright (c) 2017 Nicira, Inc.
+#!/usr/bin/env python3
+# Copyright (c) 2017, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ofproto/ipfix-gen-entities b/ofproto/ipfix-gen-entities
index 0be7199..d5abe9c 100755
--- a/ofproto/ipfix-gen-entities
+++ b/ofproto/ipfix-gen-entities
@@ -1,6 +1,6 @@ 
-#! /usr/bin/env python
+#!/usr/bin/env python3
 #
-# Copyright (C) 2012 Nicira, Inc.
+# Copyright (C) 2012, 2020 Nicira, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
index de67261..2f858e1 100755
--- a/ovsdb/dot2pic
+++ b/ovsdb/dot2pic
@@ -1,6 +1,6 @@ 
-#! /usr/bin/env python
+#!/usr/bin/env python3
 
-# Copyright (c) 2009, 2010, 2011, 2013, 2017 Nicira, Inc.
+# Copyright (c) 2009, 2010, 2011, 2013, 2017, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc
index 406c293..10d0c0c 100755
--- a/ovsdb/ovsdb-doc
+++ b/ovsdb/ovsdb-doc
@@ -1,6 +1,6 @@ 
-#! /usr/bin/python
+#!/usr/bin/python3
 
-# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
+# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
index 41b986c..571601e 100755
--- a/ovsdb/ovsdb-dot.in
+++ b/ovsdb/ovsdb-dot.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#!/usr/bin/env python3
 
 from datetime import date
 import ovs.db.error
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 698fe25..de42519 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#!/usr/bin/env python3
 
 from __future__ import print_function
 import getopt
diff --git a/python/build/soutil.py b/python/build/soutil.py
index b8027af..bb6c911 100755
--- a/python/build/soutil.py
+++ b/python/build/soutil.py
@@ -1,6 +1,6 @@ 
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-# Copyright (c) 2008, 2017 Nicira, Inc.
+# Copyright (c) 2008, 2017, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/tests/ovsdb-monitor-sort.py b/tests/ovsdb-monitor-sort.py
index 7d368a7..da4ee2a 100755
--- a/tests/ovsdb-monitor-sort.py
+++ b/tests/ovsdb-monitor-sort.py
@@ -1,5 +1,17 @@ 
-#! /usr/bin/env python
-
+#! /usr/bin/env python3
+# Copyright (c) 2020 VMware, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 # Breaks lines read from stdin into groups using blank lines as
 # group separators, then sorts lines within the groups for
 # reproducibility.
diff --git a/tests/sendpkt.py b/tests/sendpkt.py
index 328ae2b..d0e24f4 100755
--- a/tests/sendpkt.py
+++ b/tests/sendpkt.py
@@ -1,6 +1,6 @@ 
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-# Copyright (c) 2018 VMware, Inc.
+# Copyright (c) 2018, 2020 VMware, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/tests/test-l7.py b/tests/test-l7.py
index d7854a1..32a7739 100755
--- a/tests/test-l7.py
+++ b/tests/test-l7.py
@@ -1,5 +1,5 @@ 
-#!/usr/bin/env python
-# Copyright (c) 2015, 2016 Nicira, Inc.
+#!/usr/bin/env python3
+# Copyright (c) 2015, 2016, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/tests/uuidfilt.py b/tests/uuidfilt.py
index bc49aa4..39679dd 100755
--- a/tests/uuidfilt.py
+++ b/tests/uuidfilt.py
@@ -1,4 +1,20 @@ 
-#!/usr/bin/env python
+#!/usr/bin/env python3
+# Copyright (c) 2020 VMware, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# Breaks lines read from stdin into groups using blank lines as
+# group separators, then sorts lines within the groups for
+# reproducibility.
 
 import re
 import sys
diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index ddb5bc8..a0202ae 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#!/usr/bin/env python3
 
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of version 2.1 of the GNU Lesser General Public
@@ -14,7 +14,7 @@ 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 # Copyright (c) 2005, 2007 XenSource Ltd.
-# Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016, 2017 Nicira, Inc.
+# Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016, 2017, 2020 Nicira, Inc.
 
 #
 # To add new entries to the bugtool, you need to:
diff --git a/utilities/ovs-check-dead-ifs.in b/utilities/ovs-check-dead-ifs.in
index bf35657..e38dffd 100755
--- a/utilities/ovs-check-dead-ifs.in
+++ b/utilities/ovs-check-dead-ifs.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 
 import os
 import re
diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
index 248d22a..c45788a 100755
--- a/utilities/ovs-dev.py
+++ b/utilities/ovs-dev.py
@@ -1,5 +1,5 @@ 
-#!/usr/bin/env python
-# Copyright (c) 2013, 2014, 2015, 2016 Nicira, Inc.
+#!/usr/bin/env python3
+# Copyright (c) 2013, 2014, 2015, 2016, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index 011cc64..1b5e56f 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -1,6 +1,6 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
-# Copyright (c) 2013 Nicira, Inc.
+# Copyright (c) 2013, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-l3ping.in b/utilities/ovs-l3ping.in
index 92d32ac..5acecab 100644
--- a/utilities/ovs-l3ping.in
+++ b/utilities/ovs-l3ping.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-parse-backtrace.in b/utilities/ovs-parse-backtrace.in
index d550676..f360d03 100755
--- a/utilities/ovs-parse-backtrace.in
+++ b/utilities/ovs-parse-backtrace.in
@@ -1,6 +1,6 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
-# Copyright (c) 2012 Nicira, Inc.
+# Copyright (c) 2012, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-pcap.in b/utilities/ovs-pcap.in
index dddbee4..e37872d 100755
--- a/utilities/ovs-pcap.in
+++ b/utilities/ovs-pcap.in
@@ -1,6 +1,6 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
-# Copyright (c) 2010 Nicira, Inc.
+# Copyright (c) 2010, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-pipegen.py b/utilities/ovs-pipegen.py
index ee57972..a3b6a66 100755
--- a/utilities/ovs-pipegen.py
+++ b/utilities/ovs-pipegen.py
@@ -1,5 +1,5 @@ 
-#! /usr/bin/env python
-# Copyright (c) 2013, 2014, 2015 Nicira, Inc.
+#! /usr/bin/env python3
+# Copyright (c) 2013, 2014, 2015, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 5ec0238..237805b 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
 # Copyright (c) 2016 Red Hat, Inc.
 #
diff --git a/utilities/ovs-tcpundump.in b/utilities/ovs-tcpundump.in
index ede5448..f56833e 100755
--- a/utilities/ovs-tcpundump.in
+++ b/utilities/ovs-tcpundump.in
@@ -1,6 +1,6 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
-# Copyright (c) 2010 Nicira, Inc.
+# Copyright (c) 2010, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-test.in b/utilities/ovs-test.in
index eb712ff..1635af0 100644
--- a/utilities/ovs-test.in
+++ b/utilities/ovs-test.in
@@ -1,4 +1,4 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/utilities/ovs-vlan-test.in b/utilities/ovs-vlan-test.in
index 154573a..ce0bb54 100755
--- a/utilities/ovs-vlan-test.in
+++ b/utilities/ovs-vlan-test.in
@@ -1,6 +1,6 @@ 
-#! @PYTHON3@
+#! /usr/bin/env python3
 #
-# Copyright (c) 2010 Nicira, Inc.
+# Copyright (c) 2010, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/vtep/ovs-vtep.in b/vtep/ovs-vtep.in
index 0ee23b1..8acefdd 100755
--- a/vtep/ovs-vtep.in
+++ b/vtep/ovs-vtep.in
@@ -1,5 +1,5 @@ 
-#! @PYTHON3@
-# Copyright (C) 2013 Nicira, Inc. All Rights Reserved.
+#! /usr/bin/env python3
+# Copyright (C) 2013, 2020 Nicira, Inc. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
index e7404e3..b8db881 100755
--- a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
+++ b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
@@ -1,10 +1,10 @@ 
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # xapi plugin script to update the cache of configuration items in the
 # ovs-vswitchd configuration that are managed in the xapi database when
 # integrated with Citrix management tools.
 
-# Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure
index a82043f..9c20725 100755
--- a/xenserver/opt_xensource_libexec_interface-reconfigure
+++ b/xenserver/opt_xensource_libexec_interface-reconfigure
@@ -1,4 +1,4 @@ 
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Copyright (c) 2008,2009 Citrix Systems, Inc.
 #
diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
index cf89600..1bd56a6 100755
--- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
+++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
@@ -1,5 +1,5 @@ 
-#! /usr/bin/env python
-# Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+#! /usr/bin/env python3
+# Copyright (c) 2009, 2010, 2011, 2012, 2013, 2020 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.