Front page | perl.perl5.porters |
Postings from July 2003
[perl #22977] Bug in format/write
Thread Previous
|
Thread Next
From:
Ruediger Schopper
Date:
July 14, 2003 11:42
Subject:
[perl #22977] Bug in format/write
Message ID:
rt-22977-60835.8.34802330452433@rt.perl.org
# New Ticket Created by Ruediger Schopper
# Please include the string: [perl #22977]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22977 >
Hi there,
I belive, that we've found a bug in perl. We discovered it when changing from
perl-5.4.4 to perl-5.8.0, where we got strange results with
write in a program we heavily used without problems.
We found, that write no longer use the actual values of the variables
but get stuck with those during the first call to write. This behaviour depends
on wether the writing subroutine ist declared or not.
A sample program would be:
==========================
1 #!/usr/lib/perl5/neu/usr-bin/perl -w
2
3 use strict;
4
5 sub show_woche (); # Comment out to get right result!
6
7 sub show_woche ()
8 { my $tag;
9 my $eintrag;
10 my $datum;
11
12 my @tag = (
13 [0 , [['a'], ['b']]],
14 [50000 , [['d'], ['e']]],
15 );
16
17 foreach $tag (@tag)
18 { my $eintrag_liste = $tag->[1];
19 $datum = $tag->[0];
20 foreach $eintrag (@{$eintrag_liste})
21 { my @test = ($datum, $eintrag->[0]);
22 #printf "%-8s %-10s\n", @test;
23 write;
24
25 format STDOUT =
26 @<<<<<<< @<<<<<<<<<<<<<<<<<<<<
27 @test
28 .
29 }
30 }
31 }
32
33 show_woche;
34
35 exit 0;
This gives the wrong output:
0 a
0 a
0 a
0 a
But when we comment out line 5 we get the right result:
0 a
0 b
50000 d
50000 e
The old (correct) version of perl is:
=====================================
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=linux, osvers=2.0.30, archname=i586-linux
uname='linux lar 2.0.30 #1 mon jun 9 14:40:34 mesz 1997 i686 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=n useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O2 -fomit-frame-pointer -pipe -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2', gccversion=2.7.2.2.f.2
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-L/usr/local/lib -s'
libpth=/usr/local/lib /shlib /lib /usr/lib
libs=-lgdbm -ldbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.4.33, so=so
useshrplib=true, libperl=libperl.so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/i586-linux/5.00404/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under linux
Compiled at Dec 4 1997 17:44:17
@INC:
/usr/lib/perl5/i586-linux/5.00404
/usr/lib/perl5
/usr/lib/perl5/site_perl/i586-linux
/usr/lib/perl5/site_perl
/usr/lib/perl5/i586-linux
.
The new (buggy) Version is:
===========================
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-pre5, archname=i686-linux
uname='linux lar 2.4.21-pre5 #1 smp thu feb 27 12:10:15 mez 2003 i686 '
config_args=''
hint=previous, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-fomit-frame-pointer -mcpu=athlon-mp -falign-loops=1 -falign-jumps=1 -falign-functions=1 -mpreferred-stack-boundary=2',
cppflags='-fno-strict-aliasing -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccversion='', gccversion='3.2.2', 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 ='-s'
libpth=/usr/i686-pc-linux-gnulibc2/lib /usr/i686-pc-linux-gnulibc2/local/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Mar 25 2003 10:46:58
@INC:
/usr/lib/perl5/5.8.0/i686-linux
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
.
Thanks in advance for any help you can give.
With best regards
RĂ¼diger Schopper
GPG/PGP-Key:
wwwkeys.pgp.net:11371/pks/lookup?op=vindex&search=0x97A5CFE9&fingerprint=on
Fingerprint = B44F 7109 A40F B383 AA1B 778D 43B9 767C 97A5 CFE9
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ _/
_/ (`-'-,-. _. _/
_/ '._ (_ '.__.-, _/
_/ .-;`-.-`_..-' _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ `\___-.(_ _/ _/
_/ _.) a'-._ _/ RĂ¼diger Schopper _/
_/ __ .' `\ _/ schopper@usm.uni-muenchen.de _/
_/ .' ` ._^/ _/ _/
_/ _..._.-' /`\ / _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ _.' \ / ) _/ _/
_/ (/ / ) |/ _/ The surest sign that intelli- _/
_/ | | / ;-. _/ gent life in universe exists _/
_/ ;\ /'-.__.| /-. \ _/ is that none of it has tried _/
_/ / ) / | | '.\ _/ to contact us ! _/
_/ / /| / \ | || _/ _/
_/ | / / / | | / | _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ || \ \ | | \_/ _/
_/ )_`\ )_`\ )_`\ _/
_/ `""` `""` `""` _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*** This message was entirely written with recycled electrons ***
Thread Previous
|
Thread Next