develooper Front page | perl.perl5.porters | Postings from July 2001

[ID 20010730.010] FETCH called twice with -T

Thread Next
From:
Abigail
Date:
July 30, 2001 13:09
Subject:
[ID 20010730.010] FETCH called twice with -T
Message ID:
20010730200527.8092.qmail@foad.org

This is a bug report for perl from abigail@foad.org,
generated with the help of perlbug 1.33 running under perl v5.7.2.


-----------------------------------------------------------------
[Please enter your report here]

Consider the following program:


    use strict;

    package Tie;

    sub TIESCALAR {
        my $class =  shift;
        my $arg   =  shift;

        bless \$arg => $class;
    }

    sub FETCH {
        print "Fetch called!\n";
    
        ${$_ [0]}
    }


    package main;

    tie my ($foo), Tie => shift;

    print $foo, "\n";
    print $foo, "\n";

    __END__

If run as

    perl -w program.pl snoopy

we get the expected output:

    Fetch called!
    snoopy
    Fetch called!
    snoopy


However, if we enable tainting, running the program as:

    perl -Tw program.pl snoopy

we get:

    Fetch called!
    Fetch called!
    snoopy
    Fetch called!
    snoopy


That is, the first time a tied scalar is fetched, it is fetched twice.
This happens in 5.7.2, 5.6.1 and 5.00503.

Normally, this isn't much of a problem, except in cases were FETCH has
side effects.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.7.2:

Configured by abigail at Mon Jul 30 21:24:42 MEST 2001.

Summary of my perl5 (revision 5.0 version 7 subversion 2) configuration:
  Platform:
    osname=linux, osvers=2.2.13, archname=i686-linux-64int
    uname='linux alexandra 2.2.13 #5 tue feb 8 15:37:54 est 2000 i686 unknown '
    config_args='-des -Dcf_email=abigail@foad.org -Dperladmin=abigail@foad.org -Doptimize=-g -Uinstallusrbinperl -Dprefix=/opt/devperl -Dusedevel -Duse64bitints'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-Wall -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-Wall -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.2 19991024 (release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define, bincompat5005=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.7.2:
    /home/abigail/Perl
    /home/abigail/Sybase
    /opt/devperl/lib/5.7.2/i686-linux-64int
    /opt/devperl/lib/5.7.2
    /opt/devperl/lib/site_perl/5.7.2/i686-linux-64int
    /opt/devperl/lib/site_perl/5.7.2
    /opt/devperl/lib/site_perl/5.7.0/i686-linux-64int
    /opt/devperl/lib/site_perl/5.7.0
    /opt/devperl/lib/site_perl/5.6.0/i686-linux-64int
    /opt/devperl/lib/site_perl/5.6.0
    /opt/devperl/lib/site_perl/5.5.650
    /opt/devperl/lib/site_perl/5.5.640
    /opt/devperl/lib/site_perl/5.00563
    /opt/devperl/lib/site_perl/5.00562
    /opt/devperl/lib/site_perl/5.00561
    /opt/devperl/lib/site_perl/5.00558
    /opt/devperl/lib/site_perl/5.00557
    /opt/devperl/lib/site_perl
    .

---
Environment for perl v5.7.2:
    HOME=/home/abigail
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/abigail/Lib:/usr/local/lib:/usr/lib:/lib:/usr/X11R6/lib:/opt/tcl/lib:/opt/tk/lib/tk8.0
    LOGDIR (unset)
    PATH=/home/abigail/Bin:/opt/perl/bin:/opt/tcl/bin:/opt/tk/bin:/usr/local/bin:/usr/local/X11/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/games:/opt/povray/bin:/opt/teTeX/bin/i686-pc-linux-gnu:/opt/python/bin:/opt/acrobat/bin
    PERL5LIB=/home/abigail/Perl:/home/abigail/Sybase
    PERLDIR=/opt/perl
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About