[libvirt] [PATCH v2 0/2] perl/python: Don't hardcode interpreter path

Changes from [v1]: * fix all Perl scripts instead of a single one; * fix all Python scripts as well. [v1] https://www.redhat.com/archives/libvir-list/2017-September/msg00504.html Andrea Bolognani (2): perl: Don't hardcode interpreter path python: Don't hardcode interpreter path build-aux/augeas-gentest.pl | 2 +- build-aux/check-spacing.pl | 2 +- build-aux/mock-noinline.pl | 2 +- build-aux/prohibit-duplicate-header.pl | 2 +- docs/apibuild.py | 2 +- docs/genaclperms.pl | 2 +- docs/hvsupport.pl | 2 +- docs/index.py | 2 +- docs/reformat-news.py | 2 +- src/access/genpolkit.pl | 2 +- src/check-aclperms.pl | 2 +- src/check-aclrules.pl | 2 +- src/check-driverimpls.pl | 2 +- src/check-drivername.pl | 2 +- src/check-symfile.pl | 2 +- src/check-symsorting.pl | 2 +- src/dtrace2systemtap.pl | 2 +- src/esx/esx_vi_generator.py | 2 +- src/hyperv/hyperv_wmi_generator.py | 2 +- src/rpc/gendispatch.pl | 3 ++- src/rpc/genprotocol.pl | 1 + src/rpc/gensystemtap.pl | 2 +- tests/check-file-access.pl | 2 +- tests/cputestdata/cpu-cpuid.py | 2 +- tests/oomtrace.pl | 2 +- 25 files changed, 26 insertions(+), 24 deletions(-) -- 2.13.5

This is particularly useful on operating systems that don't ship Perl as part of the base system (eg. FreeBSD) while still working just as well as it did before on Linux. In one case (src/rpc/genprotocol.pl) the interpreter path was missing altogether. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- build-aux/augeas-gentest.pl | 2 +- build-aux/check-spacing.pl | 2 +- build-aux/mock-noinline.pl | 2 +- build-aux/prohibit-duplicate-header.pl | 2 +- docs/genaclperms.pl | 2 +- docs/hvsupport.pl | 2 +- src/access/genpolkit.pl | 2 +- src/check-aclperms.pl | 2 +- src/check-aclrules.pl | 2 +- src/check-driverimpls.pl | 2 +- src/check-drivername.pl | 2 +- src/check-symfile.pl | 2 +- src/check-symsorting.pl | 2 +- src/dtrace2systemtap.pl | 2 +- src/rpc/gendispatch.pl | 3 ++- src/rpc/genprotocol.pl | 1 + src/rpc/gensystemtap.pl | 2 +- tests/check-file-access.pl | 2 +- tests/oomtrace.pl | 2 +- 19 files changed, 20 insertions(+), 18 deletions(-) diff --git a/build-aux/augeas-gentest.pl b/build-aux/augeas-gentest.pl index ece9a8a00..18a1c5bce 100755 --- a/build-aux/augeas-gentest.pl +++ b/build-aux/augeas-gentest.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # augeas-gentest.pl: Generate an augeas test file, from an # example config file + test file template diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index 448acf234..ca8b43491 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # check-spacing.pl: Report any usage of 'function (..args..)' # Also check for other syntax issues, such as correct use of ';' diff --git a/build-aux/mock-noinline.pl b/build-aux/mock-noinline.pl index eafe20d2e..c6b40001c 100644 --- a/build-aux/mock-noinline.pl +++ b/build-aux/mock-noinline.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl my %noninlined; my %mocked; diff --git a/build-aux/prohibit-duplicate-header.pl b/build-aux/prohibit-duplicate-header.pl index f0539aeca..4a2ea6566 100644 --- a/build-aux/prohibit-duplicate-header.pl +++ b/build-aux/prohibit-duplicate-header.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; diff --git a/docs/genaclperms.pl b/docs/genaclperms.pl index c0514a022..d878321a9 100755 --- a/docs/genaclperms.pl +++ b/docs/genaclperms.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2013 Red Hat, Inc. # diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl index edbe19faf..fc6eb1f15 100755 --- a/docs/hvsupport.pl +++ b/docs/hvsupport.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; diff --git a/src/access/genpolkit.pl b/src/access/genpolkit.pl index eb7069a6d..6258fd3a1 100755 --- a/src/access/genpolkit.pl +++ b/src/access/genpolkit.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2012-2013 Red Hat, Inc. # diff --git a/src/check-aclperms.pl b/src/check-aclperms.pl index 5b1b4dbad..55b659831 100755 --- a/src/check-aclperms.pl +++ b/src/check-aclperms.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2013 Red Hat, Inc. # diff --git a/src/check-aclrules.pl b/src/check-aclrules.pl index 8739cda73..5b6c711dc 100755 --- a/src/check-aclrules.pl +++ b/src/check-aclrules.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2013-2014 Red Hat, Inc. # diff --git a/src/check-driverimpls.pl b/src/check-driverimpls.pl index e32055835..4c28f2092 100755 --- a/src/check-driverimpls.pl +++ b/src/check-driverimpls.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2013 Red Hat, Inc. # diff --git a/src/check-drivername.pl b/src/check-drivername.pl index 5c8de0aa1..3a62193e3 100755 --- a/src/check-drivername.pl +++ b/src/check-drivername.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2013 Red Hat, Inc. # diff --git a/src/check-symfile.pl b/src/check-symfile.pl index d59a213eb..4f8830086 100755 --- a/src/check-symfile.pl +++ b/src/check-symfile.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (C) 2012-2013 Red Hat, Inc. # diff --git a/src/check-symsorting.pl b/src/check-symsorting.pl index 81265e04d..51e38bded 100755 --- a/src/check-symsorting.pl +++ b/src/check-symsorting.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (C) 2012-2013 Red Hat, Inc. # diff --git a/src/dtrace2systemtap.pl b/src/dtrace2systemtap.pl index 19d980564..92c76a66e 100755 --- a/src/dtrace2systemtap.pl +++ b/src/dtrace2systemtap.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2011-2012 Red Hat, Inc. # diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index e7a48d578..fb15cc484 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # # Copyright (C) 2010-2015 Red Hat, Inc. # @@ -32,6 +32,7 @@ # Extended by Matthias Bolte <matthias.bolte@googlemail.com> use strict; +use warnings; use Getopt::Long; diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 69d20a344..6ce268c02 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -1,3 +1,4 @@ +#!/usr/bin/env perl # # Generate code for an XDR protocol, optionally applying # fixups to the glibc rpcgen code so that it compiles diff --git a/src/rpc/gensystemtap.pl b/src/rpc/gensystemtap.pl index 7b80fbf83..c0d343509 100755 --- a/src/rpc/gensystemtap.pl +++ b/src/rpc/gensystemtap.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2011-2012 Red Hat, Inc. # diff --git a/tests/check-file-access.pl b/tests/check-file-access.pl index 0c75ae998..977a2bc53 100755 --- a/tests/check-file-access.pl +++ b/tests/check-file-access.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # # Copyright (C) 2016 Red Hat, Inc. # diff --git a/tests/oomtrace.pl b/tests/oomtrace.pl index 6d423e796..f799262f2 100755 --- a/tests/oomtrace.pl +++ b/tests/oomtrace.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; -- 2.13.5

