Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of uninitialized value (array index reference) in FileCache.pm module at line 140 #7365

Closed
p5pRT opened this issue Jun 15, 2004 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 15, 2004

Migrated from rt.perl.org#30291 (status was 'resolved')

Searchable as RT30291$

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2004

From bbucklan@jpl-devvax.jpl.nasa.gov

This is a bug report for perl from bbucklan@​jpl-devvax.jpl.nasa.gov,
generated with the help of perlbug 1.34 running under perl v5.8.3.


By executing the perl script below with the -w flag option set,
the warning appears and shows there is an null value that is being
attempted to be compared with another value within FileCache.pm
@​ line 140. Further investigation revealed that the array value
$isopen{$file}->[2] within line 140 is null and appears that it
will always be null. The array value $isopen{$file}->[1] looks
like the proper value meant for the comparision "ne" logic. Since
the value $isopen{$file}->[2] appears to always be null, the code
within the if condition will never execute.

Test Script that generates the error​:

#!/dsw/perl-5.8.3/bin/perl -w

use FileCache;

&FileCache​::cacheout("any_file_test");
&FileCache​::cacheout("any_file_test");
&FileCache​::cacheout_close("any_file_test");



Flags​:
  category=library
  severity=low


Site configuration information for perl v5.8.3​:

Configured by pray at Sat Mar 6 11​:14​:20 PST 2004.

Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration​:
  Platform​:
  osname=solaris, osvers=2.9, archname=sun4-solaris
  uname='sunos fir 5.9 generic_112233-08 sun4u sparc sunw,sun-blade-1000 '
  config_args='-Dcc=/tps/bin/gcc -Dprefix=/dsw/perl-5.8.3'
  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=undef use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='/tps/bin/gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/tps/include -I/tps/include/libxml2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-g -O',
  cppflags='-DDEBUGGING -fno-strict-aliasing -I/tps/include -I/tps/include/libxml2'
  ccversion='', gccversion='3.3.3', gccosandvers='solaris2.9'
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='/tps/bin/gcc', ldflags ='-L/tps/lib -R/tps/lib '
  libpth=/tps/lib /usr/openwin/lib /usr/lib /usr/ccs/lib
  libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc
  perllibs=-lsocket -lnsl -ldl -lm -lc
  libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-fPIC', lddlflags='-G -L/tps/lib -R/tps/lib'

Locally applied patches​:
 


@​INC for perl v5.8.3​:
  /dsw/perl-5.8.3/lib/5.8.3/sun4-solaris
  /dsw/perl-5.8.3/lib/5.8.3
  /dsw/perl-5.8.3/lib/site_perl/5.8.3/sun4-solaris
  /dsw/perl-5.8.3/lib/site_perl/5.8.3
  /dsw/perl-5.8.3/lib/site_perl
  .


Environment for perl v5.8.3​:
  HOME=/home/bbucklan
  LANG=en_US.ISO8859-1
  LANGUAGE (unset)
  LC_COLLATE=en_US.ISO8859-1
  LC_CTYPE=en_US.ISO8859-1
  LC_MESSAGES=C
  LC_MONETARY=en_US.ISO8859-1
  LC_NUMERIC=en_US.ISO8859-1
  LC_TIME=en_US.ISO8859-1
  LD_LIBRARY_PATH=/sfoc/lib
  LOGDIR (unset)
  PATH=/harvest/solaris/Harvest/bin​:/usr/afsws/etc​:/usr/afsws/bin​:/sfoc/mcdm/​:/home/danafa/tdds/etc/bin​:/home/danafa/test_adump218​:/tps/java/bin​:/bin​:/usr/sbin​:/tps/bin​:/sfoc/bin​:/tps/SUNWspro/bin​:/usr/ccs/bin​:/usr/afsws/bin​:/usr/afsws/etc​:/usr/dt/bin​:/usr/openwin/bin​:/usr/local/bin​:/usr/local/sbin​:/usr/ucb​:.​:/harvest/sol8/Harvest/bin​:/home/bbucklan/bin​:/home/stagner/RegTest/bin​:/home/stagner/bin​:/home/bbucklan/TOOLS​:/tps/bin​:/usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/tcsh

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

From @mhx

On 2004-06-15, at 16​:55​:22 -0000, bbucklan@​jpl-devvax.jpl.nasa.gov (via RT) wrote​:

# New Ticket Created by bbucklan@​jpl-devvax.jpl.nasa.gov
# Please include the string​: [perl #30291]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org​:80/rt3/Ticket/Display.html?id=30291 >

This is a bug report for perl from bbucklan@​jpl-devvax.jpl.nasa.gov,
generated with the help of perlbug 1.34 running under perl v5.8.3.

-----------------------------------------------------------------
By executing the perl script below with the -w flag option set,
the warning appears and shows there is an null value that is being
attempted to be compared with another value within FileCache.pm
@​ line 140. Further investigation revealed that the array value
$isopen{$file}->[2] within line 140 is null and appears that it
will always be null. The array value $isopen{$file}->[1] looks
like the proper value meant for the comparision "ne" logic. Since
the value $isopen{$file}->[2] appears to always be null, the code
within the if condition will never execute.

Test Script that generates the error​:

#!/dsw/perl-5.8.3/bin/perl -w

use FileCache;

&FileCache​::cacheout("any_file_test");
&FileCache​::cacheout("any_file_test");
&FileCache​::cacheout_close("any_file_test");

Thank you for your report.

Your analysis was correct. The bug has been fixed by the following
change which has been commited to the development version of perl​:

Change 22971 by mhx@​mhx-r2d2 on 2004/06/22 21​:00​:10

  Adjust array index in FileCache.pm.
 
  Subject​: [perl #30291] Use of uninitialized value (array index reference) in FileCache.pm module at line 140
  From​: bbucklan@​jpl-devvax.jpl.nasa.gov (via RT) <perlbug-followup@​perl.org>
  Date​: 15 Jun 2004 16​:55​:22 -0000
  Message-ID​: <rt-3.0.9-30291-90552.18.5392299690759@​perl.org>

Affected files ...

... //depot/perl/lib/FileCache.pm#16 edit

Differences ...

==== //depot/perl/lib/FileCache.pm#16 (text) ====

@​@​ -138,7 +138,7 @​@​
  ( $mode !~ /^\s*(?​:&gt;&gt;|\+?&gt;|\+?&lt;|\|\-|)|\-\|\s*$/ );

  # Mode changed?
- if( $isopen{$file} && ($mode||'>') ne $isopen{$file}->[2] ){
+ if( $isopen{$file} && ($mode||'>') ne $isopen{$file}->[1] ){
  &cacheout_close($file, 1);
  }
 

Marcus

--
Fairy Tale, n.​:
  A horror story to prepare children for the newspapers.

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

@mhx - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Jun 22, 2004
@p5pRT
Copy link
Author

p5pRT commented Jun 27, 2004

From @nwc10

On Tue, Jun 22, 2004 at 11​:26​:08PM +0200, Marcus Holland-Moritz wrote​:

On 2004-06-15, at 16​:55​:22 -0000, bbucklan@​jpl-devvax.jpl.nasa.gov (via RT) wrote​:

Your analysis was correct. The bug has been fixed by the following
change which has been commited to the development version of perl​:

And will be in perl 5.8.5

Nicholas Clark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant