Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

@- Bug on the loose, lets isolate it

by davido (Cardinal)
on May 30, 2005 at 06:24 UTC ( [id://461653]=perlquestion: print w/replies, xml ) Need Help??

davido has asked for the wisdom of the Perl Monks concerning the following question:

Yesterday I was playing around with a little snippet, and uncovered a bug that results in the special array @- reporting a huge number of elements. After a little CB discussion, it seemed that this issue only affects some people, and some versions of Perl, built on some systems. (Is that vague enough?)

Here is a test snippet that will produce the bug -- that is, if it is going to manifest itself on your system. Give it a try and boggle at the output.

use strict; use warnings; my $string = "abc"; while( $string =~ /b/g ) { print $#-, "\n"; }

And the output...

22350300

Again, your mileage will vary. The output is different for everyone. Some people will correctly see '0', others will see some huge number. I see '22350300'. I'm using ActiveState Perl 5.8.6 on Win32.

I'm posting this as a SoPW because I'm interested in discovering a common thread between those who do see the behavior. I'd also be interested in hearing speculation (or definitive answers) as to what is going on here.


Dave

Replies are listed 'Best First'.
Re: @- Bug on the loose, lets isolate it
by K_M_McMahon (Hermit) on May 30, 2005 at 06:32 UTC
    I get it too.... 671334463

    UPDATE: I just tried running it again (as "C:\dl.pl") and I got 0. I kept getting 0 until I closed the cmd window and opened a new one. On the first run I got the same # as above, then on all subsequent runs I get 0. I tried this several times and kept getting the same result. I only see the Non-Zero result on the FIRST execution in a given cmd window.

    Also, I tried running it as "C:\perl dl.pl" and I get the 0 value even on the first run.

    I'm running ActiveState 5.8.6 on WinXP Home edition.

    -Kevin
    my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}

    Janitored by holli - changed pre to code, and added readmore tags

      Same thing here on a Win XP Pro with ActiveState Perl 5.8.6. I'd run the script from Vim and got a 22285804 but then, on a cmd window, I got a 0. My perl version:
      I get similar results under Windows NT 4 and Perl 5.8.0.
      The values are 23086867 for the first run, 23086364 for subsequent runs.


      holli, /regexed monk/
Re: @- Bug on the loose, lets isolate it
by Zaxo (Archbishop) on May 30, 2005 at 06:43 UTC

    I get 0 on both,

    $ uname -a Linux mercury 2.4.23 #1 Sat Jan 3 14:25:29 EST 2004 i686 unknown $ perl -v This is perl, v5.8.4 built for i686-linux
    and

    $ perl -v This is perl, v5.9.2 built for i686-linux-thread-multi-64int-ld
    on the same machine.

    The kernel and both perls were built from source.

    After Compline,
    Zaxo

Re: @- Bug on the loose, lets isolate it
by graff (Chancellor) on May 30, 2005 at 07:20 UTC
    Of the systems I've tried (macosx 10.3.9 w/perl 5.8.1; freebsd 5.4-STABLE/amd64 and 5.4-RC4/i386 both w/perl 5.8.6), the only one that came up with the right answer (0) was the amd64 box. Everywhere else, I got different values that are ridiculously large.

    When I added "$&" to the print statement, I always got the right answer, so I would assume the problem lies with the optimization that applies when "$&" is not used.

    Presumably, when perl compiles a script that does not use "$&", part of what is being optimized out involves allocating some resource that is needed to store or set @-.

    (updated to make last paragraph easier to read)

    Another update: after seeing davido's doubts about my conclusion, and even after replying to that, I have to admit he may have a point -- I tried one other mod to the OP script: add parens around "b" in the regex, and the problem goes away. So I'll guess that there is some logic that is invoked by the need to do a capture, or the need to handle $&, that will not be invoked when neither need arises, and (for some, maybe most, perl builds) this causes the problem with using @-. But that's just a guess, in hopes that it might help the perl source-code wonks to nail this thing.

      I'm not convinced that $& is involved, I think it's just another thing that can influence the bug indirectly. I can also alter the behavior by simply adding "print @-, $/;" before the while loop. And declaring a few more lexicals before the loop changes the number too.


      Dave

        Is "changing the number" different from "getting the right answer"? If I play with putting other references to "@-" in the script, I get way different behaviors too -- e.g.:
        #!/usr/bin/perl use strict; use warnings; my $string = "abc"; while( $string =~ /b/g ) { print "@-\n"; }
        produces:
        *** malloc_zone_malloc[14337]: argument too large: 4294967280 Out of +memory!
        Putting other kinds of references to @- before the loop still gives me a wrong answer.

        In my case, it seems like the only time I get the right output is when the script uses "$&" (update: I also get the right output when I use parens in the regex). Are you able to get a right answer without this?

        If you just get different wrong outputs, I'd say this would be expected from a bug that is probably causing some uninitialized memory location to be used the wrong way, and the value you get can vary depending on the instructions being compiled. What matters are the conditions that distinguish correct output from wrong output.

Re: @- Bug on the loose, lets isolate it
by strat (Canon) on May 30, 2005 at 06:32 UTC

    With ActivestatePerl 809 (5.8.3) the output is:

    0

    OS: XP Pro SP2

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: @- Bug on the loose, lets isolate it
by Popcorn Dave (Abbot) on May 30, 2005 at 06:45 UTC
    I'm getting 2228704 from a DOS shell, but from within my editor I'm getting 589833. Go figure.

    Version info: This is perl, v5.8.6 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail)

    Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.
Re: @- Bug on the loose, lets isolate it
by thor (Priest) on May 30, 2005 at 06:57 UTC
    I got 32.
    Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Platform: osname=linux, osvers=2.4.27-ti1211, archname=i386-linux-thread-mul +ti uname='linux kosh 2.4.27-ti1211 #1 sun sep 19 18:17:45 est 2004 i6 +86 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dccc +dlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/shar +e/perl/5.8 -Darchlib=/usr/lib/perl/5.8 -Dvendorprefix=/usr -Dvendorli +b=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/loca +l -Dsitelib=/usr/local/share/perl/5.8.4 -Dsitearch=/usr/local/lib/per +l/5.8.4 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 - +Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -D +man1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_c +sh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.4 -Dd_dosu +id -des' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemulti +plicity=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 -DTHREADS_HAVE_PIDS +-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURC +E -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN +-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3.5 (Debian 1:3.3.5-9)', gccosandvers= +'' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 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=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.s +o.5.8.4 gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' 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 Mar 8 2005 19:51:48 @INC: /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Re: @- Bug on the loose, lets isolate it
by monkfan (Curate) on May 30, 2005 at 07:04 UTC
    How serious/harmful is this bug? I get this:
    32
    Under:
    Linux localhost 2.6.8.1-12mdk #1 Fri Oct 1 12:53:41 CEST 2004 i686 Int +el(R) Pentium(R) 4 CPU 2.80GHz unknown GNU/Linux
    And:
    This is perl, v5.8.5 built for i386-linux-thread-multi (with 1 registered patch, see perl -V for more detail)
    Regards,
    Edward

      How serious/harmful is this bug?

      Well, I actually stumbled into it in this context:

      my $string = 'abc'; while( $string =~ /b/g ) { print "@-\n"; }

      Which is in and of itself pretty much useless code. However, what alerted me to the bug was that all of the sudden my script appeared to hang. My first thought was that I must be stuck in a loop, but quickly realized that I was experiencing Perl trying to interpolate a 2million element array full of 'undef' elements into a double-quoted string. It was chugging away, building this space-delimited string and presumably consuming more and more memory until I finally got tired of waiting and hit CTRL-C.

      The point is that this simple snippet could grind a system to a halt with all available memory consumed. Sure, it's a contrived example, but who wants Perl suddenly to create an array of millions of elements?


      Dave

Re: @- Bug on the loose, lets isolate it
by bobf (Monsignor) on May 30, 2005 at 07:15 UTC

    I get 2244604 on the first run, then 2244628 on all subsequent runs (within the same command window).

    This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Binary build 633 provided by ActiveState Corp. http://www.ActiveState. +com Built 21:33:05 Jun 17 2002

    I also checked $-[0] and the @+ array using this:

    use strict; use warnings; my $string = 'abc' x ( 3 ); while( $string =~ /b/g ) { print "$-[0], $#-, $+[0], $#+\n"; }

    Output:

    C:\>test.pl 1, 2244604, 2, 0 4, 2244604, 5, 0 7, 2244604, 8, 0 C:\>test.pl 1, 2244628, 2, 0 4, 2244628, 5, 0 7, 2244628, 8, 0 C:\>test.pl 1, 2244628, 2, 0 4, 2244628, 5, 0 7, 2244628, 8, 0 C:\>test.pl 1, 2244628, 2, 0 4, 2244628, 5, 0 7, 2244628, 8, 0

    Update: also tested on Red Hat Linux release 7.3 (OS 2.4.18-3):

    This is perl, v5.6.1 built for i386-linux [/d]$ perl test.pl 1, 56, 2, 0 4, 56, 5, 0 7, 56, 8, 0 [/d]$ perl test.pl 1, 56, 2, 0 4, 56, 5, 0 7, 56, 8, 0

Re: @- Bug on the loose, lets isolate it
by TedPride (Priest) on May 30, 2005 at 06:39 UTC
    MacPerl (5.6.1r1, Mac OS 9.2.2) gives 0. I'd test it in the native OS X Perl as well, but I don't feel like restarting atm.
Re: @- Bug on the loose, lets isolate it
by wfsp (Abbot) on May 30, 2005 at 07:19 UTC
    winXP home SP2 with
    v5.8.6 built for MSWin32-x86-multi-thread (with 3 registered patches)

    command line: 0
    within editor: 0

      same with 5.8.0 and XPpro.


      holli, /regexed monk/
Re: @- Bug on the loose, lets isolate it
by shibboleth (Novice) on May 30, 2005 at 07:38 UTC
    On ActiveState Perl v5.8.4 build #810 for MSWin32-x86-multi-thread, the code prints 1543569414 when I run it first, then 28281972, followed by many 0's. After several runs it printed: 0, 0, 28285736, 671333136, 0, 0, 0, 0..., 28285508, 1550450694. I'm running it within a command-line interpreter on an AMD64 Compaq R3140 laptop (but in 32-bit Windows), all in the same command-line window.

    Whether it prints 0 or a huge number seems quite random, but I noticed most of the numbers have some sort of pattern, i.e., 28281972 and 28285736, as well as 1543569414 and 1550450694. It appears to be based on timing. Running it in a for(0..100) loop, I prints 0's most of the time, but this time I it printed all 28294632's. Ran it inside a for(0..1000) loop and it printed one thousand 28276956's, and just now a thousand 1617166510's, and 671333136's. That's the second time it printed 671333136. The numbers I'm getting apparently always are 7 to 9 hexadecimal digits (except for 0, of course). Wild guess: is the array length overwritten with a memory address?

    Interesting bug, I hope someone finds an explanation. My Perl version:

    Update: changed PRE to CODE

    Update 2: On perl, v5.6.1 built for sun4-solaris-64int, it prints 0 most of the time but sometimes 5184 inside the interpreter. Inside tcsh with the command perl -e'$string="abc";while($string=~/b/g){print $#-,"\n"}', it consistently prints -13511196. However, adding use strict;use warnings;my $string=... consistently prints 0.

      I'm on the same platform -- least, I think I am -- but no bug. Output is zero. Here's output from perl -V I will compare yours and mine to see if there is some subtle difference. UPDATE: I cleaned up line breaks in Jeff's file and did diff on it between his and mine, but couldn't find any diff. Hm. Well, I tried...
      Hey everyone who's posting, I think it would be better if output from perl -V was posted in code tags. Then we could compare outputs using diff without having to fix unintended line breaks.

      ciao :)

