In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/9320cecff425a86496201de0fd939315618c4853?hp=781fa0f4588fedaa5faa25afbf2adfa74a85d24b>
- Log ----------------------------------------------------------------- commit 9320cecff425a86496201de0fd939315618c4853 Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:23:35 2012 -0700 perl5160delta: A hint bug I missed M Porting/perl5160delta.pod commit d2b8dc245fd29e9d2c461be76fa8c3031cdbc6a8 Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:18:23 2012 -0700 perl5160delta: Partially rewrite stat/filetest section M Porting/perl5160delta.pod commit 200b634097b25ac3aaa9e5e27be2836dad6c4b1d Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:14:24 2012 -0700 perl5160delta: Create a stat/filetest section M Porting/perl5160delta.pod commit bf90dc88817caaa6228401c00fd5e7b48803b65d Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:05:00 2012 -0700 perl5160delta: Shrink embedded null section Some of these items repeat each other. M Porting/perl5160delta.pod commit c99e591356a1ed5b7fab9daddedb566c5d23b31a Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:03:40 2012 -0700 perl5160delta: Change capitalisation to match the surrounding sections M Porting/perl5160delta.pod commit 12fab0b90525ff6233a04f5ac064e3e41f62cbef Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:02:27 2012 -0700 perl5160delta: Create a weakref section M Porting/perl5160delta.pod commit cbd5afc5effd66a7a2436c9eb4f8086e887a684a Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 23:00:36 2012 -0700 perl5160delta: Rearrange and reword aggreg bugs M Porting/perl5160delta.pod commit 3949715ff5509858c77fd0a6b13a4ea33d9321d9 Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 22:57:58 2012 -0700 perl5160delta: Put hash and array bug fixes together Some entries apply to both types of aggregates, so making a single section for both is the path of least resistance. M Porting/perl5160delta.pod commit 85adda6e4693a2b69d147b940449ffa25945071d Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 22:49:53 2012 -0700 perl5160delta: New section for hint bug fixes M Porting/perl5160delta.pod commit 0fe29a63a8702b1d95844f8fe671be0226e61d07 Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 22:33:39 2012 -0700 perl5160delta: Tweaks to lv sub bug fixes Rearrange things so similar items are closer. Shorten some descriptions. M Porting/perl5160delta.pod commit 1d1e229c88fac973c2b572264b5891cce85d3f7e Author: Father Chrysostomos <[email protected]> Date: Thu Apr 19 22:18:28 2012 -0700 perl5160delta.pod: Move 2 similar entries closer M Porting/perl5160delta.pod ----------------------------------------------------------------------- Summary of changes: Porting/perl5160delta.pod | 545 +++++++++++++++++++++------------------------ 1 files changed, 256 insertions(+), 289 deletions(-) diff --git a/Porting/perl5160delta.pod b/Porting/perl5160delta.pod index 15d2fbf..772b36d 100644 --- a/Porting/perl5160delta.pod +++ b/Porting/perl5160delta.pod @@ -1813,11 +1813,6 @@ the platform's native character set. =item * -C</.*/g> would sometimes refuse to match at the end of a string that ends -with "\n". This has been fixed [perl #109206]. - -=item * - C<m/[[:ascii:]]/i> and C</\p{ASCII}/i> now match identically (when not under a differing locale). This fixes a regression introduced in 5.14 in which the first expression could match characters outside of ASCII, @@ -1825,6 +1820,11 @@ such as the KELVIN SIGN. =item * +C</.*/g> would sometimes refuse to match at the end of a string that ends +with "\n". This has been fixed [perl #109206]. + +=item * + Starting with 5.12.0, Perl used to get its internal bookkeeping muddled up after assigning C<${ qr// }> to a hash element and locking it with L<Hash::Util>. This could result in double frees, crashes or erratic @@ -1986,6 +1986,11 @@ Perl 5.8.2. Now lvalue subroutines have been likewise fixed. =item * +Autovivification now works on values returned from lvalue subroutines +[perl #7946], as does returning C<keys> in lvalue context. + +=item * + Lvalue subroutines used to copy their return values in rvalue context. Not only was this a waste of CPU cycles, but it also caused bugs. A C<($)> prototype would cause an lvalue sub to copy its return value [perl #51408], @@ -1994,37 +1999,20 @@ and C<while(lvalue_sub() =~ m/.../g) { ... }> would loop endlessly =item * -Autovivification now works on values returned from lvalue subroutines -[perl #7946]. - -=item * - When called in potential lvalue context (e.g., subroutine arguments or a list -passed to C<for>), an lvalue subroutine returning arrays or hashes used to bind -the arrays (or hashes) to scalar variables--something that is not supposed to -happen. This could result in "Bizarre copy of ARRAY" errors or C<print> -ignoring its arguments. It also made nonsensical code like C<@{\$_}> "work". -This was fixed in 5.14.0 if an array were the first thing returned from the -subroutine (but not for C<$scalar, @array> or hashes being returned). Now a -more general fix has been applied [perl #23790]. - -=item * - -When called in potential lvalue context, lvalue subroutines used to copy +passed to C<for>), lvalue subroutines used to copy any read-only value that was returned. E.g., C< sub :lvalue { $] } > would not return C<$]>, but a copy of it. =item * -Assignment to C<keys> returned from an lvalue sub used not to work, but now -it does. - -=item * - -Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine -stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12. -This has been fixed. +When called in potential lvalue context, an lvalue subroutine returning +arrays or hashes used to bind the arrays or hashes to scalar variables, +resulting in bugs. This was fixed in 5.14.0 if an array were the first +thing returned from the subroutine (but not for C<$scalar, @array> or +hashes being returned). Now a more general fix has been applied +[perl #23790]. =item * @@ -2061,6 +2049,12 @@ time. =item * +Applying the C<:lvalue> attribute to an XSUB or to an aliased subroutine +stub with C<< sub foo :lvalue; >> syntax stopped working in Perl 5.12. +This has been fixed. + +=item * + Applying the :lvalue attribute to subroutine that is already defined does not work properly, as the attribute changes the way the sub is compiled. Hence, Perl 5.12 began warning when an attempt is made to apply the @@ -2082,7 +2076,39 @@ resulting in some values (such as read-only values) being rejected. =back -=head2 Fixes related to hashes +=head2 Compile-time hints + +=over + +=item * + +Tying C<%^H> no longer causes perl to crash or ignore the contents of +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 +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]. + +=item * + +C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>) +at run time, but only during compilation of the $string or required file. +This makes C<BEGIN { $^H{foo}=7 }> equivalent to +C<BEGIN { eval '$^H{foo}=7' }> [perl #70151]. + +=item * + +Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would, +on completion, make the hints of the current compiling code the current +hints. This could cause warnings to occur in a non-warning scope. + +=back + +=head2 Fixes related to hashes and arrays =over @@ -2094,53 +2120,107 @@ deleted [perl #85026]. (5.14.1) =item * +Deleting the current hash iterator (the hash element that would be returend +by the next call to C<each>) in void context used not to free it +[perl #85026]. + +=item * + +Deletion of methods via C<delete $Class::{method}> syntax used to update +method caches if called in void context, but not scalar or list context. + +=item * + +When hash elements are deleted in void context, the internal hash entry is +now freed before the value is freed, to prevent destructors called by that +latter freeing from seeing the hash in an inconsistent state. It was +possible to cause double-frees if the destructor freed the hash itself +[perl #100340]. + +=item * + +A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes +caused C<each> not to reset the iterator if called after the last element +was deleted. + +=item * + Freeing deeply nested hashes no longer crashes [perl #44225]. =item * -Deleting the current hash iterator (the hash element that would be returend -by the next call to C<each>) in void context used not to free it. The hash -would continue to reference it until the next iteration. This has been -fixed [perl #85026]. +It is possible from XS code to create hashes with elements that have no +values. The hash element and slice operators used to crash +when handling these in lvalue context. They now +produce a "Modification of non-creatable hash value attempted" error +message. -=back +=item * -=head2 Support for Embedded Nulls +If list assignment to a hash or array triggered destructors that freed the +hash or array itself, a crash would ensue. This is no longer the case +[perl #107440]. -Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in -strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would -call the "a" method, instead of the actual method name contained in $m. -These parts of perl have been fixed to support nulls: +=item * + +It used to be possible to free the typeglob of a localised array or hash +(e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit. + +=back + +=head2 Weak references =over =item * -Method names +Weakening the first argument to an automatically-invoked C<DESTROY> method +could result in erroneous "DESTROY created new reference" errors or +crashes. Now it is an error to weaken a read-only reference. =item * -Typeglob names (including filehandle names) +Weak references to lexical hashes going out of scope were not going stale +(becoming undefined), but continued to point to the hash. =item * -Package names +Weak references to lexical variables going out of scope are now broken +before any magical methods (e.g., DESTROY on a tie object) are called. +This prevents such methods from modifying the variable that will be seen +the next time the scope is entered. =item * -Autoloading +Creating a weak reference to an @ISA array or accessing the array index +(C<$#ISA>) could result in confused internal bookkeeping for elements +subsequently added to the @ISA array. For instance, creating a weak +reference to the element itself could push that weak reference on to @ISA; +and elements added after use of C<$#ISA> would be ignored by method lookup +[perl #85670]. + +=back + +=head2 Support for embedded nulls + +Some parts of Perl did not work correctly with nulls (C<chr 0>) embedded in +strings. That meant that, for instance, C<< $m = "a\0b"; foo->$m >> would +call the "a" method, instead of the actual method name contained in $m. +These parts of perl have been fixed to support nulls: + +=over =item * -Return value of C<ref()> +Method names =item * -Package names returned by C<caller()> +Typeglob names (including filehandle and subroutine names) =item * -Filehandle warnings +Package names, including the return value of C<ref()> =item * @@ -2160,6 +2240,135 @@ methods, etc. One side effect of these changes is that blessing into "\0" no longer causes C<ref()> to return false. +=head2 Filetests and C<stat> + +The term "filetests" refers to the operators that consist of a hyphen +followed by a single letter: C<-r>, C<-x>, C<-M>, etc. The term "stacked" +when applied to filetests means followed by another filetest operator +sharing the same operand, as in C<-r -x -w $fooo>. + +=over + +=item * + +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. + +=item * + +C<-T _> with no preceding C<stat> used to produce a +confusing "uninitialized" warning, even though there +is no visible uninitialized value to speak of. + +=item * + +C<-T>, C<-B> 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. + +=item * + +Perl keeps several internal variables to keep track of the last stat +buffer, from which file(handle) it originated, what type it was, and +whether the last stat succeeded. + +There were various cases where these could get out of synch, resulting in +inconsistent or erratic behaviour in edge cases (every mention of C<-T> +applies to C<-B> as well): + +=over + +=item * + +C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last +stat type, so an C<lstat _> following it would merrily return the wrong +results. Also, it was not setting the success status. + +=item * + +Freeing the handle last used by C<stat> or a filetest could result in +S<C<-T _>> using an unrelated handle. + +=item * + +C<stat> with an IO reference would not reset the stat type or record the +filehandle for S<C<-T _>> to use. + +=item * + +Fatal warnings could cause the stat buffer not to be reset +for a filetest operator on an unopened filehandle or C<-l> on any handle. +Fatal warnings also stopped C<-T> from setting C<$!>. + +=item * + +When the last stat was on an unreadable file, C<-T _> is supposed to +return C<undef>, leaving the last stat buffer unchanged. But it was +setting the stat type, causing C<lstat _> to stop working. + +=item * + +C<-T I<FILENAME>> was not resetting the internal stat buffers for +unreadable files. + +=back + +These have all been fixed. + +=item * + +C<stat I<HANDLE>> and fstat failures + +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. + +=item * + +C<lstat I<IOREF>> + +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 * + +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] + +=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>. + +=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>. + +=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. + +=back + =head2 Other notable fixes =over @@ -2188,35 +2397,11 @@ happened. =item * -C<stat _> no longer warns about unopened filehandles [perl #71002]. - -=item * - -C<stat> on an unopened filehandle now warns consistently, instead of -skipping the warning at times. - -=item * - -C<-t> now works when stacked with other filetest operators [perl #77388]. - -=item * - -Stacked filetest operators now only call FETCH once on a tied argument. - -=item * - C<~~> now correctly handles the precedence of Any~~Object, and is not tricked by an overloaded object on the left-hand side. =item * -Tying C<%^H> - -Tying C<%^H> no longer causes perl to crash or ignore the contents of -C<%^H> when entering a compilation scope [perl #106282]. - -=item * - C<quotemeta> now quotes consistently the same non-ASCII characters under C<use feature 'unicode_strings'>, regardless of whether the string is encoded in UTF-8 or not, hence fixing the last vestiges (we hope) of the @@ -2256,17 +2441,6 @@ returning an empty hash. =item * -Hashes will null elements - -It is possible from XS code to create hashes with elements that have no -values. Perl itself sometimes creates such hashes, but they are rarely -visible to Perl code. The hash element and slice operators used to crash -when handling these in lvalue context. These have been fixed. They now -produce a "Modification of non-creatable hash value attempted" error -message. - -=item * - No warning for C<open(foo::bar)> When one writes C<open foo || die>, which used to work in Perl 4, a @@ -2342,24 +2516,6 @@ signal handler from stealing the exit status [perl #105700]. =item * -Deleting methods via C<delete> - -Deletion of methods via C<delete $Class::{method}> syntax used to update -method caches if called in void context, but not scalar or list context. -Now it always updates those caches. - -=item * - -Hash element deletion and destructors - -When hash elements are deleted in void context, the internal hash entry is -now freed before the value is freed, to prevent destructors called by that -latter freeing from seeing the hash in an inconsistent state. It was -possible to cause double-frees if the destructor freed the hash itself -[perl #100340]. - -=item * - C<(s)printf>'s %n formatting code The %n formatting code, which causes the number of characters to be @@ -2410,25 +2566,6 @@ argument is C<undef> [perl #90064]. =item * -Freeing an aggregate during list assignment - -If list assignment to a hash or array triggered destructors that freed the -hash or array itself, a crash would ensue. This is no longer the case -[perl #107440]. - -=item * - -Confused internal bookkeeping with @ISA arrays - -Creating a weak reference to an @ISA array or accessing the array index -(C<$#ISA>) could result in confused internal bookkeeping for elements -subsequently added to the @ISA array. For instance, creating a weak -reference to the element itself could push that weak reference on to @ISA; -and elements added after use of C<$#ISA> would be ignored by method lookup -[perl #85670]. - -=item * - DELETE on scalar ties Tying an element of %ENV or C<%^H> and then deleting that element would @@ -2470,95 +2607,6 @@ and "`" [perl #24237]. =item * -Stacked filetests - -C<-T> and C<-B> now work when stacked up with other filetest operators -[perl #77388]. - -=item * - -Filetests and stat buffers - -Perl keeps several internal variables to keep track of the last stat -buffer, from which file(handle) it originated, what type it was, and -whether the last stat succeeded. - -There were various cases where these could get out of synch, resulting in -inconsistent or erratic behaviour in edge cases (every mention of C<-T> -applies to C<-B> as well): - -=over - -=item * - -C<-T I<HANDLE>>, even though it does a C<stat>, was not resetting the last -stat type, so an C<lstat _> following it would merrily return the wrong -results. Also, it was not setting the success status. - -=item * - -Freeing the handle last used by C<stat> or a filetest could result in -S<C<-T _>> using an unrelated handle. - -=item * - -C<stat> with an IO reference (as returned by C<*STDIO{IO}>, for instance) -would not reset the stat type. - -=item * - -C<stat> with an IO reference was not recording the filehandle for -S<C<-T _>> to use. - -=item * - -The presence of fatal warnings could cause the stat buffer not to be reset -for a filetest operator on an unopened filehandle or C<-l> on any handle. - -=item * - -Fatal warnings would stop C<-T> from setting C<$!>. - -=item * - -When the last stat was on an unreadable file, C<-T _> is supposed to -return C<undef>, leaving the last stat buffer unchanged. But it was -setting the stat type, causing C<lstat _> to stop working. - -=item * - -C<-T I<FILENAME>> was not resetting the internal stat buffers for -unreadable files. - -=back - -These have all been fixed. - -=item * - -C<-T _> with no preceding C<stat> - -This used to produce a confusing "uninitialized" warning, even though there -is no visible uninitialized value to speak of. - -=item * - -C<stat I<HANDLE>> and fstat failures - -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. - -=item * - -C<lstat I<IOREF>> - -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 * - Bitwise assignment operators and copy-on-write In 5.14.0, the bitwise assignment operators C<|=>, C<^=> and C<&=> started @@ -2855,24 +2903,6 @@ precedes a character in the string that should match the pattern. =item * -Weak references to lexical hashes going out of scope were not going stale -(becoming undefined), but continued to point to the hash. - -=item * - -Weak references to lexical variables going out of scope are now broken -before any magical methods (e.g., DESTROY on a tie object) are called. -This prevents such methods from modifying the variable that will be seen -the next time the scope is entered. - -=item * - -A C<keys> optimisation in Perl 5.12.0 to make it faster on empty hashes -caused C<each> not to reset the iterator if called after the last element -was deleted. This has been fixed. - -=item * - The C<#line 42 foo> directive used not to update the arrays of lines used by the debugger if it occurred in a string eval. This was partially fixed in 5.14, but it only worked for a single C<#line 42 foo> in each eval. Now @@ -2880,26 +2910,6 @@ it works for multiple. =item * -String eval used not to localise C<%^H> when compiling its argument 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]. - -=item * - -Creating a BEGIN block from XS code (via C<newXS> or C<newATTRSUB>) would, -on completion, make the hints of the current compiling code the current -hints. This could cause warnings to occur in a non-warning scope. - -=item * - -C<eval $string> and C<require> no longer localise hints (C<$^H> and C<%^H>) -at run time, but only during compilation of the $string or required file. -This makes C<BEGIN { $^H{foo}=7 }> equivalent to -C<BEGIN { eval '$^H{foo}=7' }> [perl #70151]. - -=item * - When subroutine calls are intercepted by the debugger, the name of the subroutine or a reference to it is stored in C<$DB::sub>, for the debugger to access. In some cases (such as C<$foo = *bar; undef *bar; &$foo>) @@ -3221,13 +3231,6 @@ fixed [perl #95964]. =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] - -=item * - The combination of the regular expression modifiers C</aa> and the C<\b> and C<\B> escape sequences did not work properly on UTF-8 encoded strings. All non-ASCII characters under C</aa> should be treated as @@ -3354,11 +3357,6 @@ scalars, as in Perl 5.005. =item * -It used to be possible to free the typeglob of a localised array or hash -(e.g., C<local @{"x"}; delete $::{x}>), resulting in a crash on scope exit. - -=item * - C<setpgrp($foo)> used to be equivalent to C<($foo, setpgrp)>, because C<setpgrp> was ignoring its argument if there was just one. Now it is equivalent to C<setpgrp($foo,0)>. @@ -3405,25 +3403,12 @@ on longer eats it. =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>. - -=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]. =item * -Weakening the first argument to an automatically-invoked C<DESTROY> method -could result in erroneous "DESTROY created new reference" errors or -crashes. Now it is an error to weaken a read-only reference. - -=item * - Under miniperl (used to configure modules when perl itself is built), C<glob> now clears %ENV before calling csh, since the latter croaks on some systems if it does not like the contents of the LS_COLORS enviroment @@ -3435,24 +3420,6 @@ C<++> and C<--> now work on copies of globs, instead of dying. =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>. - -=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<splice()> doesn't warn when truncating You can now limit the size of an array using C<splice(@a,MAX_LEN)> without -- Perl5 Master Repository
