Perl / perl5

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

IO::File $fh->binmode($layer) is broken #7965

Closed p5pRT closed 20 years ago

p5pRT commented 20 years ago

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

Searchable as RT36237$

p5pRT commented 20 years ago

From alexander_foken@de.rolandberger.com

Created by alexander-foken@de.rolandberger.com

IO​::File​::binmode() fails to set any PerlIO layer\, because it tests @​_ for 0 or 1 elements\, but it is called as object method having always at least one element in @​_. With a LAYER argument\, @​_ has two elements and IO​::File​::binmode() croak()s.

Trivial patch​:

Inline Patch ```diff --- IO/File.pm-buggy Mon Jun 06 13:29:48 2005 +++ IO/File.pm Fri Jun 10 14:26:35 2005 @@ -197,7 +197,7 @@ ## sub binmode { - ( @_ == 0 or @_ == 1 ) or croak 'usage $fh->binmode([LAYER])'; + ( @_ == 1 or @_ == 2 ) or croak 'usage $fh->binmode([LAYER])'; my($fh, $layer) = @_; ```
Perl Info ``` Flags: category=library severity=low Site configuration information for perl v5.8.7: Configured by afoken at Mon Jun 6 13:30:23 2005. Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=MSWin32, osvers=5.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='12.00.8804', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\perl\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\perl\lib\CORE" -machine:x86' Locally applied patches: @INC for perl v5.8.7: c:/perl/lib c:/perl/site/lib . Environment for perl v5.8.7: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;d:\bin;c:\perl\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\UltraEdit;C:\VS6\Common\Tools\WinNT;C:\VS6\Common\MSDev98\Bin;C:\VS6\Common\Tools;C:\VS6\VC98\bin PERL_BADLANG (unset) SHELL (unset) -- ________________________________________ | *Alexander Foken* | IT Consultant | *Roland Berger Strategy Consultants* | .bits business intelligence and technology services | http://www.rolandberger.com | Stadthausbrücke 7 | 20355 Hamburg | Germany | Phone +49 40 3 76 31 351 | Fax +49 40 3 76 31 102 | mailto:Alexander_Foken@de.rolandberger.com Please inform us immediately if this e-mail and/or any attachment was transmitted incompletely or was not intelligible. ___________________________________________________________________________ This e-mail and any attachment is for authorized use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. ```
p5pRT commented 20 years ago

From @rgs

Alexander Foken wrote​:

IO​::File​::binmode() fails to set any PerlIO layer\, because it tests @​_ for 0 or 1 elements\, but it is called as object method having always at least one element in @​_. With a LAYER argument\, @​_ has two elements and IO​::File​::binmode() croak()s.

Trivial patch​:

Thanks\, applied as change #24869 to the development version of perl.

--- IO/File.pm-buggy Mon Jun 06 13​:29​:48 2005 +++ IO/File.pm Fri Jun 10 14​:26​:35 2005 @​@​ -197\,7 +197\,7 @​@​ ##

sub binmode { - ( @​_ == 0 or @​_ == 1 ) or croak 'usage $fh->binmode([LAYER])'; + ( @​_ == 1 or @​_ == 2 ) or croak 'usage $fh->binmode([LAYER])';

p5pRT commented 20 years ago

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

p5pRT commented 20 years ago

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