Re: @- Bug on the loose, lets isolate it
by Ultra (Hermit) on May 30, 2005 at 09:27 UTC
    I quote from perlvar
    "@- $-[0] is the offset of the start of the last successful match. "$-["n"]" is the offset of the start of the substring matched by n-th subpattern, or undef if the subpattern did not match."

    So, in my understanding you really wanted to print $-[0] isn't it? You may run this:
    use strict; use warnings; my $string = "abc"; while( $string =~ /c/g ) { print "$-[0]\n"; }
    and get "2", and:
    use strict; use warnings; my $string = "abc"; while( $string =~ /c/g ) { print "@-\n"; }
    I get:
    Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. Use of uninitialized value in join or string at /tmp/bug1.pl line 7. 2

    Dodge This!
      I think the point is not what the @- array contains, but that it contains anything at all. The supplied regex doesn't do any capturing, so the @- array should be empty. What we're seeing is that perl is creating a very large array for no reason. Doing so takes time, thus slowing down programs where it shouldn't. That's a Bad Thing.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

        Good point :-)
        Dodge This!
        Both @- and @+ should contain at least one element each to show where the start and end of the match is. You're supposed to be able to derive $& from substr( ..., $-[0], $+[0] - $-[0] ).
Re: @- Bug on the loose, lets isolate it
by demerphq (Chancellor) on May 30, 2005 at 12:26 UTC

    Has this been perlbug'ed yet?

    ---
    $world=~s/war/peace/g

      Yes, I sent a bug report a few minutes ago on 5/30/05 at 10:53pm PDT. The ticket number is #36046.


      Dave

Re: @- Bug on the loose, lets isolate it
by PodMaster (Abbot) on May 30, 2005 at 09:44 UTC
    This bug is weird, and I only experience it with ActivePerl 5.6.1

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

    Janitored by holli - added readmore tags

Re: @- Bug on the loose, lets isolate it
by Anonymous Monk on May 30, 2005 at 07:19 UTC
    I got 32 as the output on Suse, Sles9 have perl 5.8 installed
OpenServer, Solaris 8, Activestate on Win2k
by jpeg (Chaplain) on May 30, 2005 at 08:27 UTC
    OpenServer 5.0.7, Solaris 8, and Activestate on Win32 all have the 'bad' results.

    SCO OpenServer 5.0.7:

    Win 2000, sp2:
    Another Win2000, sp2:

    Two Solaris 8 boxes:

    and another:

    What was OK:
    Slackware 9.1, perl 5.8.6
    Slackware 10.1, perl 5.8.6
    Debian Sarge/Alpha, perl 5.8.4

    --
    jpg
Re: @- Bug on the loose, lets isolate it
by wazoox (Prior) on May 30, 2005 at 10:05 UTC
    It gives me 134687888 on Linux some.host.com 2.4.19-16mdk #1 Fri Sep 20 18:15:05 CEST 2002 i686 unknown unknown GNU/Linux with the following perl :
    This is perl, v5.8.0 built for i386-linux-thread-multi

    But I got 0 on Linux another.host.com 2.6.9-5.0.3.EL.rootsmp #1 SMP Mon Mar 21 15:42:59 CET 2005 i686 i686 i386 GNU/Linux running the following perl:
    This is perl, v5.8.5 built for i386-linux-thread-multi

    The buggy one (Mandrake) is compiled with O3 optimization, the good one (RedHat) with O2 flag. That's the most signification difference I see at the moment.
