Change 19925 by [EMAIL PROTECTED] on 2003/07/02 08:40:36
FreeBSD $0 dance.
Affected files ...
... //depot/perl/pod/perlvar.pod#124 edit
... //depot/perl/t/op/magic.t#64 edit
Differences ...
==== //depot/perl/pod/perlvar.pod#124 (text) ====
Index: perl/pod/perlvar.pod
--- perl/pod/perlvar.pod#123~19888~ Mon Jun 30 00:24:18 2003
+++ perl/pod/perlvar.pod Wed Jul 2 01:40:36 2003
@@ -851,8 +851,10 @@
space occupied by the original C<$0>.
Note for BSD users: setting C<$0> does not completely remove "perl"
-from the ps(1) output. For example, setting C<$0> to C<"foobar"> will
-result in C<"perl: foobar (perl)">. This is an operating system feature.
+from the ps(1) output. For example, setting C<$0> to C<"foobar"> may
+result in C<"perl: foobar (perl)"> (whether both the C<"perl: "> prefix
+and the " (perl)" suffix are shown depends on your exact BSD variant
+and version). This is an operating system feature, Perl cannot help it.
In multithreaded scripts Perl coordinates the threads so that any
thread may modify its copy of the C<$0> and the change becomes visible
==== //depot/perl/t/op/magic.t#64 (xtext) ====
Index: perl/t/op/magic.t
--- perl/t/op/magic.t#63~19924~ Wed Jul 2 01:17:31 2003
+++ perl/t/op/magic.t Wed Jul 2 01:40:36 2003
@@ -300,8 +300,11 @@
};
my $ps = $mydollarzero->("x");
ok(!$ps # we allow that something goes wrong with the ps command
- # FreeBSD cannot get rid of the trailing " (perl)".
- || $ps =~ /^x\b/,
+ || $ps eq 'x'
+ # FreeBSD cannot get rid of both the leading "perl :"
+ # and the trailing " (perl)": some FreeBSD versions
+ # can get rid of the first one.
+ || ($^O eq 'freebsd' && $ps =~ m/^(?:perl: )? x (?:\(perl\))?$/)
'altering $0 is effective (testing with `ps`)');
} else {
skip("\$0 check only on Linux and FreeBSD") for 0, 1;
End of Patch.