In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/ae073b6b0ee43101d6f58b772fe59ff4f3a2df20?hp=04bd4d55d67e0cb42723ce2f11fb1a1cf3c4a0e2>
- Log ----------------------------------------------------------------- commit ae073b6b0ee43101d6f58b772fe59ff4f3a2df20 Author: Father Chrysostomos <[email protected]> Date: Fri Apr 20 14:44:04 2012 -0700 perl5160delta: Shrink tie bug fix section The av_reify bug doesnât need to be mentioned, as it only affects debugging builds. M Porting/perl5160delta.pod commit e45e64879bcad15394226705d22b531eb4c1d5f6 Author: Father Chrysostomos <[email protected]> Date: Fri Apr 20 14:32:03 2012 -0700 perl5160delta: Move one more -l bug to the ft section M Porting/perl5160delta.pod commit 977d6e9a5fa7cfc87a9d2c2742d8e07fa1fd76ca Author: Father Chrysostomos <[email protected]> Date: Fri Apr 20 14:30:48 2012 -0700 perl5160delta: New secton for tie bugs M Porting/perl5160delta.pod commit 2f2cde2e2713e9d6872e7f5f3ca060b3ede32146 Author: Father Chrysostomos <[email protected]> Date: Fri Apr 20 14:20:45 2012 -0700 perl5160delta: Section for vstring & ver obj fixes M Porting/perl5160delta.pod commit 4d8a5d3f973fbe141170de89d09d4aa693c32be9 Author: Father Chrysostomos <[email protected]> Date: Fri Apr 20 14:11:42 2012 -0700 perl5160delta: Misc tweaks M Porting/perl5160delta.pod commit 5d27fa85da9882ef2527fdf1ccaca5c2e0ea30c8 Author: Father Chrysostomos <[email protected]> Date: Fri Apr 20 14:01:02 2012 -0700 perl5160delta: Finish rewriting stat/filetest section M Porting/perl5160delta.pod ----------------------------------------------------------------------- Summary of changes: Porting/perl5160delta.pod | 423 ++++++++++++++++++++------------------------- 1 files changed, 190 insertions(+), 233 deletions(-) diff --git a/Porting/perl5160delta.pod b/Porting/perl5160delta.pod index cf22e96..17b3ab6 100644 --- a/Porting/perl5160delta.pod +++ b/Porting/perl5160delta.pod @@ -1957,8 +1957,6 @@ XXX That section is empty. =head2 Lvalue subroutines -There have been various fixes to lvalue subroutines. - =over =item * @@ -2089,7 +2087,7 @@ C<%^H> when entering a compilation scope [perl #106282]. =item * C<eval $string> and C<require> used not to -localise C<%^H> when compiling its argument if it +localise C<%^H> during compilation if it was empty at the time the C<eval> call itself was compiled. This could lead to scary side effects, like C<use re "/m"> enabling other flags that the surrounding code was trying to enable for its caller [perl #68750]. @@ -2254,7 +2252,19 @@ sharing the same operand, as in C<-r -x -w $fooo>. C<stat> produces more consistent warnings. It no longer warns for "_" [perl #71002] and no longer skips the warning at times for other unopened -handles. +handles. It no longer warns about an unopened handle when the operating +system's C<fstat> function fails. + +=item * + +C<stat> would sometimes return negative numbers for large inode numbers, +because it was using the wrong internal C type. [perl #84590] + +=item * + +C<lstat> is documented to fall back to C<stat> (with a warning) when given +a filehandle. When passed an IO reference, it was actually doing the +equivalent of S<C<stat _>> and ignoring the handle. =item * @@ -2264,12 +2274,34 @@ is no visible uninitialized value to speak of. =item * -C<-T>, C<-B> and C<-t> now work when stacked with other filetest operators +C<-T>, C<-B>, C<-l> and C<-t> now work +when stacked with other filetest operators [perl #77388]. =item * -Stacked filetest operators now only call FETCH once on a tied argument. +In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a +tied argument belonging to the previous argument to a list operator, if +called with a bareword argument or no argument at all. This has been +fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>. + +=item * + +In Perl 5.6, C<-l> followed by anything other than a bareword would treat +its argument as a file name. That was changed in 5.8 for glob references +(C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started +returning C<undef> for glob references without setting the last +stat buffer that the "_" handle uses, but only if warnings +were turned on. With warnings off, it was the same as 5.6. +In other words, it was simply buggy and inconsistent. Now the 5.6 +behaviour has been restored. + +=item * + +C<-l> followed by a bareword no longer "eats" the previous argument to +the list operator in whose argument list it resides. Hence, +C<print "bar", -l foo> now actually prints "bar", because C<-l> +on longer eats it. =item * @@ -2320,53 +2352,171 @@ unreadable files. These have all been fixed. +=back + +=head2 Version objects and vstrings + +=over + =item * -C<stat I<HANDLE>> and fstat failures +The bitwise complement operator (and possibly other operators, too) when +passed a vstring would leave vstring magic attached to the return value, +even though the string had changed. This meant that +C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3" +even though the string passed to C<< version->new >> was actually +"\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3> +incorrectly, without the C<~> [perl #29070]. + +=item * -If the operating system's C<fstat> function failed, C<stat> would warn -about an unopened handle, even though that was not the case. This has been -fixed. +Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then +assigning something else used to blow away all the magic. This meant that +tied variables would come undone, C<$!> would stop getting updated on +failed system calls, C<$|> would stop setting autoflush, and other +mischief would take place. This has been fixed. =item * -C<lstat I<IOREF>> +C<< version->new("version") >> and C<printf "%vd", "version"> no longer +crash [perl #102586]. + +=item * -C<lstat> is documented to fall back to C<stat> (with a warning) when given -a filehandle. When passed an IO reference, it was actually doing the -equivalent of S<C<stat _>> and ignoring the handle. +Version comparisons, such as those that happen implicitly with C<use +v5.43>, no longer cause locale settings to change [perl #105784]. =item * -stat() would always return the inode number as an IV, even when the -original was unsigned, or too large to fit in an IV. stat() now -returns the inode number as the type that would best preserve the -original value. [perl #84590] +Version objects no longer cause memory leaks in boolean context +[perl #109762]. + +=back + +=head2 Tied variables + +=over =item * -In 5.14.0, filetest ops (C<-r>, C<-x>, etc.) started calling FETCH on a -tied argument belonging to the previous argument to a list operator, if -called with a bareword argument or no argument at all. This has been -fixed, so C<push @foo, $tied, -r> no longer calls FETCH on C<$tied>. +Various cases in which FETCH was being ignored or called too many times +have been fixed: + +=over =item * -Stacked C<-l> (followed immediately by other filetest operators) did not -work previously; now it does. It is only permitted when the rightmost -filetest op has the special "_" handle for its argument and the most -recent C<stat>/C<lstat> call was an C<lstat>. +C<PerlIO::get_layers> [perl #97956] =item * -In Perl 5.6, C<-l> followed by anything other than a bareword would treat -its argument as a file name. That was changed in 5.8 for glob references -(C<\*foo>), but not for globs themselves (C<*foo>). C<-l> started -returning C<undef> for glob references without setting the last -stat buffer that the "_" handle uses, but only if warnings -were turned on. With warnings off, it was the same as 5.6. -In other words, it was simply buggy and inconsistent. Now the 5.6 -behaviour has been restored. +C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> when $tied holds a +reference. + +=item * + +Four-argument C<select> + +=item * + +A tied buffer passed to C<sysread> + +=item * + +C<< $tied .= <> >> + +=item * + +Three-argument C<open>, the third being a tied file handle +(as in C<< open $fh, ">&", $tied >>) + +=item * + +C<sort> with a reference to a tied glob for the comparison routine. + +=item * + +C<..> and C<...> in list context [perl #53554]. + +=item * + +C<${$tied}>, C<@{$tied}>, C<%{$tied}> and C<*{$tied}> where the tied +variable returns a string (C<&{}> was unaffected) + +=item * + +C<defined ${ $tied_variable }> + +=item * + +Various functions that take a filehandle argument in rvalue context +(C<close>, C<readline>, etc.) [perl #97482] + +=item * + +Some cases of dereferencing a complex expression, such as +C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call +it once. + +=item * + +C<$tied-E<gt>method> where $tied returns a package name--even resulting in +a failure to call the method, due to memory corruption + +=item * + +Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied> + +=item * + +C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and +the filetest ops (C<-r>, C<-x>, etc.) + +=back + +=item * + +C<caller> sets C<@DB::args> to the subroutine arguments when called from +the DB package. It used to crash when doing so if C<@DB::args> happened to +be tied. Now it croaks instead. + +=item * + +Tying an element of %ENV or C<%^H> and then deleting that element would +result in a call to the tie object's DELETE method, even though tying the +element itself is supposed to be equivalent to tying a scalar (the element +is, of course, a scalar) [perl #67490]. + +=item * + +When Perl autovivifies an element of a tied array or hash (which entails +calling STORE with a new reference), it now calls FETCH immediately after +the STORE, instead of assuming that FETCH would have returned the same +reference. This can make it easier to implement tied objects [perl #35865, #43011]. + +=item * + +Four-argument C<select> no longer produces its "Non-string passed as +bitmask" warning on tied or tainted variables that are strings. + +=item * + +Localising a tied scalar that returns a typeglob no longer stops it from +being tied till the end of the scope. + +=item * + +Attempting to C<goto> out of a tied handle method used to cause memory +corruption or crashes. Now it produces an error message instead +[perl #8611]. + +=item * + +A bug has been fixed that occurs when a tied variable is used as a +subroutine reference: if the last thing assigned to or returned from the +variable was a reference or typeglob, the C<\&$tied> could either crash or +return the wrong subroutine. The reference case is a regression introduced +in Perl 5.10.0. For typeglobs, it has probably never worked till now. =back @@ -2376,6 +2526,12 @@ behaviour has been restored. =item * +Various functions that take a filehandle argument in rvalue context +(C<close>, C<readline>, etc.) used to warn twice for an undefined handle +[perl #97482]. + +=item * + Last-accessed filehandle Perl has an internal variable that stores the last filehandle to be @@ -2413,28 +2569,6 @@ recommendations. See L<perlfunc/quotemeta> for details. =item * -C<~> on vstrings - -The bitwise complement operator (and possibly other operators, too) when -passed a vstring would leave vstring magic attached to the return value, -even though the string had changed. This meant that -C<< version->new(~v1.2.3) >> would create a version looking like "v1.2.3" -even though the string passed to C<< version->new >> was actually -"\376\375\374". This also caused L<B::Deparse> to deparse C<~v1.2.3> -incorrectly, without the C<~> [perl #29070]. - -=item * - -Vstrings blowing away magic - -Assigning a vstring to a magic (e.g., tied, C<$!>) variable and then -assigning something else used to blow away all the magic. This meant that -tied variables would come undone, C<$!> would stop getting updated on -failed system calls, C<$|> would stop setting autoflush, and other -mischief would take place. This has been fixed. - -=item * - C<newHVhv> and tied hashes The C<newHVhv> XS function now works on tied hashes, instead of crashing or @@ -2460,13 +2594,6 @@ was selected. Now it returns a typeglob reference in such cases. =item * -C<PerlIO::get_layers> and tied variables - -C<PerlIO::get_layers> no longer ignores FETCH on tied variables as it used -to most of the time [perl #97956]. - -=item * - C<PerlIO::get_layers> and numbers C<PerlIO::get_layers> no longer ignores some arguments that it thinks are @@ -2475,29 +2602,6 @@ for flat scalars (i.e., not references). =item * -C<caller> and tied C<@DB::args> - -C<caller> sets C<@DB::args> to the subroutine arguments when called from -the DB package. It used to crash when doing so if C<@DB::args> happened to -be tied. Now it croaks instead. - -=item * - -Tying C<@_> - -Under debugging builds, this code: - - sub TIEARRAY{bless[]} - sub { - tie @_, ""; - \@_; - }->(1); - -use to produce an "av_reify called on tied array" warning. It doesn't any -more. - -=item * - Unrecognised switches on C<#!> line If a switch, such as B<-x>, that cannot occur on the C<#!> line is used @@ -2567,15 +2671,6 @@ argument is C<undef> [perl #90064]. =item * -DELETE on scalar ties - -Tying an element of %ENV or C<%^H> and then deleting that element would -result in a call to the tie object's DELETE method, even though tying the -element itself is supposed to be equivalent to tying a scalar (the element -is, of course, a scalar) [perl #67490]. - -=item * - Freeing $_ inside C<grep> or C<map> Freeing $_ inside a C<grep> or C<map> block or a code block embedded in a @@ -2591,15 +2686,6 @@ C<undef>, but it was doing so for tied variables. This has been fixed =item * -Tying and autovivification - -When Perl autovivifies an element of a tied array or hash (which entails -calling STORE with a new reference), it now calls FETCH immediately after -the STORE, instead of assuming that FETCH would have returned the same -reference. This can make it easier to implement tied objects [perl #35865, #43011]. - -=item * - C<@&> and C<$&> Mentioning a variable named "&" other than C<$&> (i.e., C<@&> or C<%&>) no @@ -2718,39 +2804,6 @@ two operands and one was C<%{...}> or C<@{...}>. This has been fixed =item * -C<< version->new("version") >> and C<printf "%vd", "version"> no longer -crash [perl #102586]. - -=item * - -C<$tied =~ y/a/b/>, C<chop $tied> and C<chomp $tied> now call FETCH -just once when $tied holds a reference. - -=item * - -Four-argument C<select> now always calls FETCH on tied arguments. It -used to skip the call if the tied argument happened to hold C<undef> or -a typeglob. - -=item * - -Four-argument C<select> no longer produces its "Non-string passed as -bitmask" warning on tied or tainted variables that are strings. - -=item * - -C<sysread> now always calls FETCH on the buffer passed to it if the -buffer is tied. It used to skip the call if the tied variable happened -to hold a typeglob. - -=item * - -C<< $tied .= <> >> now calls FETCH once on C<$tied>. It used to call -it multiple times if the last value assigned to or returned from the -tied variable was anything other than a string or typeglob. - -=item * - Return value of C<eval> C<eval> returns C<undef> in scalar context or an empty list in list @@ -2836,11 +2889,6 @@ is not clear how to fix it [perl #106536]. =item * -Version comparisons, such as those that happen implicitly with C<use -v5.43>, no longer cause locale settings to change [perl #105784]. - -=item * - Perl now holds an extra reference count on the package that code is currently compiling in. This means that the following code no longer crashes [perl #101486]: @@ -2921,23 +2969,6 @@ problems should not happen anymore [rt.cpan.org #69862]. =item * -Localising a tied scalar that returns a typeglob no longer stops it from -being tied till the end of the scope. - -=item * - -When C<open> is called with three arguments, the third being a file handle -(as in C<< open $fh, ">&", $fh2 >>), if the third argument is tied or a -reference to a tied variable, FETCH is now called exactly once, instead of -0, 2, or 3 times (all of which could occur in various circumstances). - -=item * - -C<sort> no longer ignores FETCH when passed a reference to a tied glob for -the comparison routine. - -=item * - Warnings emitted by C<sort> when a custom comparison routine returns a non-numeric value now show the line number of the C<sort> operator, rather than the last line of the comparison routine. The warnings also occur now @@ -3025,11 +3056,6 @@ optimised [perl #94390]. =item * -C<..> and C<...> in list context now call FETCH only once on tied -arguments, instead of three or four times [perl #53554]. - -=item * - C<..> and C<...> in list context now mention the name of the variable in "uninitialized" warnings for string (as opposed to numeric) ranges. @@ -3121,12 +3147,6 @@ been fixed [perl #90006]. =item * -Attempting to C<goto> out of a tied handle method used to cause memory -corruption or crashes. Now it produces an error message instead -[perl #8611]. - -=item * - Perl skips copying values returned from a subroutine if it thinks the value is not in use elsewhere. Due to faulty logic, this would happen with the result of C<delete>, C<shift> or C<splice>, even if the result was @@ -3219,13 +3239,6 @@ reality than before. =item * -Most dereferencing operators (C<${}>, etc.) used to call C<FETCH> twice on -a tied operand when doing a symbolic dereference (looking up a variable by -name, which is not permitted under C<use strict 'refs'>). Only C<&{}> did -not have this problem. This has been fixed. - -=item * - A panic involving the combination of the regular expression modifiers C</aa> and the C<\b> escape sequence introduced in 5.14.0 has been fixed [perl #95964]. @@ -3302,12 +3315,6 @@ This, too, has been fixed. =item * -Various functions that take a filehandle argument in rvalue context -(C<close>, C<readline>, etc.) used to call C<FETCH> multiple times, if it -was a tied variable, and warn twice, if it was C<undef> [perl #97482]. - -=item * - C<close> and similar filehandle functions, when called on built-in global variables (like C<$+>), used to die if the variable happened to hold the undefined value, instead of producing the usual "Use of uninitialized @@ -3321,23 +3328,6 @@ not as C<E<lt>$fooE<gt>>). It has now been fixed never to autovivify. =item * -C<defined ${ $tied_variable }> used to call C<FETCH> multiple times, but -now calls it just once. - -=item * - -Some cases of dereferencing a complex expression, such as -C<${ (), $tied } = 1>, used to call C<FETCH> multiple times, but now call -it once. - -=item * - -For a tied variable returning a package name, C<$tied-E<gt>method> used to -call C<FETCH> multiple times (even up to six!), and sometimes would -fail to call the method, due to memory corruption. - -=item * - Calling an undefined anonymous subroutine (e.g., what $x holds after C<undef &{$x = sub{}}>) used to cause a "Not a CODE reference" error, which has been corrected to "Undefined subroutine called" [perl #71154]. @@ -3364,19 +3354,6 @@ equivalent to C<setpgrp($foo,0)>. =item * -Assignments like C<*$tied = \&{"..."}> and C<*glob = $tied> now call FETCH -only once. - -=item * - -C<chdir>, C<chmod>, C<chown>, C<utime>, C<truncate>, C<stat>, C<lstat> and -the filetest ops (C<-r>, C<-x>, etc.) now always call FETCH if passed a tied -variable as the last argument. They used to ignore tiedness if the last -thing return from or assigned to the variable was a typeglob or reference -to a typeglob. - -=item * - If things were arranged in memory the right way, it was possible for thread joining to emit "Attempt to free unreferenced scalar" warnings if C<caller> had been used from the C<DB> package prior to thread creation, @@ -3384,26 +3361,11 @@ due to the way pads were reference-counted and cloned [perl #98092]. =item * -A bug has been fixed that occurs when a tied variable is used as a -subroutine reference: if the last thing assigned to or returned from the -variable was a reference or typeglob, the C<\&$tied> could either crash or -return the wrong subroutine. The reference case is a regression introduced -in Perl 5.10.0. For typeglobs, it has probably never worked till now. - -=item * - C<given> was not scoping its implicit $_ properly, resulting in memory leaks or "Variable is not available" warnings [perl #94682]. =item * -C<-l> followed by a bareword no longer "eats" the previous argument to -the list operator in whose argument list it resides. In less convoluted -English: C<print "bar", -l foo> now actually prints "bar", because C<-l> -on longer eats it. - -=item * - C<shmread> was not setting the scalar flags correctly when reading from shared memory, causing the existing cached numeric representation in the scalar to persist [perl #98480]. @@ -3441,11 +3403,6 @@ C<SvPVbyte> now works properly non-PVs. =item * -Version objects no longer cause memory leaks in boolean context -[perl #109762]. - -=item * - C<< $$ >> is no longer tainted. Since this value comes directly from C<< getpid() >>, it is always safe. -- Perl5 Master Repository