bug present
by skx (Parson) on May 30, 2005 at 16:43 UTC
Re: @- Bug on the loose, lets isolate it
by fishbot_v2 (Chaplain) on May 30, 2005 at 12:40 UTC

    I don't think that I've seen these two platforms mentioned:

    => perl bug.pl 270064592 => perl -v This is perl, v5.8.6 built for cygwin-thread-multi-64int $ perl bug.pl 1936158313 $ perl -v This is perl, v5.8.0 built for OpenBSD.i386-openbsd

Re: @- Bug on the loose, lets isolate it
by nothingmuch (Priest) on May 30, 2005 at 12:55 UTC
    0 on 5.6.0 / aix 0 on 5.8.0 / aix-thread-multi 1073876696 on 5.6.1 / PA-RISC1.1-thread-multi 1073876880 on 5.6.1 / PA-RISC1.1-thread-multi 71041060 on 5.6.1 / i386-linux 0 on 5.8.0 / i386-linux-thread-multi 0 on 5.8.5 / i386-linux-thread-multi
    All our Suns have a perl too old to parse $#- (5.004_04), and our OSF box doesn't have perl at all...

    Update: I just noticed PA-RISC doesn't say what platform... They're HPUX 11s.

    -nuffin
    zz zZ Z Z #!perl
