Father Chrysostomos [Sat, 16 Nov 2013 23:12:58 +0000 (15:12 -0800)]
perldiag: \%d better written as $%d
splain can’t necessarily find it if we hard-code the number:
$ ./perl -Ilib -Mdiagnostics -we '()="" =~ s/()()/\1/r'
\1 better written as $1 at -e line 1 (#1)
(W syntax) Outside of patterns, backreferences live on as variables.
The use of backslashes is grandfathered on the right-hand side of a
substitution, but stylistically it's better to use the variable form
because other Perl programmers will expect it, and it works better if
there are more than 9 backreferences.
$ ./perl -Ilib -Mdiagnostics -we '()="" =~ s/()()/\2/r'
\2 better written as $2 at -e line 1.
$
%d is more intuitive than %c here, so I used %d in the pod instead of
copying the C code that generates it.
Father Chrysostomos [Sat, 16 Nov 2013 23:07:51 +0000 (15:07 -0800)]
perldiag: rewrap an entry for better splain output
James E Keenan [Sun, 17 Nov 2013 15:58:07 +0000 (16:58 +0100)]
Fix POD formatting error.
James E Keenan [Sun, 17 Nov 2013 14:27:14 +0000 (15:27 +0100)]
perldelta addition for the previous commit.
James E Keenan [Mon, 11 Nov 2013 20:11:14 +0000 (21:11 +0100)]
Convert to using Test::More. Provide each test with a description.
For: RT #120503. This entailed:
Replacing each instance of Check() and CheckDie() with appropriate
Test::More functions.
Replacing MkDir() and touch() with mkdir_ok() and create_file_ok() to
create a more Test::More-ish interface; create symlink_ok() to handle
similar circumstances.
Providing those three wrapper subroutines with default descriptions,
but allowing a custom description to be passed as an argument.
Highlighting more important unit tests found at the end of subsections
and blocks by prepending 'COMPLETE:' to their descriptions.
More inline comments to guide future maintainers.
Some repositioning of code in order to narrow the scope of variables.
Replacement of hard tabs with spaces; some regularization of indents
and other code tidying.
No tests were added or removed, so the planned number of tests on a
given platform will be unchanged.
TODO:
Some descriptions still need improvement.
There are quite a few File-Find features mentioned in the POD which
are not referenced at all in this test file. They need to have new
tests written for them.
Coverage analysis.
Father Chrysostomos [Sat, 16 Nov 2013 14:52:26 +0000 (06:52 -0800)]
perldelta for the previous commit
Father Chrysostomos [Sat, 16 Nov 2013 14:50:49 +0000 (06:50 -0800)]
Fix memory leak with recursive sub redefinition
See the thread starting at
<
20131115042923.7514.qmail@lists-nntp.develooper.com>.
Commits
7004ee4937 and
a61818571 changed subroutine redefinition to
null the GvCV slot before freeing the CV, so that destructors won’t
see GvCV without a reference count. That turns a double free into a
memory leak.
Kent Fredric explains it nice and clearly:
> sub foo{} # A
> bless \&foo;
> DESTROY { *foo = sub {} # C }
> eval "sub foo{} "; # B
>
> Previous behaviour was:
>
> B replaces A, triggers DESTROY, which triggers C replacing A, and this
> invoked a double free, because C , triggering the removal of A,
> happened while A still existed ( ?? )
>
> So the change fixes this, so that A is removed from the symbol table
> before DESTROY triggers , so that C is creating a "new" symbol,
> effectively, and the problem is that C is then clobbered by the B
> replacing the slot, after the DESTROY.
So C leaks.
This commit fixes it by changing the SvREFCNT_dec into SAVEFREESV,
essentially delaying the DESTROY until after the subroutine redefini-
tion is complete.
This does mean that C is what ends up in the glob afterwards; but as
long as perl’s own bookkeeping is thrown off, we can leave it to the
user (the Perl programmer) to handle the consequences of naughty
destructors.
Father Chrysostomos [Sat, 16 Nov 2013 13:18:59 +0000 (05:18 -0800)]
gv.c: Remove redundant mro_method_changed_in()
Core subs are already accounted for by method lookup, so vivifying
them does not change what gets inherited. Hence, there is no need
to flush caches here.
Father Chrysostomos [Sat, 16 Nov 2013 05:40:45 +0000 (21:40 -0800)]
Unwrap a perldiag entry for better splain output
Before:
$ ./perl -Ilib -Mdiagnostics -e 'warn "Missing '\'']'\'' in prototype for %s : %s"'
Missing ']' in prototype for %s : %s at -e line 1 (#1)
(W illegalproto) A grouping was started with [ but never closed with
].
After:
$ ./perl -Ilib -Mdiagnostics -e 'warn "Missing '\'']'\'' in prototype for %s : %s"'
Missing ']' in prototype for %s : %s at -e line 1 (#1)
(W illegalproto) A grouping was started with [ but never closed with ].
Father Chrysostomos [Sat, 16 Nov 2013 05:38:43 +0000 (21:38 -0800)]
perldiag: ‘my sub’ is no longer ‘reserved’ syntax
Father Chrysostomos [Sat, 16 Nov 2013 05:35:04 +0000 (21:35 -0800)]
Alphabetise perldiag
Father Chrysostomos [Sat, 16 Nov 2013 05:35:46 +0000 (21:35 -0800)]
perldiag: remove space from otherwise blank line
This enables splain to find the following entry.
David Mitchell [Sat, 16 Nov 2013 00:01:32 +0000 (00:01 +0000)]
Revert "make perl core quiet under -Wfloat-equal"
A suggested way of avoiding the the warning on nv1 != nv2
by replacing it with (nv1 < nv2 || nv1 > nv2), has too many issues
with NaN. [perl #120538].
I haven't found any other way of selectively disabling the warning,
so for now I'm just reverting the whole commit.
This reverts commit
c279c4550ce59702722d0921739b1a1b92701b0d.
Chris 'BinGOs' Williams [Fri, 15 Nov 2013 23:03:14 +0000 (23:03 +0000)]
Update DB_File to CPAN version 1.831
[DELTA]
1.831 15 November 2013
* C99 comment is a nogo
RT #90383
Chris 'BinGOs' Williams [Fri, 15 Nov 2013 14:56:16 +0000 (14:56 +0000)]
Update IPC-Cmd to CPAN version 0.88
[DELTA]
0.88 Fri Nov 15 14:44:03 GMT 2013
Misc:
* skip some problematic tests on Cygwin
Daniel Dragan [Fri, 15 Nov 2013 08:21:53 +0000 (03:21 -0500)]
[perl #120544] fix "goto" around var init error in av_extend_guts
This fixes a Win32 Visual C 6 in C++ mode syntax error. See #120544 for
the details.
Father Chrysostomos [Fri, 15 Nov 2013 13:31:22 +0000 (05:31 -0800)]
Father Chrysostomos [Fri, 15 Nov 2013 13:28:24 +0000 (05:28 -0800)]
perldelta for
c5f75dbad5e3
Father Chrysostomos [Fri, 15 Nov 2013 13:04:39 +0000 (05:04 -0800)]
Increase $fields::VERSION to 2.17
Father Chrysostomos [Fri, 15 Nov 2013 06:13:45 +0000 (22:13 -0800)]
Revamp fields documentation
• Actually give an example of a typed lexical.
• Also show the syntax parenthetically in the pod, since the phrase
‘typed lexical’ is not exactly well known.
• Don’t use dev version numbers.
• Don’t talk about pseudo-hashes so pervasively, as the fact that they
are used is more an implementation detail now than a feature (except
for phash).
• If we talk about restricted hashes, we should link to Hash::Util.
• -w is not the only way to turn warnings on.
Also mention in perlfunc that ‘my __PACKAGE__’ and ‘my CONSTANT’ work,
so that the only mentions are not in perl561delta and Lexical::Types.
Father Chrysostomos [Fri, 15 Nov 2013 04:30:30 +0000 (20:30 -0800)]
Father Chrysostomos [Fri, 15 Nov 2013 01:53:02 +0000 (17:53 -0800)]
perldelta for
4571f4a728 and, of course,
bc81b34d0e
4571f4a728 alone made things worse, causing a double free. :-)
Father Chrysostomos [Fri, 15 Nov 2013 01:51:04 +0000 (17:51 -0800)]
Another perldelta to-do
I’m sure Dave Mitchell can explain this better than I.
Father Chrysostomos [Thu, 14 Nov 2013 22:29:51 +0000 (14:29 -0800)]
[perl #120463] s/// and tr/// with wide delimiters
$ perl -Mutf8 -e 's αaαα'
Substitution replacement not terminated at -e line 1.
What is happening is that the first scan goes past the delimiter at
the end of the pattern. Then a single byte is compared (the previous
character against the first byte of the opening delimiter) to see
whether the parser needs to step back one byte before scanning the
second part.
That means you can do the equivalent of s/foo/|bar|g if / is replaced
with a wide character:
$ perl -l -Mutf8 -e '$_ = "a"; s αaα|b|; print'
b
This commit fixes it by giving toke.c:S_scan_str an extra parameter,
so it can tell the callers that need this (scan_subst and scan_trans)
where to start scanning the replacement.
H.Merijn Brand [Thu, 14 Nov 2013 17:38:38 +0000 (18:38 +0100)]
Add Synology instructions
Craig A. Berry [Thu, 14 Nov 2013 14:08:34 +0000 (08:08 -0600)]
move DEBUGGING section after includes in regexec.c.
7b75fc16a59 added #ifdef DEBUGGING around a declaration, but that
section of code was before any includes, and (on VMS anyway),
DEBUGGING is defined in config.h, not on the command line.
So just move that declaration after the includes, which is a more
normal way to do things anyway.
Father Chrysostomos [Thu, 14 Nov 2013 13:26:26 +0000 (05:26 -0800)]
Don’t skip t/re/reg_eval_scope.t under miniperl
re.pm doesn’t load its C code under miniperl, and it’s not needed anyway
here, since we are just setting hints.
Father Chrysostomos [Wed, 13 Nov 2013 14:05:21 +0000 (06:05 -0800)]
sv.c apidocs: SV_NOSTEAL, not NOSTEAL
NOSTEAL is nonexistent. While abbreviating constants may be fine for
comments, using such forms in API documentation may be less than
helpful.
Father Chrysostomos [Wed, 13 Nov 2013 13:54:01 +0000 (05:54 -0800)]
constant.pm: Consistent spaces after dots in pod
It was inconsistent throughout.
Father Chrysostomos [Wed, 13 Nov 2013 13:33:00 +0000 (05:33 -0800)]
Increase $constant::VERSION to 1.29
Father Chrysostomos [Tue, 12 Nov 2013 14:13:44 +0000 (06:13 -0800)]
Compile-time checking for %$obj{"key"} under ‘use fields’
This single line of code also gives us shared hash key optimisa-
tions for free.
Father Chrysostomos [Thu, 14 Nov 2013 13:18:00 +0000 (05:18 -0800)]
Fix bad read in gp_free introduced by
4571f4a72
4571f4a72 attempted to fix this:
$ ./perl -Ilib -e 'sub foo{} bless \&foo; DESTROY { undef *foo } undef *foo'
Attempt to free unreferenced glob pointers, Perl interpreter: 0x7fd6a3803200 at -e line 1.
by lowering the refcount of the gp only after freeing the contents.
But what was missing was a check at the end to make sure the refcount
was not already 0.
In fact, that can’t work either, as, if the refcount has gone down
to 0 while freeing the contents of the gp, we will be reading
freed memory.
In an attempt to implement what my half-baked idea was meant to do,
I thought of incrementing the reference count before freeing the
entries, and then checking it afterwards, but that would cause an
‘undef *foo’ during that to null the gp slot of the gv and replace it
with a new one. In the mean time, gp_free is only freeing the old gp
and the new gp will leak when it sets GvGP to 0.
I thought of detaching the gp from the gv completely before freeing
its entries, but most code doesn’t expect to see typeglobs with no gp.
GvSV will crash.
I nearly concluded that the only approach I could use was to revert
4571f4a72 and simply extirpate that warning. As far as I can tell, it
only comes up with recursive gp_free calls. However, in those cases,
simply returning will cause a memory leak, as pp_undef will give the
gv a new gp, and the outer gp_free call, when it finishes, will set
the gv’s gp slot to null, overwriting what pp_undef put there (a vari-
ation of the leak above).
So, the final solution is for gp_free to re-read the GvGP value each
time it loops, freeing entries. The reference count will continue to
be decremented at the end of the function, as in
4571f4a72. That will
prevent any bad reads. If pp_undef has reallocated the gp in the mean
time, we will simply start using the new one. We need an extra refer-
ence count check at the end, in case a destructor does glob assignment
and causes the gp to be shared.
Ideally this should fix the recent build errors. (See
<
20131113045538.GA18816@mars.tony.develop-help.com>.) I tried it
under valgrind on dromedary both before and after the patch, and the
bad reads went away.
H.Merijn Brand [Thu, 14 Nov 2013 12:33:12 +0000 (13:33 +0100)]
Compliance: Mixed declarations not allowed in some pre-C99 compilers
David Mitchell [Thu, 14 Nov 2013 12:45:44 +0000 (12:45 +0000)]
Dynaloader: fix build issue
My commit from yesterday,
860b3d937d9b004a7de4b684765ab75006c71f00,
inadvertently included c99-ish mixed declarations and code.
H.Merijn Brand [Thu, 14 Nov 2013 11:53:03 +0000 (12:53 +0100)]
NO C99 comments, please!
Jerry D. Hedden [Wed, 13 Nov 2013 19:31:38 +0000 (19:31 +0000)]
[PATCH] Upgrade to threads::shared 1.45
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
David Mitchell [Wed, 13 Nov 2013 17:30:10 +0000 (17:30 +0000)]
Opcode: fix 'null argument' warning
HvNAME_get() can return NULL, and strNE() wants non-null args.
[
As a side note: on debugging builds this line
if (strNE(HvNAME_get(hv),"main")) {
macro-expands into an 18,000 character line (!) due to the fact that
HvNAME_get() is quite a big expansion under debugging, and strNE expands to
strlen, which under gcc expands to a huge macro (which is mainly lots of
different compile-time alternatives depending on which of its args are
constants), that references its args several times.
]
David Mitchell [Wed, 13 Nov 2013 16:48:11 +0000 (16:48 +0000)]
IO.xs: fix compiler warning
PerlIO_unread() returns SSize_t, although from its sparse documentation
it doesn't seem that it would ever return a negative value. So cast away
the 'comparison between signed and unsigned integer' warning.
David Mitchell [Wed, 13 Nov 2013 15:01:40 +0000 (15:01 +0000)]
File::Glob: fix warnings and non-\0-ended strings
The lower levels of File::Glob expect null-terminated strings, while
the higher levels do s = SvPV(sv,len) and pass the len. Ease the impedance
mismatch by ensuring that s[len] is always \0. Most perl SVs will already
have that \0 anyway, so in practice this hasn't been an issue.
It also ignores the utf8-ness of the string. I've kept that as-is (too big
a can of works to open for now), but I've fixed the 'is_utf8 var not used'
warning and added an XXX comment instead.
David Mitchell [Wed, 13 Nov 2013 12:33:40 +0000 (12:33 +0000)]
File::Glob: silence some compiler warnings
In bsd_glob.c, there are nested set of functions glob0(), glob1() etc,
which among their parameters pass a pointer to a compiled pattern, and also
to its end. It turns out the end pointer isn't usually used, since the
pattern is usually scanned for BG_EOS instead. Also, glob3() is
passed two pattern ranges, both within the same pattern, and both with
the same pointer to the end of the pattern buffer. Since both end pointers
are the same, eliminate one of them. This removed an unused var compiler
warning. Use the remaining end pointer in the glob*() functions to add
assertions that we haven't fallen off the end of the buffer.
Finally, ARG_MAX may be signed.
Karl Williamson [Wed, 13 Nov 2013 17:25:57 +0000 (10:25 -0700)]
podcheck: Remove workaround no longer needed
The bug this worked around has been fixed by
406e3fef7f4bebd2003087bce74d22303981ac48
David Mitchell [Tue, 12 Nov 2013 16:11:33 +0000 (16:11 +0000)]
Devel::Peek: fix some compiler warnings
David Mitchell [Tue, 12 Nov 2013 16:02:12 +0000 (16:02 +0000)]
arybase: silence some compiler warnings
some of the static functions in ptable.h are unused. It looks
like ptable.h has been written to be more general-purpose and reusable,
but at the moment its only used in one place, so '#if 0' the unused
functions for now, to shut up the compiler..
David Mitchell [Tue, 12 Nov 2013 16:00:35 +0000 (16:00 +0000)]
File-DosGlob: silence some compiler warnings
David Mitchell [Tue, 12 Nov 2013 15:55:38 +0000 (15:55 +0000)]
B: silence some compiler warnings
The renaming of the 'form' arg to 'format' is due to form being #deffed to
Perl_form() or similar.
Some of the unused vars were due to things like BmPREVIOUS() being #deffed
to 0 in recent builds.
The pad ones were due to the PADOFFSET type being used to index a pad
*list*, not a pad - that's SSize_t.
David Mitchell [Tue, 12 Nov 2013 15:54:40 +0000 (15:54 +0000)]
DynaLoader: silence some compiler warnings
David Mitchell [Tue, 12 Nov 2013 15:51:21 +0000 (15:51 +0000)]
silence some compiler warnings
Actually, most of this commit is adding (void) to various function returns
where we know its ok to ignore the return value. This doesn't actually
silence the -Wunused-result warning (thanks a bundle gcc), but at least
it marks our intentions.
David Mitchell [Tue, 12 Nov 2013 15:39:04 +0000 (15:39 +0000)]
fix definition of GvFILEGV()
It was:
#define GvFILE(gv) (GvFILE_HEK(gv) ? HEK_KEY(GvFILE_HEK(gv)) : NULL)
#define GvFILEGV(gv) (gv_fetchfile(GvFILE(gv)))
which is a problem, since gv_fetchfile() doesn't accept a non-null
argument. Change it so that the (cond ? foo : NULL) thing is outside
gv_fetchfile(). This is all a bit academic since GvFILE_HEK should never
be null, but it at least it shuts up a compiler warning.
Chris 'BinGOs' Williams [Wed, 13 Nov 2013 00:33:27 +0000 (00:33 +0000)]
Update Test-Harness to CPAN version 3.30
[DELTA]
3.30 2013-11-12
- Fix missing parent prereq in META.{yml,json} and NotBuild.PL
(Dagfinn Ilmari Mannsåker, #89650)
- Respect PERL5LIB in tainting source handler test (Dagfinn Ilmari Mannsåker,
Leon Timmermans)
- Use base instead of parent:
This dist is used for testing all other modules, so it should avoid
having any non-core prerequisites. Having parent as a prereq leads to a
circular dependency of parent -> Test::More -> Test::Harness. (Graham Knop)
- Various POD fixes (Nathan Gary Glenn)
- Don't localize all of %ENV in harness.t (Craig Berry)
- Give TAP::Harness::Beyond a unique NAME (Leon Timmermans)
Father Chrysostomos [Tue, 12 Nov 2013 22:45:39 +0000 (14:45 -0800)]
Another perldelta to-do
Father Chrysostomos [Tue, 12 Nov 2013 22:44:47 +0000 (14:44 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:43:15 +0000 (14:43 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:43:00 +0000 (14:43 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:35:36 +0000 (14:35 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:33:20 +0000 (14:33 -0800)]
Another perldelta to-do
that I don’t understand well enough to explain
Father Chrysostomos [Tue, 12 Nov 2013 22:32:37 +0000 (14:32 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:28:26 +0000 (14:28 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:26:07 +0000 (14:26 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 22:23:44 +0000 (14:23 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 20:55:57 +0000 (12:55 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 20:54:52 +0000 (12:54 -0800)]
Chris 'BinGOs' Williams [Tue, 12 Nov 2013 16:28:12 +0000 (16:28 +0000)]
Update Module-Build to CPAN version 0.4200
[DELTA]
0.4200 - Tue Nov 12 12:39:25 CET 2013
- Released 0.40_11 as 0.4200
0.40_11 - Wed Nov 6 12:46:59 CET 2013
[BUG FIXES]
- Do not set provides in metadata if no_index is set [Leon Timmermans]
0.40_10 - Tue Nov 5 12:11:37 CET 2013
[BUG FIXES]
- Lowercase license in fallback logic [Leon Timmermans]
0.40_09 - Tue Nov 5 00:13:11 CET 2013
[ENHANCEMENTS]
- Converted to using Meta 2.0
Father Chrysostomos [Tue, 12 Nov 2013 13:58:27 +0000 (05:58 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:54:36 +0000 (05:54 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:51:21 +0000 (05:51 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:48:14 +0000 (05:48 -0800)]
perldelta: potential to-do item
I don’t understand this commit enough to know whether it warranst
inclusion, let alone to write a description for it.
Father Chrysostomos [Tue, 12 Nov 2013 13:46:34 +0000 (05:46 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:44:38 +0000 (05:44 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:42:06 +0000 (05:42 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:39:43 +0000 (05:39 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:36:21 +0000 (05:36 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:33:10 +0000 (05:33 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:31:40 +0000 (05:31 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:16:02 +0000 (05:16 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:14:57 +0000 (05:14 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:04:14 +0000 (05:04 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:03:29 +0000 (05:03 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 13:00:55 +0000 (05:00 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 06:16:41 +0000 (22:16 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 06:11:47 +0000 (22:11 -0800)]
perldelta for
8cece9139ae
Father Chrysostomos [Tue, 12 Nov 2013 02:03:05 +0000 (18:03 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 01:58:53 +0000 (17:58 -0800)]
Father Chrysostomos [Tue, 12 Nov 2013 01:56:31 +0000 (17:56 -0800)]
perldelta: put things in the right sections
I could have sworn I had them in the right place. I think git’s
ability to merge changes can be fooled.
Father Chrysostomos [Mon, 11 Nov 2013 21:39:24 +0000 (13:39 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 21:35:40 +0000 (13:35 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:54:53 +0000 (12:54 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:53:46 +0000 (12:53 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:48:29 +0000 (12:48 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:41:44 +0000 (12:41 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:35:01 +0000 (12:35 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 05:41:49 +0000 (21:41 -0800)]
In newATTRSUB, clear glob slot before lowering refcount.
(Actually in its subroutine, S_already_defined.)
Otherwise, when newATTRSUB redefines a sub, the previous sub’s DESTROY
can see the same sub still in the typeglob, but without a reference
count, so *typeglob = sub {} frees the sub currently in $_[0].
$ perl5.18.1 -le '
sub foo{}
bless \&foo;
DESTROY {
print "before: $_[0]"; *foo=sub{}; print "after: $_[0]"
}
eval "sub foo{}";
'
before: main=CODE(0x7fa88382d6d8)
before: main=CODE(0x7fa88382d6d8)
after: main=CODE(0x7fa88382d6d8)
after: UNKNOWN(0x7fa88382d6d8)
Father Chrysostomos [Sun, 10 Nov 2013 14:26:39 +0000 (06:26 -0800)]
In newXS, clear glob slot before lowering refcount.
Otherwise, when newXS redefines a sub, the previous sub’s DESTROY can
see the same sub still in the typeglob, but without a reference count,
so *typeglob = sub {} frees the sub currently in $_[0].
$ perl5.18.1 -le '
sub re::regmust{}
bless \&re::regmust;
DESTROY {
print "before: $_[0]"; *re::regmust=sub{}; print "after: $_[0]"
}
require re;
'
before: main=CODE(0x7ff7eb02d6d8)
before: main=CODE(0x7ff7eb02d6d8)
after: main=CODE(0x7ff7eb02d6d8)
after: UNKNOWN(0x7ff7eb02d6d8)
Father Chrysostomos [Sun, 10 Nov 2013 20:04:51 +0000 (12:04 -0800)]
Undeffing a gv in DESTROY triggered by undeffing the same gv
$ ./perl -Ilib -e 'sub foo{} bless \&foo; DESTROY { undef *foo } undef *foo'
Attempt to free unreferenced glob pointers, Perl interpreter: 0x7fd6a3803200 at -e line 1.
Lowering the reference count on the glob pointer only after freeing
the contents fixes this.
Father Chrysostomos [Sun, 10 Nov 2013 13:24:42 +0000 (05:24 -0800)]
Simplify code for deparsing socketpair
Instead of fixing a typo programmatically, just spell it correctly to
begin with. This should make things just slightly faster.
Daniel Dragan [Mon, 4 Nov 2013 08:18:58 +0000 (03:18 -0500)]
check existence of headers and libs for WinCE in Makefile.ce
Macro LIBC was used since day 1 of WinCE port (commit
e1caacb4fd ), but
never before defined. On Desktop Win32 Perl, LIBC is msvcrt.lib, so fix
corelibc/msvcrt to be LIBC and not part of CELIBS. Then use LIBC in a
sanity check. Sanity checks will give an error message, vs running the
C compiler and geting cryptic messages about unknown .hs and random
missing symbols.
David Mitchell [Thu, 7 Nov 2013 12:17:26 +0000 (12:17 +0000)]
fix chop formats with non PV vars
[perl #119847], [perl #119849], [perl #119851]
Strange vars like ties, overloads, or stringified refs (and in recent
perls, pure NOK vars) would generally do the wrong thing in formats
when the var is treated as a string and repeatedly chopped, as in
^<<<~~ and similar. This would manifest itself in infinite loops, utf8
errors etc. A recent change that stopped a stringified NOK getting
converted into a POK made the same badness happen for plain NVs too.
This commit contains two main fixes. First, the chopping was done
using sv_chop(), which only worked on POK strings. If its !POK, we now do
sv_setpvn() instead, which is less efficient, but will ensure the right
thing is always done.
Secondly, we make sure that the sv is accessed only once per cycle,
doing s = SvPV(sv, len) or similar. After that, all access is done only
via s and len. One place was using SvPVX(sv), and several places
were using the sv for utf8<->byte length conversions, such as
sv_pos_b2u().
It turns out that all the complex utf8 handling could be enormously
simplified. Since the code that needed to do utf8/byte length conversions
already scanned the string looking for suitable split points (such as
spaces or \n or \r), it was easiest to include any utf8 processing in the
same loop - i.e. incrementing s by UTF8SKIP(s) each time, but incrementing
the character count by 1.
The original diagnosis and reporting of this issue was done by Nicholas
Clark, who also supplied most of the tests.
David Mitchell [Wed, 30 Oct 2013 15:06:53 +0000 (15:06 +0000)]
pp_formline(): document switch cases
The individual ops (such as FF_END) of the format bytecode are documented
in form.h; appned those descriptive texts also to the individual 'case
FF_END:' lines in pp_formline, to make navigation easier. Also ensure
there's a blank line before each 'case'.
No functional changes.
H.Merijn Brand [Mon, 11 Nov 2013 10:07:10 +0000 (11:07 +0100)]
Synology support now more explicit
Johan Vromans tested the changes on DS413. The changes I added before
are more Synology specific (though perhaps not only appropriate for
Synology) but at least wider than just armv5tel
Tony Cook [Wed, 18 Sep 2013 05:55:12 +0000 (15:55 +1000)]
[perl #75156] fix the return value and bits for removing a closed fh
Tony Cook [Wed, 18 Sep 2013 05:20:19 +0000 (15:20 +1000)]
[perl #75156] tests for deleting a closed handle from IO::Select