From: Perl 5 Porters Date: Tue, 24 Dec 1996 23:25:00 +0000 (+1200) Subject: [inseparable changes from patch from perl5.003_15 to perl5.003_16] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7a4c00b4303a05a04564a03a88f4fa5c7a06a6e9;p=p5sagit%2Fp5-mst-13.2.git [inseparable changes from patch from perl5.003_15 to perl5.003_16] CORE PORTABILITY Subject: _13: patches for unicos/unicosmk Date: Fri, 20 Dec 1996 14:38:50 -0600 From: Dean Roehrich Files: Configure MANIFEST hints/unicos.sh hints/unicosmk.sh private-msgid: <199612202038.OAA22805@poplar.cray.com> LIBRARY AND EXTENSIONS Subject: Refresh IO to 1.14 From: Graham Barr Files: MANIFEST ext/IO/IO.xs ext/IO/README ext/IO/lib/IO/File.pm ext/IO/lib/IO/Handle.pm ext/IO/lib/IO/Pipe.pm ext/IO/lib/IO/Seekable.pm ext/IO/lib/IO/Select.pm ext/IO/lib/IO/Socket.pm t/lib/io_dup.t t/lib/io_pipe.t t/lib/io_sel.t t/lib/io_sock.t t/lib/io_tell.t t/lib/io_udp.t t/lib/io_xs.t OTHER CORE CHANGES Subject: Fix 'foreach(@ARGV) { while (<>) { push @p,$_ } }' From: Chip Salzenberg Files: cop.h pp_hot.c scope.c Subject: Eliminate warnings from C< undef $x; $x OP= "foo" > From: Chip Salzenberg Files: doop.c pp.c pp.h pp_hot.c Subject: Try again to improve method caching Date: Mon, 23 Dec 1996 20:13:56 -0500 (EST) From: Ilya Zakharevich Files: gv.c sv.c Msg-ID: <199612240113.UAA09487@monk.mps.ohio-state.edu> (applied based on p5p patch as commit 81c78688fe5c3927ad37ba29de14c86e38120317) Subject: Be more careful about 'o' magic memory management From: Chip Salzenberg Files: mg.c sv.c Subject: Fix bad pointer refs when localized object loses magic From: Chip Salzenberg Files: scope.c --- diff --git a/Changes b/Changes index 450c444..856a5b5 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,95 @@ releases.) ---------------- +Version 5.003_16 +---------------- + +This patch is all bug fixes, library updates, and documentation +updates. We'll get to 5.004 RSN, I promise. :-) + + CORE LANGUAGE CHANGES + + Title: "Fix closures that are not in subroutines" + From: Chip Salzenberg + Files: op.c + + CORE PORTABILITY + + Title: "_13: patches for unicos/unicosmk" + From: Dean Roehrich + Msg-ID: <199612202038.OAA22805@poplar.cray.com> + Date: Fri, 20 Dec 1996 14:38:50 -0600 + Files: Configure MANIFEST hints/unicos.sh hints/unicosmk.sh + + OTHER CORE CHANGES + + Title: "Fix 'foreach(@ARGV) { while (<>) { push @p,$_ } }'" + From: Chip Salzenberg + Files: cop.h pp_hot.c scope.c + + Title: "Eliminate warnings from C< undef $x; $x OP= "foo" >" + From: Chip Salzenberg + Files: doop.c pp.c pp.h pp_hot.c + + Title: "Try again to improve method caching" + From: Ilya Zakharevich + Msg-ID: <199612240113.UAA09487@monk.mps.ohio-state.edu> + Date: Mon, 23 Dec 1996 20:13:56 -0500 (EST) + Files: gv.c sv.c + + Title: "Be more careful about 'o' magic memory management" + From: Chip Salzenberg + Files: mg.c sv.c + + Title: "Fix bad pointer refs when localized object loses magic" + From: Chip Salzenberg + Files: scope.c + + LIBRARY AND EXTENSIONS + + Title: "Refresh CPAN to 1.09" + From: Andreas Koenig + Files: lib/CPAN.pm + + Title: "Refresh Net::Ping to 2.02" + From: Russell Mosemann + Files: lib/Net/Ping.pm + + Title: "Refresh IO to 1.14" + From: Graham Barr + Files: MANIFEST ext/IO/IO.xs ext/IO/README ext/IO/lib/IO/File.pm + ext/IO/lib/IO/Handle.pm ext/IO/lib/IO/Pipe.pm + ext/IO/lib/IO/Seekable.pm ext/IO/lib/IO/Select.pm + ext/IO/lib/IO/Socket.pm t/lib/io_dup.t t/lib/io_pipe.t + t/lib/io_sel.t t/lib/io_sock.t t/lib/io_tell.t + t/lib/io_udp.t t/lib/io_xs.t + + BUILD PROCESS AND UTILITIES + + Title: "Don't recurse into subdirs twice on 'make realclean'" + From: Chip Salzenberg + Files: Makefile.SH + + Title: "Use root EXTERN.h when compiling x2p/malloc.c." + From: Paul Marquess + Files: x2p/Makefile.SH + + Title: "Fix compilation errors when malloc.c used for x2p" + From: Robin Barker + Files: malloc.c + + DOCUMENTATION + + Title: "Edit INSTALL to describe new binary compat setup" + From: Chip Salzenberg + Files: INSTALL + + Title: "Update to perllocale.pod" + From: Jarkko Hietaniemi + Files: pod/perllocale.pod + + +---------------- Version 5.003_15 ---------------- diff --git a/Configure b/Configure index c5fe4a4..3ae746c 100755 --- a/Configure +++ b/Configure @@ -1644,6 +1644,7 @@ EOM $test -f /dnix && osname=dnix $test -f /lynx.os && osname=lynxos $test -f /unicos && osname=unicos && osvers=`$uname -r` + $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` $test -f /bin/mips && /bin/mips && osname=mips $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 diff --git a/MANIFEST b/MANIFEST index d256010..025bb2c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -108,6 +108,7 @@ ext/GDBM_File/typemap GDBM extension interface types ext/IO/IO.pm Top-level interface to IO::* classes ext/IO/IO.xs IO extension external subroutines ext/IO/Makefile.PL IO extension makefile writer +ext/IO/README IO extension maintenance notice ext/IO/lib/IO/File.pm IO::File extension Perl module ext/IO/lib/IO/Handle.pm IO::Handle extension Perl module ext/IO/lib/IO/Pipe.pm IO::Pipe extension Perl module @@ -257,6 +258,7 @@ hints/titanos.sh Hints for named architecture hints/ultrix_4.sh Hints for named architecture hints/umips.sh Hints for named architecture hints/unicos.sh Hints for named architecture +hints/unicosmk.sh Hints for named architecture hints/unisysdynix.sh Hints for named architecture hints/utekv.sh Hints for named architecture hints/uts.sh Hints for named architecture @@ -601,6 +603,7 @@ t/lib/getopt.t See if Getopt::Std and Getopt::Long works t/lib/hostname.t See if Sys::Hostname works t/lib/io_dup.t See if dup()-related methods from IO work t/lib/io_pipe.t See if pipe()-related methods from IO work +t/lib/io_sel.t See if select()-related methods from IO work t/lib/io_sock.t See if INET socket-related methods from IO work t/lib/io_taint.t See if the untaint method from IO works t/lib/io_tell.t See if seek()/tell()-related methods from IO work diff --git a/cop.h b/cop.h index c062dc6..543c039 100644 --- a/cop.h +++ b/cop.h @@ -105,13 +105,16 @@ struct block_loop { cx->blk_loop.next_op = cLOOP->op_nextop; \ cx->blk_loop.last_op = cLOOP->op_lastop; \ cx->blk_loop.iterlval = Nullsv; \ - cx->blk_loop.itervar = ivar; \ - if (ivar) \ - cx->blk_loop.itersave = *cx->blk_loop.itervar; + if (cx->blk_loop.itervar = (ivar)) \ + cx->blk_loop.itersave = SvREFCNT_inc(*cx->blk_loop.itervar); #define POPLOOP(cx) \ newsp = stack_base + cx->blk_loop.resetsp; \ - SvREFCNT_dec(cx->blk_loop.iterlval) + SvREFCNT_dec(cx->blk_loop.iterlval); \ + if (cx->blk_loop.itervar) { \ + SvREFCNT_dec(*cx->blk_loop.itervar); \ + *cx->blk_loop.itervar = cx->blk_loop.itersave; \ + } /* context common to subroutines, evals and loops */ struct block { diff --git a/doop.c b/doop.c index 836027e..33726bf 100644 --- a/doop.c +++ b/doop.c @@ -528,16 +528,20 @@ SV *right; register char *dc; STRLEN leftlen; STRLEN rightlen; - register char *lc = SvPV(left, leftlen); - register char *rc = SvPV(right, rightlen); + register char *lc; + register char *rc; register I32 len; I32 lensave; - char *lsave = lc; - char *rsave = rc; + char *lsave; + char *rsave; + if (sv == left && !SvOK(sv) && !SvGMAGICAL(sv) && SvTYPE(sv) <= SVt_PVMG) + sv_setpvn(sv, "", 0); /* avoid warning on &= etc. */ + lsave = lc = SvPV(left, leftlen); + rsave = rc = SvPV(right, rightlen); len = leftlen < rightlen ? leftlen : rightlen; lensave = len; - if (SvOK(sv)) { + if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) { dc = SvPV_force(sv, na); if (SvCUR(sv) < len) { dc = SvGROW(sv, len + 1); diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs index 3cc3518..a6eb075 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -203,6 +203,7 @@ int untaint(handle) SV * handle CODE: +#ifdef IOf_UNTAINT IO * io; io = sv_2io(handle); if (io) { @@ -210,9 +211,12 @@ untaint(handle) RETVAL = 0; } else { +#endif RETVAL = -1; errno = EINVAL; +#ifdef IOf_UNTAINT } +#endif OUTPUT: RETVAL diff --git a/ext/IO/README b/ext/IO/README new file mode 100644 index 0000000..e855afa --- /dev/null +++ b/ext/IO/README @@ -0,0 +1,4 @@ +This directory contains files from the IO distribution maintained by +Graham Barr . If you find that you have to modify +any files in this directory then please forward him a patch for only +the files in this directory. diff --git a/ext/IO/lib/IO/File.pm b/ext/IO/lib/IO/File.pm index 81d48b1..e44d77f 100644 --- a/ext/IO/lib/IO/File.pm +++ b/ext/IO/lib/IO/File.pm @@ -1,3 +1,5 @@ +# + package IO::File; =head1 NAME @@ -91,14 +93,11 @@ L Derived from FileHandle.pm by Graham Barr EFE. -=head1 REVISION - -$Revision: 1.5 $ - =cut require 5.000; -use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD); +use strict; +use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA); use Carp; use Symbol; use SelectSaver; @@ -110,7 +109,7 @@ require DynaLoader; @ISA = qw(IO::Handle IO::Seekable Exporter DynaLoader); -$VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/); +$VERSION = "1.06"; @EXPORT = @IO::Seekable::EXPORT; diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm index 7b8c709..59741c1 100644 --- a/ext/IO/lib/IO/Handle.pm +++ b/ext/IO/lib/IO/Handle.pm @@ -180,12 +180,11 @@ class from C and inherit those methods. Derived from FileHandle.pm by Graham Barr EFE -Version 1.1201 specialized from 1.12 for inclusion in Perl distribution - =cut require 5.000; -use vars qw($RCS $VERSION @EXPORT_OK $AUTOLOAD); +use strict; +use vars qw($VERSION @EXPORT_OK $AUTOLOAD @ISA); use Carp; use Symbol; use SelectSaver; @@ -193,8 +192,7 @@ use SelectSaver; require Exporter; @ISA = qw(Exporter); -$VERSION = "1.1201"; -$RCS = sprintf("%s", q$Revision: 1.15 $ =~ /([\d\.]+)/); +$VERSION = "1.14"; @EXPORT_OK = qw( autoflush @@ -244,6 +242,7 @@ sub AUTOLOAD { $constname =~ s/.*:://; my $val = constant($constname); defined $val or croak "$constname is not a valid IO::Handle macro"; + no strict 'refs'; *$AUTOLOAD = sub { $val }; goto &$AUTOLOAD; } @@ -270,16 +269,23 @@ sub new_from_fd { bless $fh, $class; } -# -# That an IO::Handle is being destroyed does not necessarily mean -# that the associated filehandle should be closed. This is because -# *FOO{FILEHANDLE} may by a synonym for *BAR{FILEHANDLE}. -# -# If this IO::Handle really does have the final reference to the -# given FILEHANDLE, then Perl will close it for us automatically. -# - sub DESTROY { + my ($fh) = @_; + + # During global object destruction, this function may be called + # on FILEHANDLEs as well as on the GLOBs that contains them. + # Thus the following trickery. If only the CORE file operators + # could deal with FILEHANDLEs, it wouldn't be necessary... + + if ($fh =~ /=FILEHANDLE\(/) { + local *TMP = $fh; + close(TMP) + if defined fileno(TMP); + } + else { + close($fh) + if defined fileno($fh); + } } ################################################ diff --git a/ext/IO/lib/IO/Pipe.pm b/ext/IO/lib/IO/Pipe.pm index 9ec8b64..34cb0da 100644 --- a/ext/IO/lib/IO/Pipe.pm +++ b/ext/IO/lib/IO/Pipe.pm @@ -4,7 +4,7 @@ package IO::Pipe; =head1 NAME -IO::Pipe - supply object methods for pipes +IO::pipe - supply object methods for pipes =head1 SYNOPSIS @@ -89,11 +89,7 @@ L =head1 AUTHOR -Graham Barr EFE - -=head1 REVISION - -$Revision: 1.7 $ +Graham Barr =head1 COPYRIGHT @@ -104,12 +100,13 @@ as Perl itself. =cut require 5.000; +use strict; use vars qw($VERSION); use Carp; use Symbol; require IO::Handle; -$VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/); +$VERSION = "1.08"; sub new { my $type = shift; @@ -165,9 +162,10 @@ sub reader { my $pid = $me->_doit(0,@_) if(@_); + close(${*$me}[1]); bless $me, ref($fh); - *{*$me} = *{*$fh}; # Alias self to handle - bless $fh; # Really wan't un-bless here + *{*$me} = *{*$fh}; # Alias self to handle + bless $fh, 'IO::Pipe::DeadEnd'; # Really wan't un-bless here ${*$me}{'io_pipe_pid'} = $pid if defined $pid; @@ -181,9 +179,10 @@ sub writer { my $pid = $me->_doit(1,@_) if(@_); + close(${*$me}[0]); bless $me, ref($fh); - *{*$me} = *{*$fh}; # Alias self to handle - bless $fh; # Really wan't un-bless here + *{*$me} = *{*$fh}; # Alias self to handle + bless $fh, 'IO::Pipe::DeadEnd'; # Really wan't un-bless here ${*$me}{'io_pipe_pid'} = $pid if defined $pid; diff --git a/ext/IO/lib/IO/Seekable.pm b/ext/IO/lib/IO/Seekable.pm index 8e0f87a..e8a9530 100644 --- a/ext/IO/lib/IO/Seekable.pm +++ b/ext/IO/lib/IO/Seekable.pm @@ -42,14 +42,11 @@ L Derived from FileHandle.pm by Graham Barr Ebodg@tiuk.ti.comE -=head1 REVISION - -$Revision: 1.5 $ - =cut require 5.000; use Carp; +use strict; use vars qw($VERSION @EXPORT @ISA); use IO::Handle qw(SEEK_SET SEEK_CUR SEEK_END); require Exporter; @@ -57,7 +54,7 @@ require Exporter; @EXPORT = qw(SEEK_SET SEEK_CUR SEEK_END); @ISA = qw(Exporter); -$VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/); +$VERSION = "1.06"; sub clearerr { @_ == 1 or croak 'usage: $fh->clearerr()'; diff --git a/ext/IO/lib/IO/Select.pm b/ext/IO/lib/IO/Select.pm index 845d6b2..dea684a 100644 --- a/ext/IO/lib/IO/Select.pm +++ b/ext/IO/lib/IO/Select.pm @@ -1,4 +1,8 @@ # IO::Select.pm +# +# Copyright (c) 1995 Graham Barr. All rights reserved. This program is free +# software; you can redistribute it and/or modify it under the same terms +# as Perl itself. package IO::Select; @@ -47,17 +51,30 @@ will be returned when an event occurs. C keeps these values in a cache which is indexed by the C of the handle, so if more than one handle with the same C is specified then only the last one is cached. +Each handle can be an C object, an integer or an array +reference where the first element is a C or an integer. + =item remove ( HANDLES ) Remove all the given handles from the object. This method also works by the C of the handles. So the exact handles that were added need not be passed, just handles that have an equivalent C +=item exists ( HANDLE ) + +Returns a true value (actually the handle itself) if it is present. +Returns undef otherwise. + +=item handles + +Return an array of all registered handles. + =item can_read ( [ TIMEOUT ] ) -Return an array of handles that are ready for reading. C is the maximum -amount of time to wait before returning an empty list. If C is -not given then the call will block. +Return an array of handles that are ready for reading. C is +the maximum amount of time to wait before returning an empty list. If +C is not given and any handles are registered then the call +will block. =item can_write ( [ TIMEOUT ] ) @@ -65,8 +82,8 @@ Same as C except check for handles that can be written to. =item has_error ( [ TIMEOUT ] ) -Same as C except check for handles that have an error condition, for -example EOF. +Same as C except check for handles that have an error +condition, for example EOF. =item count () @@ -74,12 +91,20 @@ Returns the number of handles that the object will check for when one of the C methods is called or the object is passed to the C is a static method, that is you call it with the package name -like C. C, C and C are either C or -C objects. C is optional and has the same effect as -before. +C