Re: @- Bug on the loose, lets isolate it
by RupertSw (Initiate) on May 30, 2005 at 13:19 UTC

    I've got yet another value:

    This is perl, v5.8.4 built for i386-linux-thread-multi

    This gives me a value of: -1208350152 with:

    use strict; use warnings; my $string = "abc"; while( $string =~ /b/g ) { print $#-, "\n"; }

    ... as posted

    Update: my perl -V is on my scratchpad

Re: @- Bug on the loose, lets isolate it
by displeaser (Hermit) on May 30, 2005 at 14:39 UTC
    Hi,

    I get 27728808 on every try. Shuting and shuuting down the cmd window & I still get the same results.

    I'm running Activestate 5.8.6 on Windows 2000 SP4.

    Detailed Perl config info follows:
    Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemulti +plicity=de fine useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D +_CONSOLE - DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT - +DPERL_IMPL ICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64 +', lseeksi ze=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -l +ibpath:"C: \Perl\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib + comdlg32 .lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uui +d.lib ws2_ 32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.l +ib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool +.lib comd lg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib + uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvc +rt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt: +ref,icf - libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL +_IMPLICIT_ CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 811 21540 Fix backward-compatibility issues in if.pm 23565 Wrong MANIFEST.SKIP Built under MSWin32 Compiled at Dec 13 2004 09:52:01 %ENV: PERL5LIB="C:\Program Files\ActiveState Perl Dev Kit 6.0\lib\" PERLDB_OPTS="RemotePort=127.0.0.1:2000" @INC: C:\Program Files\ActiveState Perl Dev Kit 6.0\lib\ C:/Perl/lib C:/Perl/site/lib .


    Displeaser
Re: @- Bug on the loose, lets isolate it
by omega_monk (Scribe) on May 30, 2005 at 16:31 UTC
    use strict; use warnings; my $string = "abc"; while( $string =~ /b/g ) { print $#-, "\n"; }
    First Time - Output is: 808482816

    Secind Time(and everytime after in the same command prompt session) - Output is: 262149

    Win2K SP4
    This is perl, v5.8.6 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail) Copyright 1987-2004, Larry Wall Binary build 811 provided by ActiveState Corp. http://www.ActiveState. +com ActiveState is a division of Sophos. Built Dec 13 2004 09:52:01 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
Re: @- Bug on the loose, lets isolate it
by Qiang (Friar) on May 30, 2005 at 17:43 UTC
    on debian and redhat
    
    #-------- debian unstable produces 32
    
    $ perl perlbug.pl 
    32
    
    $ uname -a
    Linux chill 2.6.10 #1 Wed Jan 19 13:46:26 EST 2005 i686 GNU/Linux
    
    $ perl -v
    This is perl, v5.8.4 built for i386-linux-thread-multi
    
    #----------- rh 7.2 produces 2
    
    $ perl perlbug.pl 
    2
    
    $ uname -a
    Linux cozy166 2.4.7-10 #1 Thu Sep 6 17:21:28 EDT 2001 i586 unknown
    
    $ perl -v
    This is perl, v5.8.6 built for i586-linux
    
    #---------- on another rh 9 produces 0
    
    $ perl perlbug.pl 
    0
    
    $ uname -a
    Linux dev 2.4.20-30.9smp #1 SMP Wed Feb 4 20:36:46 EST 2004 i686 i686 i386 GNU/Linux
    
    $ perl -v
    This is perl, v5.8.0 built for i386-linux-thread-multi
    (with 1 registered patch, see perl -V for more detail)
    
Re: @- Bug on the loose, lets isolate it
by Robertn (Hermit) on May 31, 2005 at 05:45 UTC
    This is perl, v5.8.4 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail) Binary build 810 provided by ActiveState Corp. http://www.ActiveState. +com Built Jun 1 2004 11:52:21 W2k w/sp4 C:\temp>test.pl 842037248 C:\temp>test.pl 786436 C:\temp>test.pl 786436 new window C:\temp>test.pl 842037248 C:\temp>test.pl 786436
    Your sole purpose in life maybe to serve as a warning to others.
Re: @- Bug on the loose, lets isolate it
by tfrayner (Curate) on May 30, 2005 at 13:41 UTC
    Hi,

    A couple of MacOSX perl versions here. First, the native perl which Apple ships. Script output = 1815050081;

    Now for a self-built version (perl 5.8.5), output = 74;

    Make of that what you will...

    Tim