This is particularly useful on operating systems that don't ship Python as part of the base system (eg. FreeBSD) while still working just as well as it did before on Linux. While at it, make it explicit that our scripts are only going to work with Python 2, and remove the usage of unbuffered I/O, which as far as I can tell has no effect on the output files. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/apibuild.py | 2 +- docs/index.py | 2 +- docs/reformat-news.py | 2 +- src/esx/esx_vi_generator.py | 2 +- src/hyperv/hyperv_wmi_generator.py | 2 +- tests/cputestdata/cpu-cpuid.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 87e81f5c3..a788086a6 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -u +#!/usr/bin/env python2 # # This is the API builder, it parses the C sources and build the # API formal description in XML. diff --git a/docs/index.py b/docs/index.py index 2f0ad2672..bedec8ae0 100755 --- a/docs/index.py +++ b/docs/index.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -u +#!/usr/bin/env python2 # # imports the API description and fills up a database with # name relevance to modules, functions or web pages diff --git a/docs/reformat-news.py b/docs/reformat-news.py index 39499d933..89f7ccb3d 100755 --- a/docs/reformat-news.py +++ b/docs/reformat-news.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # reformat-news.py: Reformat the NEWS file properly # diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index bc026bd71..a2b8bef72 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # # esx_vi_generator.py: generates most of the SOAP type mapping code diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py index 9c0accea0..b60335e26 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # # hyperv_wmi_generator.py: generates most of the WMI type mapping code diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 385d6d1a1..a2fd938c2 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python2 import sys import json -- 2.13.5

On 09/19/2017 01:09 PM, Andrea Bolognani wrote:
Changes from [v1]:
* fix all Perl scripts instead of a single one; * fix all Python scripts as well.
[v1] https://www.redhat.com/archives/libvir-list/2017-September/msg00504.html
Andrea Bolognani (2): perl: Don't hardcode interpreter path python: Don't hardcode interpreter path
build-aux/augeas-gentest.pl | 2 +- build-aux/check-spacing.pl | 2 +- build-aux/mock-noinline.pl | 2 +- build-aux/prohibit-duplicate-header.pl | 2 +- docs/apibuild.py | 2 +- docs/genaclperms.pl | 2 +- docs/hvsupport.pl | 2 +- docs/index.py | 2 +- docs/reformat-news.py | 2 +- src/access/genpolkit.pl | 2 +- src/check-aclperms.pl | 2 +- src/check-aclrules.pl | 2 +- src/check-driverimpls.pl | 2 +- src/check-drivername.pl | 2 +- src/check-symfile.pl | 2 +- src/check-symsorting.pl | 2 +- src/dtrace2systemtap.pl | 2 +- src/esx/esx_vi_generator.py | 2 +- src/hyperv/hyperv_wmi_generator.py | 2 +- src/rpc/gendispatch.pl | 3 ++- src/rpc/genprotocol.pl | 1 + src/rpc/gensystemtap.pl | 2 +- tests/check-file-access.pl | 2 +- tests/cputestdata/cpu-cpuid.py | 2 +- tests/oomtrace.pl | 2 +- 25 files changed, 26 insertions(+), 24 deletions(-)
ACK to both. Michal
participants (2)
-
Andrea Bolognani
-
Michal Privoznik