This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Net::Ping 500_ping_icmp.t: remove sudo code
authorDavid Mitchell <davem@iabyn.com>
Thu, 3 Nov 2016 11:06:25 +0000 (11:06 +0000)
committerDavid Mitchell <davem@iabyn.com>
Thu, 3 Nov 2016 11:13:28 +0000 (11:13 +0000)
Rcently this  test scipt had code added to it to attempt to re-run itself
as root by invoking 'sudo' rather rather than just skipping the ICMP ping
test.

This can the side-effects of:

* sudo sending a security alert email to the local root account;

* a script being run as root when a non-root user invokes 'make test',
  which might be considered antisocial;

* noise on stderr about sudo failing.

See http://nntp.perl.org/group/perl.perl5.porters/240707.

This commit just removes the sudo code and doesn't try to do anything
clever.

Porting/Maintainers.pl
dist/Net-Ping/t/500_ping_icmp.t
t/porting/customized.dat

index bfef42f..92e3179 100755 (executable)
@@ -898,7 +898,7 @@ use File::Glob qw(:case);
             qw(t/601_pod-coverage.t),
         ],
         'CUSTOMIZED'   => [
-            qw( t/000_load.t t/001_new.t t/010_pingecho.t ),
+            qw( t/000_load.t t/001_new.t t/010_pingecho.t t/500_ping_icmp.t),
         ],
 
     },
index 77085a2..a9175ba 100644 (file)
@@ -12,19 +12,10 @@ BEGIN {
   unless ($Config{d_getpbyname}) {
     plan skip_all => 'no getprotobyname';
   }
-  require Net::Ping;
-  if (!Net::Ping::_isroot()) {
-    my $file = __FILE__;
-    my $lib = $ENV{PERL_CORE} ? '-I../../lib' : '-Mblib';
-    # -n prevents from asking for a password. rather fail then
-    if (system("sudo -n \"$^X\" $lib $file") == 0) {
-      exit;
-    } else {
-      plan skip_all => 'no sudo/failed';
-    }
-  }
 }
 
+BEGIN {use_ok('Net::Ping')};
+
 SKIP: {
   skip "icmp ping requires root privileges.", 1
     if !Net::Ping::_isroot() or $^O eq 'MSWin32';
index bd67e0c..a5d757a 100644 (file)
@@ -49,6 +49,7 @@ Memoize cpan/Memoize/Memoize.pm 902092ff91cdec9c7b4bd06202eb179e1ce26ca2
 Net::Ping dist/Net-Ping/t/000_load.t deff5dc2ca54dae28cb19d3631427db127279ac2
 Net::Ping dist/Net-Ping/t/001_new.t 90c9d63509b3efc8941449fbd1ca8b807fa42040
 Net::Ping dist/Net-Ping/t/010_pingecho.t 2e7340ee0e9f6119b889016fc8b89e6bcd4a8fe2
+Net::Ping dist/Net-Ping/t/500_ping_icmp.t a003daa5eaf215e58234786bb1fbfbebf669bf44
 Pod::Checker cpan/Pod-Checker/t/pod/contains_bad_pod.xr 73538fd80dfe6e19ad561fe034009b44460208f6
 Pod::Checker cpan/Pod-Checker/t/pod/selfcheck.t 8ce3cfd38e4b9bcf5bc7fe7f2a14195e49aed7d8
 Pod::Checker cpan/Pod-Checker/t/pod/testcmp.pl a0cd5c8eca775c7753f4464eee96fa916e3d8a16