Re: @- Bug on the loose, lets isolate it
by bibliophile (Prior) on May 30, 2005 at 14:50 UTC
    Three samples:
    -------------------------------------------------------- [david@localhost david]$ ./hmm.pl 32 [david@localhost david]$ perl -v This is perl, v5.8.3 built for i386-linux-thread-multi <snip> [david@localhost david]$ uname -a Linux localhost 2.6.3-7mdk #1 Wed Mar 17 15:56:42 CET 2004 i686 unknow +n unknown GNU/Linux ----------------------------------------------------------- C:\hmm>hmm.pl 0 C:\hmm>perl -v This is perl, v5.8.2 built for MSWin32-x86-multi-thread (with 25 registered patches, see perl -V for more detail) Copyright 1987-2003, Larry Wall Binary build 808 provided by ActiveState Corp. http://www.ActiveState. +com ActiveState is a division of Sophos. Built Dec 9 2003 10:19:40 --------------------------------------------------------- $ ./hmm.pl 0 [/users/dchriste] $ perl -v This is perl, v5.6.1 built for PA-RISC1.1 <snip> [/users/dchriste] $ uname -a HP-UX pls B.10.20 D 9000/847 411374231 64-user license
Re: @- Bug on the loose, lets isolate it
by davidj (Priest) on May 31, 2005 at 00:26 UTC
    I get it on my windows 2k machine with ActiveState perl 5.8.3

    I don't get it on my linux machines. All of them have the same kernel and Perl build:
    andromeda:davidj tmp > cat test.pl #!/usr/bin/perl # use strict; use warnings; my $string = "abc"; while( $string =~ /b/g ) { print $#-, "\n"; } andromeda:davidj tmp > ./test.pl 0 andromeda:davidj tmp > uname -a Linux andromeda 2.6.11-gentoo-r5 #3 Sun Apr 24 03:22:46 MDT 2005 i686 +Intel(R) Pentium(R) M processor 1.60GHz GenuineIntel GNU/Linuxandrome +da:davidj tmp > perl -V Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Platform: osname=linux, osvers=2.6.9-gentoo-r1, archname=i686-linux uname='linux livecd 2.6.9-gentoo-r1 #1 smp thu nov 25 03:43:53 utc + 2004 i686 intel(r) pentium(r) m processor 1.60ghz genuineintel gnuli +nux '
Re: @- Bug on the loose, lets isolate it
by demerphq (Chancellor) on Nov 22, 2006 at 12:27 UTC

    FYI: This is fixed in bleadperl (soon to be 5.10)

    ---
    $world=~s/war/peace/g

      Thanks demerphq: It's very nice of you to follow this up long after I thought it had been forgotten. And I'm glad to see it get fixed even if the potential for trouble was minor.


      Dave

Re: @- Bug on the loose, lets isolate it
by tinita (Parson) on May 30, 2005 at 13:57 UTC
    osname=linux, osvers=2.6.4, archname=i586-linux-thread-multi uname='linux d209 2.6.4 #1 smp thu mar 11 17:56:49 utc 2004 i686 i686 +i386 gnulinux '

    i get 32 as output
Re: @- Bug on the loose, lets isolate it
by mattr (Curate) on May 31, 2005 at 06:41 UTC
    Me too.
    23606924 Win98 $ uname -a CYGWIN_98-4.10 XXXX 1.5.11(0.116/4/2) 2004-09-04 23:17 i686 $ perl -v This is perl, v5.8.4 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail) Binary build 810 provided by ActiveState Corp. Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL +_IMPLICIT_ CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 810 22751 Update to Test.pm 1.25 21540 Fix backward-compatibility issues in if.pm Built under MSWin32 Built Jun 1 2004 11:52:21
Re: @- Bug on the loose, lets isolate it
by SolidState (Scribe) on Jun 01, 2005 at 14:31 UTC

    I got "0" using 3 different perl's:

    This is perl, v5.8.0 built for i386-linux-thread-multi This is perl, v5.8.6 built for i686-linux This is perl, v5.8.0 built for sun4-solaris

    The first 2 perl's are running on a dual-cpu Redhat-8 Linux machine, the last is running on a Sun-Solaris machine.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://461653]
Approved by jbrugger
Front-paged by jbrugger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-03-29 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found