In testargs.t in Test::Harness, don't run a world-writable file.
authorNicholas Clark <nick@ccl4.org>
Tue, 12 Apr 2011 08:01:48 +0000 (09:01 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 13 Apr 2011 13:56:33 +0000 (14:56 +0100)
The test writes a file, then changes the mode, then executes it. The file needs
to be +x to be executable (on many platforms). The file will need to be +w to
be deletable on some platforms. But setting the file world writable just before
running it feels like a bad idea, given that the file's name is as predictable
as process IDs, as there's a race condition to break into the account running
perl's tests.

cpan/Test-Harness/t/testargs.t

index cfbdd58..4fba591 100644 (file)
@@ -59,7 +59,7 @@ sub make_shell_test {
         print $sh "#!$shell\n\n";
         print $sh "$^X '$test' \$*\n";
     }
-    chmod 0777, $script;
+    chmod 0775, $script;
     return unless -x $script;
     return [ shell => $script ];
 }