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

[ID 20010112.006] perl misreports error location

Thread Next
From:
shaleh
Date:
January 12, 2001 13:14
Subject:
[ID 20010112.006] perl misreports error location
Message ID:
E14HBWd-00018M-00@geisha.engr.valinux.com
This is a bug report for perl from shaleh@valinux.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]
#!/usr/bin/perl -w

use strict;

my %hash;

my $filename = 'foo.html';

if ($filename =~ m/\.gz$/) {
        # do something
} elsif ($hash{'key'} !~ m/foo/) {
        # do something else
}

$ perl /tmp/regex.pl 
Use of uninitialized value in pattern match (m//) at /tmp/regex.pl line 9.

note that line nine is the if() which is 100% valid.  The problem actually lies
on the elsif() line where an empty value is used as the left side of a regex
test.

Yes, this code is silly, but in a large script where one could assume that
'key' actually is in hash, this would not be as trivial.


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

Configured by bod at Fri Dec 29 18:36:20 EST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.18, archname=i386-linux
    uname='linux duende 2.2.18 #1 thu dec 28 14:51:40 est 2000 i686 unknown '
    config_args='-de -D prefix=/usr -D archname=i386-linux -D startperl=#!/usr/bin/perl-5.6 -D privlib=/usr/lib/perl5/5.6 -D archlib=/usr/lib/perl5/5.6/i386-linux -D sitelib=/usr/local/lib/site_perl -D man1dir=/usr/share/man/man1 -D man1ext=1p -D man3dir=/usr/share/man/man3 -D man3ext=3pm -D ccflags=-D_REENTRANT -DDEBIAN -DAPPLLIB_EXP="/usr/lib/perl5" -D optimize=-O2  -D cccdlflags=-fPIC -D d_dosuid=define -U usesfio -D d_csh=undef -D d_statblks=define -D i_db -D i_ndbm -U installusrbinperl -D pager=/usr/bin/pager -D perladmin=perl@packages.debian.org -D useshrplib -D libperl=libperl.so.5.6.0 -D vendorprefix=/usr -D vendorlib=/usr/lib/perl5/5.005 -D vendorarch=/usr/lib/perl5/5.005/i386-linux'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2 ', gccversion=2.95.2 20000220 (Debian GNU/Linux)
    cppflags='-D_REENTRANT -DDEBIAN -DAPPLLIB_EXP="/usr/lib/perl5" -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-D_REENTRANT -DDEBIAN -DAPPLLIB_EXP="/usr/lib/perl5" -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.2.so, so=so, useshrplib=true, libperl=libperl.so.5.6.0
  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.6.0:
    /usr/lib/perl5
    /usr/lib/perl5/5.6/i386-linux
    /usr/lib/perl5/5.6
    /usr/local/lib/site_perl/i386-linux
    /usr/local/lib/site_perl
    /usr/lib/perl5/5.005/i386-linux
    /usr/lib/perl5/5.005
    .

---
Environment for perl v5.6.0:
    HOME=/home2/shaleh
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    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