Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.9k stars 540 forks source link

PerlIO::scalar doesn't respect readonly-ness #8583

Closed p5pRT closed 18 years ago

p5pRT commented 18 years ago

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

Searchable as RT40267$

p5pRT commented 18 years ago

From blgl@hagernas.com

Created by blgl@hagernas.com

The example program below generates no errors or warnings and outputs "extra everything". (Yes\, this bug is a whopper.)

#! /usr/local/bin/perl use strict; use warnings; open(my $fh\,">"\,\undef)   or die "open​: $!"; print {$fh} "extra everything\n"   or die "print​: $!"; close($fh)   or die "close​: $!"; print undef;

Perl Info ``` Flags: category=core severity=high Site configuration information for perl v5.8.8: Configured by blgl at Fri Jun 9 19:26:53 CEST 2006. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=8.6.0, archname=darwin-thread- multi-64int-2level uname='darwin sunwukung.sth.ownit.se 8.6.0 darwin kernel version 8.6.0: tue mar 7 16:58:48 pst 2006; root:xnu-792.6.70.obj~1release_ppc power macintosh powerpc ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp - fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/ include', optimize='-Os', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp- precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/ usr/local/include' ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5247)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/ local/lib' libpth=/usr/local/lib /usr/lib libs=-lc perllibs=-lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/ usr/local/lib' Locally applied patches: @INC for perl v5.8.8: /usr/local/lib/perl5/5.8.8/darwin-thread-multi-64int-2level /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/darwin-thread- multi-64int-2level /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl . Environment for perl v5.8.8: DYLD_LIBRARY_PATH (unset) HOME=/Users/blgl LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/blgl/bin:/Users/blgl/bin/powerpc-apple-darwin:/usr/ local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin PERL_BADLANG (unset) SHELL=/bin/tcsh ```
p5pRT commented 18 years ago

From mjtg@cam.ac.uk

Bo Lindbergh (via RT) \perlbug\-followup@​perl\.org wrote

The example program below generates no errors or warnings and outputs "extra everything". (Yes\, this bug is a whopper.)

And anyone fixing this should deal with these variations​:

perl -wl open(my $fh\,">"\,\(!0))   or die "open​: $!"; print {$fh} "extra everything\n"   or die "print​: $!"; close($fh)   or die "close​: $!"; print !0; print !!0 __END__ extra everything

perl -wl my $x = \3.14; open(my $fh\,">"\,$x)   or die "open​: $!"; print {$fh} "extra everything\n"   or die "print​: $!"; close($fh)   or die "close​: $!"; print $$x; __END__ extra everything

Mike Guy

p5pRT commented 18 years ago

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

p5pRT commented 18 years ago

From @rgarcia

On 02/09/06\, via RT Bo Lindbergh \perlbug\-followup@​perl\.org wrote​:

The example program below generates no errors or warnings and outputs "extra everything". (Yes\, this bug is a whopper.)

#! /usr/local/bin/perl use strict; use warnings; open(my $fh\,">"\,\undef) or die "open​: $!"; print {$fh} "extra everything\n" or die "print​: $!"; close($fh) or die "close​: $!"; print undef;

Thanks for the report; I've fixed that in bleadperl by change #28798.

p5pRT commented 18 years ago

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