Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #16206] $0 in 5.8

2 views
Skip to first unread message

Abigail

unread,
Aug 14, 2002, 10:27:12 AM8/14/02
to perl5-...@perl.org
On Wed, Aug 14, 2002 at 10:41:32AM -0000, J. Waalboer wrote:
> # New Ticket Created by "J. Waalboer"
> # Please include the string: [perl #16206]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=16206 >
>
>
> To: per...@perl.org
> Subject: $0 stopped working
> Message-Id: <5.8.0_827_1029327302@atlas>
>
> This is a bug report for perl from ju...@atlas.wifi.juerd.net,
> generated with the help of perlbug 1.34 running under perl v5.8.0.
>
>
> -----------------------------------------------------------------
> [Please enter your report here]
> Setting $0 doesn't change anything anymore. With 5.6.1, it does work, but
> with 5.8.0 it does not.
>
> $0 = 'foo';

What exactly do you mean?

$ perl -wle 'print $]; print $0; $0 = "foo"; print $0'
5.008
-e
foo
$


Abigail

Mark-Jason Dominus

unread,
Aug 14, 2002, 10:29:53 AM8/14/02
to Abigail, perl5-...@perl.org, m...@plover.com

> > Setting $0 doesn't change anything anymore. With 5.6.1, it does work, but
> > with 5.8.0 it does not.
> >
> > $0 = 'foo';
>
> What exactly do you mean?

Perhaps what he means is that it no longer changes the output of 'ps',
even on platforms where that is possible.

Slaven Rezic

unread,
Aug 14, 2002, 1:36:03 PM8/14/02
to Mark-Jason Dominus, Abigail, perl5-...@perl.org
Mark-Jason Dominus <m...@plover.com> writes:

My "ps a" output seems to look OK:

20439 p0 S+ 0:00,01 foo (perl5.8.0)

This is with FreeBSD 4.6, perl 5.8.0.

Regards,
Slaven

--
Slaven Rezic - slaven...@berlin.de

tktimex - project time manager
http://sourceforge.net/projects/ptktools/

Fletch

unread,
Aug 14, 2002, 2:03:38 PM8/14/02
to slaven...@berlin.de, Mark-Jason Dominus, Abigail, perl5-...@perl.org
>>>>> "Slaven" == Slaven Rezic <slaven...@berlin.de> writes:

[...]

>> Perhaps what he means is that it no longer changes the output
>> of 'ps', even on platforms where that is possible.
>>

Slaven> My "ps a" output seems to look OK:

Slaven> 20439 p0 S+ 0:00,01 foo (perl5.8.0)

Slaven> This is with FreeBSD 4.6, perl 5.8.0.


I just tried on a RedHat 7.3 box. It (the process name as ps
sees it) changes with 5.6.1, but not with 5.8.0:

lemur:~/tmp/src 512> perl5.8.0 -wle 'print $]; print $0; $0 = "foo"; print $0; sleep 50' & ps_re foo
5.008
[1] 3223
-e
foo
fletch 3223 0.0 0.2 2948 1208 pts/1 SN 13:57 0:00 perl5.8.0 -wle print $]; print $0; $0 = "foo"; print $0; sleep 50

lemur:~/tmp/src 515> perl5.6.1 -wle 'print $]; print $0; $0 = "foo"; print $0; sleep 50' & ps_re foo
5.006001
-e
foo
[1] 3229
fletch 3229 0.0 0.2 2528 1028 pts/1 SN 13:57 0:00 foo


perl -v output for completeness' sake:

Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
Platform:
osname=linux, osvers=2.4.18, archname=i686-linux-thread-multi
uname='linux lemur.e-centre.net 2.4.18 #5 thu apr 25 23:47:12 edt 2002 i686 unknown '
config_args='-Dperlmaintainer=fletch%stayonline.net -Dprefix=/usr -Duseithreads -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.3 2.96-110)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Jul 18 2002 21:25:36
@INC:
/usr/lib/perl5/5.8.0/i686-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
.

--
Fletch | "If you find my answers frightening, __`'/|
fle...@phydeaux.org | Vincent, you should cease askin' \ o.O'
770 933-0600 x211(w) | scary questions." -- Jules =(___)=
770 294-0820 (m) | U

Nicholas Clark

unread,
Aug 17, 2002, 9:57:40 AM8/17/02
to Fletch, slaven...@berlin.de, Mark-Jason Dominus, Abigail, perl5-...@perl.org
On Wed, Aug 14, 2002 at 02:03:38PM -0400, Fletch wrote:

> >> Perhaps what he means is that it no longer changes the output
> >> of 'ps', even on platforms where that is possible.
> >>
>
> Slaven> My "ps a" output seems to look OK:
>
> Slaven> 20439 p0 S+ 0:00,01 foo (perl5.8.0)
>
> Slaven> This is with FreeBSD 4.6, perl 5.8.0.
>
>
> I just tried on a RedHat 7.3 box. It (the process name as ps
> sees it) changes with 5.6.1, but not with 5.8.0:
>
> lemur:~/tmp/src 512> perl5.8.0 -wle 'print $]; print $0; $0 = "foo"; print $0; sleep 50' & ps_re foo
> 5.008
> [1] 3223
> -e
> foo
> fletch 3223 0.0 0.2 2948 1208 pts/1 SN 13:57 0:00 perl5.8.0 -wle print $]; print $0; $0 = "foo"; print $0; sleep 50
>
> lemur:~/tmp/src 515> perl5.6.1 -wle 'print $]; print $0; $0 = "foo"; print $0; sleep 50' & ps_re foo
> 5.006001
> -e
> foo
> [1] 3229
> fletch 3229 0.0 0.2 2528 1028 pts/1 SN 13:57 0:00 foo

Both replicatable. Linux no longer changes:

$ perl5.6.1 -lwe '$0 = "Hello world"; undef $/; $_=<>; print foreach split /\0/' /proc/self/cmdline
Hello world
$ perl5.8.0 -lwe '$0 = "Hello world"; undef $/; $_=<>; print foreach split /\0/' /proc/self/cmdline
perl5.8.0
-lwe
$0 = "Hello world"; undef $/; $_=<>; print foreach split /\0/
/proc/self/cmdline
$ uname -a
Linux Bagpuss.unfortu.net 2.4.18-rmk7 #10 Sun Jun 23 21:43:05 BST 2002 armv4l unknown

FreeBSD changes:

$ perl5.6.1-Os -lwe '$0 = "Hello world"; undef $/; $_=<>; print foreach split /\0/' /proc/curproc/cmdline
Hello world
$ perl5.8.0 -lwe '$0 = "Hello world"; undef $/; $_=<>; print foreach split /\0/' /proc/curproc/cmdline
Hello world
$ uname -a
FreeBSD thinking-cap.moo 4.6-RELEASE FreeBSD 4.6-RELEASE #0: Sat Jul 13 18:39:23 GMT 2002 ni...@thinking-cap.moo:/usr/local/obj/usr/src/sys/THINKINGCAP i386


Nicholas Clark
--
Even better than the real thing: http://nms-cgi.sourceforge.net/

Slaven Rezic

unread,
Aug 17, 2002, 3:08:04 PM8/17/02
to Nicholas Clark, Fletch, Mark-Jason Dominus, Abigail, perl5-...@perl.org
Nicholas Clark <ni...@unfortu.net> writes:

From looking at the source code, it seems to be broken on all non-BSD
platforms (*BSD has setproctitle). Former perl's just set argv and
argc to PL_origargv and PL_origargc while perl 5.8.0 *copies* argv and
argc, so changing PL_origargv does not change the original argv. See
the relevant lines on top of perl_parse() in perl.c. I'm not sure how
to fix this: should a new global PL_orig_origargv be invented which is
not copied but set? Why is the copy necessary at all?

Regards,
Slaven

--
Slaven Rezic - slaven...@berlin.de

Tk-AppMaster: a perl/Tk module launcher designed for handhelds
http://tk-appmaster.sf.net

Slaven Rezic

unread,
Aug 17, 2002, 3:32:37 PM8/17/02
to Nicholas Clark, Fletch, Mark-Jason Dominus, Abigail, perl5-...@perl.org
Nicholas Clark <ni...@unfortu.net> writes:

No fix of the problem, but here's an additional test case for
t/op/magic.t. This is only for Linux and FreeBSD, please add the
proper test for your favorite OS.

--- t/op/magic.t.orig Sat Aug 17 21:14:05 2002
+++ t/op/magic.t Sat Aug 17 21:21:51 2002
@@ -36,7 +36,7 @@
return 1;
}

-print "1..46\n";
+print "1..47\n";

$Is_MSWin32 = $^O eq 'MSWin32';
$Is_NetWare = $^O eq 'NetWare';
@@ -235,7 +235,7 @@
ok $^T > 850000000, $^T;

if ($Is_VMS || $Is_Dos || $Is_MacOS) {
- skip("%ENV manipulations fail or aren't safe on $^O") for 1..2;
+ skip("%ENV manipulations fail or aren't safe on $^O") for 1..3;
}
else {
$PATH = $ENV{PATH};
@@ -253,6 +253,15 @@
# -- Nikola Knezevic
ok ($Is_MSWin32 ? (`set __NoNeSuCh` =~ /^(?:__NoNeSuCh=)?foo$/)
: (`echo \$__NoNeSuCh` eq "foo\n") );
+ if ($^O =~ /^(linux|freebsd)$/ &&
+ open CMDLINE, "/proc/$$/cmdline") {
+ chomp(my $line = scalar <CMDLINE>);
+ my $me = (split /\0/, $line)[0];
+ ok($me eq $0);
+ close CMDLINE;
+ } else {
+ skip("\$0 check only on Linux and FreeBSD with /proc");
+ }
}

{

h...@crypt.org

unread,
Aug 21, 2002, 10:13:17 PM8/21/02
to slaven...@berlin.de, sch...@pobox.com, perl5-...@perl.org
Slaven Rezic <slaven...@berlin.de> wrote:
:No fix of the problem, but here's an additional test case for

:t/op/magic.t. This is only for Linux and FreeBSD, please add the
:proper test for your favorite OS.

Thanks, applied with modifications as #17748. Please submit failing
tests as TODO tests.

As I understand it, Schwern is working on a harness for testing
TODO tests, so sometime soon we should be better placed to take
advantage of them. Msg MGS? :)

Hugo

Chromatic

unread,
Aug 22, 2002, 12:23:23 AM8/22/02
to perl5-...@perl.org
On Wed, 21 Aug 2002 19:13:17 -0700, hv wrote:

> As I understand it, Schwern is working on a harness for testing TODO tests, so
> sometime soon we should be better placed to take advantage of them. Msg MGS?
> :)

The Test::Harness in bleadperl right now handles TODO tests just fine. If they
fail, they're counted as successes. If they pass, they're reported as
unexpected successes. Feel free to take advantage of them now.

This is not to discount an evil plan Schwern has not yet revealed to me,
however.

-- c

h...@crypt.org

unread,
Aug 22, 2002, 9:06:35 AM8/22/02
to chromatic, perl5-...@perl.org
chromatic <chro...@rmci.net> wrote:
:The Test::Harness in bleadperl right now handles TODO tests just fine. If they

:fail, they're counted as successes. If they pass, they're reported as
:unexpected successes. Feel free to take advantage of them now.
:
:This is not to discount an evil plan Schwern has not yet revealed to me,
:however.

The evil plan is to add a mechanism to get a todo list out of this,
rather than only to get warnings of things unexpectedly todone.

Hugo

Yitzchak Scott-Thoennes

unread,
Aug 29, 2002, 9:09:21 PM8/29/02
to perl5-...@perl.org, sch...@pobox.com

Seems to me I've seen a number of tests that are TODO'd because of
a problem with a specific platform out of our control. When the
evil plan turns these up, they should probably be converted to skips
(only for places where they fail, of course).

For ease of conversion it would be nice to have a global $SKIP like the
global $TODO. For example see run/switches.t (which uses test.pl, not
Test::xxx, so $SKIP would have to work there, too).

Query: should RT ignore or recognize the bug number in the Subject above?

Robert Spier

unread,
Aug 30, 2002, 12:31:17 AM8/30/02
to Yitzchak Scott-Thoennes, perl5-...@perl.org, sch...@pobox.com
>Query: should RT ignore or recognize the bug number in the Subject
>above?

Should? Good question.

Will it? Yes.

Making it not recognize it will not be simple - there are too many
variations on what people do to subject lines - and I don't think it's
safe to try and extract a \(was: .+\) block.

-R

Michael G Schwern

unread,
Aug 30, 2002, 2:53:43 AM8/30/02
to Yitzchak Scott-Thoennes, perl5-...@perl.org
On Thu, Aug 29, 2002 at 06:09:21PM -0700, Yitzchak Scott-Thoennes wrote:
> >The evil plan is to add a mechanism to get a todo list out of this,
> >rather than only to get warnings of things unexpectedly todone.
>
> Seems to me I've seen a number of tests that are TODO'd because of
> a problem with a specific platform out of our control. When the
> evil plan turns these up, they should probably be converted to skips
> (only for places where they fail, of course).

TODOs are for bugs, whether they're our bugs or not. SKIPs are for features
that are never supposed to work.

If we're working around someone else's bug it will be nice to know when
they've fixed that bug.


> For ease of conversion it would be nice to have a global $SKIP like the
> global $TODO. For example see run/switches.t (which uses test.pl, not
> Test::xxx, so $SKIP would have to work there, too).

There's no conversion necessary and the particular library which the test
uses doesn't matter. It all happens after the test is run "merely" by
changing how Test::Harness wants to interpret the results.

I'm dragging my feet on implementing this because T::H is still internally
in a state of flux.


--

Michael G. Schwern <sch...@pobox.com> http://www.pobox.com/~schwern/
Perl Quality Assurance <per...@perl.org> Kwalitee Is Job One
I have this god-awful need to aquire useless crap!!!

0 new messages