[libvirt] [ocaml PATCH 3/3] Fix shebang in perl scripts

Pino Toscano posted 3 patches 6 years, 5 months ago
[libvirt] [ocaml PATCH 3/3] Fix shebang in perl scripts
Posted by Pino Toscano 6 years, 5 months ago
Instead of hardcoding the location of perl (assuming it is installed in
/usr), use /usr/bin/env to run it, and thus picking it from $PATH.
This makes it possible to run these scripts also on installations with
perl in a different prefix than /usr.

Also, given that we want enable warnings on scripts, turn the -w
previously in shebang to explicit "use warnings;" in scripts which
didn't have it before.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
 libvirt/generator.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libvirt/generator.pl b/libvirt/generator.pl
index 490ef9a..e850500 100755
--- a/libvirt/generator.pl
+++ b/libvirt/generator.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 #
 # OCaml bindings for libvirt.
 # (C) Copyright 2007-2015 Richard W.M. Jones, Red Hat Inc.
@@ -26,6 +26,7 @@
 # Please read libvirt/README.
 
 use strict;
+use warnings;
 
 #----------------------------------------------------------------------
 
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [ocaml PATCH 3/3] Fix shebang in perl scripts
Posted by Richard W.M. Jones 6 years, 5 months ago
On Tue, Aug 20, 2019 at 03:44:56PM +0200, Pino Toscano wrote:
> Instead of hardcoding the location of perl (assuming it is installed in
> /usr), use /usr/bin/env to run it, and thus picking it from $PATH.
> This makes it possible to run these scripts also on installations with
> perl in a different prefix than /usr.
> 
> Also, given that we want enable warnings on scripts, turn the -w
> previously in shebang to explicit "use warnings;" in scripts which
> didn't have it before.
> 
> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
> ---
>  libvirt/generator.pl | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libvirt/generator.pl b/libvirt/generator.pl
> index 490ef9a..e850500 100755
> --- a/libvirt/generator.pl
> +++ b/libvirt/generator.pl
> @@ -1,4 +1,4 @@
> -#!/usr/bin/perl -w
> +#!/usr/bin/env perl
>  #
>  # OCaml bindings for libvirt.
>  # (C) Copyright 2007-2015 Richard W.M. Jones, Red Hat Inc.
> @@ -26,6 +26,7 @@
>  # Please read libvirt/README.
>  
>  use strict;
> +use warnings;

All seems very straightforward, ACK series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list