From 99b455e92cd42625814c8bfd1d47b28feb65fe35 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 7 Sep 2015 14:51:47 +0200 Subject: [PATCH 1/1] Use env to find script interpreters Sometimes, there is no /usr/bin/perl. --- contrib/deployment_generation/generate_random_deployment.pl | 3 ++- contrib/network_model/regression2.py | 2 +- examples/java/bittorrent/generate.py | 2 +- examples/msg/bittorrent/generate.py | 2 +- examples/msg/chord/generate.py | 2 +- examples/msg/kademlia/generate.py | 2 +- examples/platforms/conf/transform_optorsim_platform.pl | 3 ++- .../platforms/generation_scripts/generate_g5k_platform.pl | 3 ++- .../generation_scripts/generate_g5k_platform_cabinets.pl | 3 ++- examples/platforms/syscoord/generate_peer_platform.pl | 3 ++- src/smpi/fixsrc.pl | 2 +- tools/MSG_visualization/colorize.pl | 2 +- tools/MSG_visualization/trace2fig.pl | 4 +++- tools/cmake/Scripts/generate_memcheck_tests.pl | 3 ++- tools/cmake/Scripts/my_valgrind.pl | 4 +++- tools/cmake/Scripts/update_tesh.pl | 3 ++- tools/doxygen/index_create.pl | 4 +++- tools/doxygen/xbt_log_extract_hierarchy.pl | 2 +- tools/internal/generate-multi-jar.py | 2 +- tools/internal/spell_comments.pl | 3 ++- tools/normalize-pointers.py | 2 +- tools/stack-cleaner/as | 2 +- tools/stack-cleaner/clean-stack-filter | 5 +++-- tools/stack-cleaner/compiler-wrapper | 4 +++- tools/tesh/colorize.pl | 4 +++- 25 files changed, 45 insertions(+), 26 deletions(-) diff --git a/contrib/deployment_generation/generate_random_deployment.pl b/contrib/deployment_generation/generate_random_deployment.pl index b160b3f4ec..bd353fae3c 100755 --- a/contrib/deployment_generation/generate_random_deployment.pl +++ b/contrib/deployment_generation/generate_random_deployment.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2009, 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; sub melange { my $tableau=shift; diff --git a/contrib/network_model/regression2.py b/contrib/network_model/regression2.py index f314d9e50e..fc4e84ba7a 100755 --- a/contrib/network_model/regression2.py +++ b/contrib/network_model/regression2.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/java/bittorrent/generate.py b/examples/java/bittorrent/generate.py index d4ea09ee9e..155957fc08 100755 --- a/examples/java/bittorrent/generate.py +++ b/examples/java/bittorrent/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2013-2014. The SimGrid Team. # All rights reserved. diff --git a/examples/msg/bittorrent/generate.py b/examples/msg/bittorrent/generate.py index f3460bb3c9..7f0d6d455f 100755 --- a/examples/msg/bittorrent/generate.py +++ b/examples/msg/bittorrent/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2012, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/msg/chord/generate.py b/examples/msg/chord/generate.py index afc0ea9123..3b707ac48a 100755 --- a/examples/msg/chord/generate.py +++ b/examples/msg/chord/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011-2012, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/msg/kademlia/generate.py b/examples/msg/kademlia/generate.py index b47512022c..1b9526cefb 100755 --- a/examples/msg/kademlia/generate.py +++ b/examples/msg/kademlia/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2012, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/platforms/conf/transform_optorsim_platform.pl b/examples/platforms/conf/transform_optorsim_platform.pl index 7e5369af29..d2db4d946e 100644 --- a/examples/platforms/conf/transform_optorsim_platform.pl +++ b/examples/platforms/conf/transform_optorsim_platform.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; if($#ARGV!=0) { die "Usage: perl transfrom_optorsim_platform.pl \n"; diff --git a/examples/platforms/generation_scripts/generate_g5k_platform.pl b/examples/platforms/generation_scripts/generate_g5k_platform.pl index 023ffacc4f..048143fb8a 100755 --- a/examples/platforms/generation_scripts/generate_g5k_platform.pl +++ b/examples/platforms/generation_scripts/generate_g5k_platform.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; use Switch; my $toversion=3; diff --git a/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl b/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl index 220565087b..9f3818e845 100755 --- a/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl +++ b/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; use Switch; my $site=""; diff --git a/examples/platforms/syscoord/generate_peer_platform.pl b/examples/platforms/syscoord/generate_peer_platform.pl index a01bcebd1e..7b530e3ab2 100755 --- a/examples/platforms/syscoord/generate_peer_platform.pl +++ b/examples/platforms/syscoord/generate_peer_platform.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; my $toversion=3; my $nb_peer = $ARGV[0]; diff --git a/src/smpi/fixsrc.pl b/src/smpi/fixsrc.pl index 2bc55d93b1..8844d208c5 100755 --- a/src/smpi/fixsrc.pl +++ b/src/smpi/fixsrc.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. diff --git a/tools/MSG_visualization/colorize.pl b/tools/MSG_visualization/colorize.pl index b3c567189d..db2676b51e 100755 --- a/tools/MSG_visualization/colorize.pl +++ b/tools/MSG_visualization/colorize.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2005, 2007, 2010, 2014. The SimGrid Team. # All rights reserved. diff --git a/tools/MSG_visualization/trace2fig.pl b/tools/MSG_visualization/trace2fig.pl index cd23d39cec..2ac7c85a82 100755 --- a/tools/MSG_visualization/trace2fig.pl +++ b/tools/MSG_visualization/trace2fig.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2006-2007, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,8 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; + #use Data::Dumper; use XFig; use POSIX; diff --git a/tools/cmake/Scripts/generate_memcheck_tests.pl b/tools/cmake/Scripts/generate_memcheck_tests.pl index fc4fd61816..d37977aae5 100755 --- a/tools/cmake/Scripts/generate_memcheck_tests.pl +++ b/tools/cmake/Scripts/generate_memcheck_tests.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2012-2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; # input file = AddTest.txt diff --git a/tools/cmake/Scripts/my_valgrind.pl b/tools/cmake/Scripts/my_valgrind.pl index 073b4b8a07..3b273d5d61 100755 --- a/tools/cmake/Scripts/my_valgrind.pl +++ b/tools/cmake/Scripts/my_valgrind.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2012-2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,8 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; + my @argv = ("valgrind"); my $count = 0; diff --git a/tools/cmake/Scripts/update_tesh.pl b/tools/cmake/Scripts/update_tesh.pl index 7c340b4b5e..5e0a06d174 100755 --- a/tools/cmake/Scripts/update_tesh.pl +++ b/tools/cmake/Scripts/update_tesh.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2012, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; if($#ARGV!=1) { die "Usage: perl make_tesh.pl \n"; diff --git a/tools/doxygen/index_create.pl b/tools/doxygen/index_create.pl index f9f58d2953..7d23af0a58 100755 --- a/tools/doxygen/index_create.pl +++ b/tools/doxygen/index_create.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2005, 2012-2014. The SimGrid Team. # All rights reserved. @@ -6,6 +6,8 @@ # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. +use warnings; + ($#ARGV >= 1) or die "Usage: index_create.pl "; my($type) = ""; diff --git a/tools/doxygen/xbt_log_extract_hierarchy.pl b/tools/doxygen/xbt_log_extract_hierarchy.pl index 40f60ee650..ba13f8aac8 100755 --- a/tools/doxygen/xbt_log_extract_hierarchy.pl +++ b/tools/doxygen/xbt_log_extract_hierarchy.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2008, 2010, 2012-2014. The SimGrid Team. # All rights reserved. diff --git a/tools/internal/generate-multi-jar.py b/tools/internal/generate-multi-jar.py index c200c49e58..41ec224c1b 100755 --- a/tools/internal/generate-multi-jar.py +++ b/tools/internal/generate-multi-jar.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2013-2014. The SimGrid Team. # All rights reserved. diff --git a/tools/internal/spell_comments.pl b/tools/internal/spell_comments.pl index 5ab59587f4..7ff91da032 100755 --- a/tools/internal/spell_comments.pl +++ b/tools/internal/spell_comments.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2013-2015. The SimGrid Team. # All rights reserved. @@ -13,6 +13,7 @@ # Copyright 2003, Dan Kegel. Licensed under GPL. See the file ../COPYING for details. use strict; +use warnings; die "Please install iamerican to use that script." unless (-r "/usr/lib/ispell/american.hash"); diff --git a/tools/normalize-pointers.py b/tools/normalize-pointers.py index 04049fa48f..ba78a8078c 100755 --- a/tools/normalize-pointers.py +++ b/tools/normalize-pointers.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2013-2014. The SimGrid Team. # All rights reserved. diff --git a/tools/stack-cleaner/as b/tools/stack-cleaner/as index 1a66dd3798..46446cb3f0 100755 --- a/tools/stack-cleaner/as +++ b/tools/stack-cleaner/as @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # Wrapper around the real `as` which adds filtering capabilities. require "tempfile" diff --git a/tools/stack-cleaner/clean-stack-filter b/tools/stack-cleaner/clean-stack-filter index a2f91aa0ad..64e79903c5 100755 --- a/tools/stack-cleaner/clean-stack-filter +++ b/tools/stack-cleaner/clean-stack-filter @@ -1,9 +1,10 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Transform assembly in order to clean each stack frame for X86_64. use strict; -$SIG{__WARN__} = sub { die @_ }; +use warnings; +$SIG{__WARN__} = sub { die @_ }; # Whether we are still scanning the content of a function: our $scanproc = 0; diff --git a/tools/stack-cleaner/compiler-wrapper b/tools/stack-cleaner/compiler-wrapper index 8b8a62f5fd..62504af416 100755 --- a/tools/stack-cleaner/compiler-wrapper +++ b/tools/stack-cleaner/compiler-wrapper @@ -1,7 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Compiler wrapper with stack-cleaner support (enabled by default). # Usage: ./compiler-wrapper target-compiler args [-f[no-]stack-cleaner] +use warnings; + use File::Basename; my $compiler = shift(@ARGV); diff --git a/tools/tesh/colorize.pl b/tools/tesh/colorize.pl index 9cc8d183c9..88b1f55e86 100755 --- a/tools/tesh/colorize.pl +++ b/tools/tesh/colorize.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2010, 2014. The SimGrid Team. # All rights reserved. @@ -6,6 +6,8 @@ # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. +use warnings; + use Term::ANSIColor qw{:constants}; $Term::ANSIColor::AUTORESET = 1; -- 2.20.1