This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
11 years agowarn on -i with no input files given [perl #113410]
Jesse Luehrs [Tue, 26 Jun 2012 07:16:57 +0000 (02:16 -0500)]
warn on -i with no input files given [perl #113410]

11 years agofix c++ compilation
Jesse Luehrs [Tue, 26 Jun 2012 06:35:31 +0000 (01:35 -0500)]
fix c++ compilation

11 years agouse a less broken test for locale radix in atof [perl #109318]
Jesse Luehrs [Tue, 26 Jun 2012 05:13:54 +0000 (00:13 -0500)]
use a less broken test for locale radix in atof [perl #109318]

11 years agofix some language/country codes
Jesse Luehrs [Tue, 26 Jun 2012 05:33:40 +0000 (00:33 -0500)]
fix some language/country codes

11 years agodiag.t: Two to-done entries I missed
Father Chrysostomos [Tue, 26 Jun 2012 05:12:39 +0000 (22:12 -0700)]
diag.t: Two to-done entries I missed

11 years agoperldelta: make podcheck happy
Father Chrysostomos [Tue, 26 Jun 2012 05:10:12 +0000 (22:10 -0700)]
perldelta: make podcheck happy

11 years agoperldelta for #73690, scalar(write)
Father Chrysostomos [Tue, 26 Jun 2012 05:08:46 +0000 (22:08 -0700)]
perldelta for #73690, scalar(write)

11 years agoperldelta for #112966/2c5f48c251e
Father Chrysostomos [Tue, 26 Jun 2012 04:32:25 +0000 (21:32 -0700)]
perldelta for #112966/2c5f48c251e

11 years agoperldelta for #113798, glob and PATH
Father Chrysostomos [Tue, 26 Jun 2012 03:47:06 +0000 (20:47 -0700)]
perldelta for #113798, glob and PATH

11 years agoperldelta for #112962, reg_temp_copy and null offs
Father Chrysostomos [Tue, 26 Jun 2012 03:43:02 +0000 (20:43 -0700)]
perldelta for #112962, reg_temp_copy and null offs

11 years agoperldelta: Oops, duplicate entry
Father Chrysostomos [Tue, 26 Jun 2012 03:40:43 +0000 (20:40 -0700)]
perldelta: Oops, duplicate entry

11 years agoperldelta for #101666, regexp error error
Father Chrysostomos [Tue, 26 Jun 2012 03:39:39 +0000 (20:39 -0700)]
perldelta for #101666, regexp error error

11 years agoperldelta for #112826, Tie::StdHandle and read offset
Father Chrysostomos [Tue, 26 Jun 2012 03:39:27 +0000 (20:39 -0700)]
perldelta for #112826, Tie::StdHandle and read offset

11 years agoperldelta for #113764, duping scalar handles
Father Chrysostomos [Tue, 26 Jun 2012 03:36:04 +0000 (20:36 -0700)]
perldelta for #113764, duping scalar handles

11 years agoperldelta for #89544, nested closure leak
Father Chrysostomos [Tue, 26 Jun 2012 03:33:40 +0000 (20:33 -0700)]
perldelta for #89544, nested closure leak

11 years agoperldelta for #113730, do and $@
Father Chrysostomos [Tue, 26 Jun 2012 03:30:57 +0000 (20:30 -0700)]
perldelta for #113730, do and $@

11 years agopp_sys.c: Squelch compiler warning
Father Chrysostomos [Tue, 26 Jun 2012 03:29:22 +0000 (20:29 -0700)]
pp_sys.c: Squelch compiler warning

11 years agoperldelta for #113712, stubs after errors
Father Chrysostomos [Tue, 26 Jun 2012 03:28:46 +0000 (20:28 -0700)]
perldelta for #113712, stubs after errors

11 years agodiag.t: Tolerate trailing space
Father Chrysostomos [Mon, 25 Jun 2012 00:58:54 +0000 (17:58 -0700)]
diag.t: Tolerate trailing space

11 years agoperldiag: Correct various regexp msgs
Father Chrysostomos [Mon, 25 Jun 2012 00:53:27 +0000 (17:53 -0700)]
perldiag: Correct various regexp msgs

Many of these are listed in a slightly different way from what perl actually emits.  E.g., this entry:

    Sequence (?#... not terminated in regex; marked by <-- HERE in m/%s/

is incorrect, as the actual message is:

$ perl -e '/(?#/'
Sequence (?#... not terminated in regex m/(?#/ at -e line 1.

11 years agodiag.t: Support regcomp’s FAIL macros
Father Chrysostomos [Mon, 25 Jun 2012 00:24:49 +0000 (17:24 -0700)]
diag.t: Support regcomp’s FAIL macros

11 years agofix stack handling in write() [perl #73690]
Jesse Luehrs [Tue, 26 Jun 2012 01:43:38 +0000 (20:43 -0500)]
fix stack handling in write() [perl #73690]

I'm not sure about that POPs at the beginning of pp_leavewrite, but it
seems to work. As far as I can tell, executing the format always leaves
an extra value on the stack, but I'm not sure where that happens
exactly, so I'm just fixing it up there.

11 years agoImport CCHOME from the environment when building with GCC on Windows
Steve Hay [Mon, 25 Jun 2012 17:03:18 +0000 (18:03 +0100)]
Import CCHOME from the environment when building with GCC on Windows

Using the environment for such things is preferable to always having to
specify a CCHOME= command-line argument, and is akin to setting various
environment variables via vcvars32.bat for VC++ builds.

Also remove a blank line to make it more obvious that copying DLLs to the
t/ folder is part of the test-prep target. (This is one thing which
doesn't work if CCHOME has not been set and MinGW isn't installed in its
default location.)

11 years agoFix tab completion of module names in the debugger
Vincent Pit [Mon, 25 Jun 2012 14:07:25 +0000 (16:07 +0200)]
Fix tab completion of module names in the debugger

Also broken by 'use strict'.

11 years agoFix restarting a debugging session opened for a one-liner
Vincent Pit [Mon, 25 Jun 2012 13:56:27 +0000 (15:56 +0200)]
Fix restarting a debugging session opened for a one-liner

It was broken by 'use strict' as well.

11 years agoFix (and test) module listing in the debugger
Vincent Pit [Mon, 25 Jun 2012 13:49:06 +0000 (15:49 +0200)]
Fix (and test) module listing in the debugger

This was also broken when 'use strict' was added.

11 years agoFix (and test) breakpoints on subroutines
Vincent Pit [Mon, 25 Jun 2012 13:06:49 +0000 (15:06 +0200)]
Fix (and test) breakpoints on subroutines

They were broken since 'use strict' was added to the debugger.

11 years agoperldelta for 8b8c1fb
Jesse Luehrs [Mon, 25 Jun 2012 05:53:55 +0000 (00:53 -0500)]
perldelta for 8b8c1fb

11 years agoallow "my ()" [perl #113554]
Jesse Luehrs [Mon, 25 Jun 2012 05:39:57 +0000 (00:39 -0500)]
allow "my ()" [perl #113554]

it looks like this was an unrelated bugfix during development of mad,
but which was merged into core with #ifdef PERL_MAD just because it was
a change from the existing perl code... i don't see any reason why this
should have been ifdef'd out to begin with

11 years agoperldelta for 100c03a, f914a68, and 61a3fb8
Jesse Luehrs [Mon, 25 Jun 2012 00:00:54 +0000 (19:00 -0500)]
perldelta for 100c03a, f914a68, and 61a3fb8

11 years agoAdd E. Choroba to AUTHORS
Father Chrysostomos [Sun, 24 Jun 2012 21:14:01 +0000 (14:14 -0700)]
Add E. Choroba to AUTHORS

11 years agoFix Exporter.pm documentation: Notes are not code.
E. Choroba [Sun, 24 Jun 2012 20:28:29 +0000 (22:28 +0200)]
Fix Exporter.pm documentation: Notes are not code.

11 years agoperldiag: Document ‘Integer overflow in srand’
Father Chrysostomos [Sun, 24 Jun 2012 21:05:18 +0000 (14:05 -0700)]
perldiag: Document ‘Integer overflow in srand’

11 years agodiag.t: Cull exceptions
Father Chrysostomos [Sun, 24 Jun 2012 21:00:03 +0000 (14:00 -0700)]
diag.t: Cull exceptions

11 years agodiag.t: Don’t skip lines starting with spaces
Father Chrysostomos [Sun, 24 Jun 2012 20:52:09 +0000 (13:52 -0700)]
diag.t: Don’t skip lines starting with spaces

11 years agoperldiag: Remove initial %s: from regexp messages
Father Chrysostomos [Sun, 24 Jun 2012 20:42:59 +0000 (13:42 -0700)]
perldiag: Remove initial %s: from regexp messages

Commit b45f050a81 moved the initial /%s/: and changed it to a final
‘in regex m/%s/’, but some perldiag entries were not updated.

11 years agoperldiag: document ‘Invalid negative number’ in chr
Father Chrysostomos [Sun, 24 Jun 2012 20:26:48 +0000 (13:26 -0700)]
perldiag: document ‘Invalid negative number’ in chr

11 years agoUnbreak diag.t
Father Chrysostomos [Sun, 24 Jun 2012 20:22:59 +0000 (13:22 -0700)]
Unbreak diag.t

In speeding in up in commit de53a0eaa2de, I actually broke it such
that it only looked for DIE.

11 years agoperldiag: Help splain find version overflow msg
Father Chrysostomos [Sun, 24 Jun 2012 19:22:13 +0000 (12:22 -0700)]
perldiag: Help splain find version overflow msg

There are two variants, and only one was listed here.

11 years agoperldiag: ‘Integer overflow in %s number’ is S
Father Chrysostomos [Sun, 24 Jun 2012 19:20:21 +0000 (12:20 -0700)]
perldiag: ‘Integer overflow in %s number’ is S

11 years agoperldiag: ‘Integer overflow in version’ is W
Father Chrysostomos [Sun, 24 Jun 2012 18:22:10 +0000 (11:22 -0700)]
perldiag: ‘Integer overflow in version’ is W

11 years agoperldiag: typo
Father Chrysostomos [Sun, 24 Jun 2012 18:20:47 +0000 (11:20 -0700)]
perldiag: typo

11 years agoDon’t crash with ()=&CORE::srand
Father Chrysostomos [Sun, 24 Jun 2012 18:14:29 +0000 (11:14 -0700)]
Don’t crash with ()=&CORE::srand

Ops that don’t allow arbitrarily long argument lists are flagged at compile-time with the number of children.

Coresubs have to call the same op with differing numbers of arguments,
so they push nulls on to the stack to make up the number of items the
pp function expects to pop.

Commit f914a6829 stopped popping the null of the stack.

Before:
$ ./perl -le 'print &CORE::srand'
1240765685

After:
$ ./perl -le 'print &CORE::srand'
Bus error

List assignment does the same thing, and makes it easier to
write a test.

11 years agoadd warning for negative argument to chr() [perl #83048]
Jesse Luehrs [Sun, 24 Jun 2012 08:47:39 +0000 (03:47 -0500)]
add warning for negative argument to chr() [perl #83048]

11 years agowarn when srand overflows [perl #40605]
Jesse Luehrs [Sun, 24 Jun 2012 08:10:05 +0000 (03:10 -0500)]
warn when srand overflows [perl #40605]

11 years ago[perl #113796] lib/File/stat.t failures when -l $^X
Father Chrysostomos [Sun, 24 Jun 2012 07:10:55 +0000 (00:10 -0700)]
[perl #113796] lib/File/stat.t failures when -l $^X

It seems that gcc produces this:

$ ./perl -Ilib -e 'warn $^X'
/Users/sprout/Perl/perl.git/perl at -e line 1.

while g++ produces this:

$ ./perl -Ilib -e 'warn $^X'
./perl at -e line 1.

(I may be misdiagnosing this, but I have two blead builds that give
different values for $^X.)

The script is using $^X for testing, which is why it could produce
different results.

In any case, this produces the same output for both compilers:

use File::stat;
my $stat = File::stat::stat('./perl');
warn eval '-l $stat';
warn eval '-l "./perl"';
__END__
Warning: something's wrong at - line 3.
1 at - line 4.

The test is wrong, as -l _ will fail after a stat.  You have to do
lstat for -l _ to work.  Similarly, -l $stat_obj should only return
true if the $stat_obj was returned by File::stat::lstat.

This commit adjusts the test accordingly.

11 years agoperlfunc: (caller)[9] is ${^WARNING_BITS}
Father Chrysostomos [Sun, 24 Jun 2012 01:29:03 +0000 (18:29 -0700)]
perlfunc: (caller)[9] is ${^WARNING_BITS}

Technically, (caller)[9] returns ${^WARNING_BITS} if defined, or, if
${^WARNING_BITS} is not defined, whatever ‘use warnings’ or ‘no
warnings’ would set ${^WARNING_BITS} to, depending on the value of
$^W.  But that is subject to change, and is a bit of a mouthful.

11 years agodon't let arriving signals reset $@ [perl #45173]
Jesse Luehrs [Sun, 24 Jun 2012 06:23:49 +0000 (01:23 -0500)]
don't let arriving signals reset $@ [perl #45173]

since signals can arrive at any point, clearing $@ isn't a safe
thing to do

11 years ago[perl #64772] make the read-only-sync test a bit more portable
Tony Cook [Sat, 23 Jun 2012 03:41:19 +0000 (13:41 +1000)]
[perl #64772] make the read-only-sync test a bit more portable

- Win32 simply doesn't support fsync, and %Config reflects that

- sync() on a file seems more portable to me than on a directory, and
  the first is enough to test the code path we want to test.

- AIX is documented to fail fsync() on a read-only handle, so skip
  there

11 years ago[perl #112966] Crash on delete local; other local bugs
Father Chrysostomos [Sat, 23 Jun 2012 20:59:34 +0000 (13:59 -0700)]
[perl #112966] Crash on delete local; other local bugs

Commit bee7c5743fa appears to have fixed this.  But what it does is
barely significant:

diff --git a/sv.c b/sv.c
index b96f7c1..a4994f5 100644
--- a/sv.c
+++ b/sv.c
@@ -9525,6 +9525,11 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
     SvUPGRADE(tmpRef, SVt_PVMG);
     SvSTASH_set(tmpRef, MUTABLE_HV(SvREFCNT_inc_simple(stash)));

+    if (Gv_AMG(stash))
+ SvAMAGIC_on(sv);
+    else
+ (void)SvAMAGIC_off(sv);
+
     if(SvSMAGICAL(tmpRef))
         if(mg_find(tmpRef, PERL_MAGIC_ext) || mg_find(tmpRef, PERL_MAGIC_uvar))
             mg_set(tmpRef);

The crash can still be triggered another way.  Instead of a blessing,
we need to modify a method (to turn on the potentially-overloaded
flag) and then use an operator that respects overloading.  This exam-
ple crashes before and after bee7c5743fa:

eval 'sub Sample::foo {}';
"".bless {},'Sample';
delete local $Sample::{ '()' };

It is the recalculation of overload caches before a localised deletion
that causes the crash.  And it only happens when the '()' key does
not exist.

Actually, it turns out that S_delete_local doesn’t behave correctly
for rmagical aggregates, except for %ENV:

$ ./perl -Ilib -MDevel::Peek -e 'delete local $ISA[0]'
Bus error
$ ./perl -XIlib -MDevel::Peek -e '??; delete local $::{foo}'
Bus error

It’s this line, which occurs twice in pp.c:S_do_delete_local, which
is at fault:

const bool can_preserve = SvCANEXISTDELETE(osv)
    || mg_find((const SV *)osv, PERL_MAGIC_env);

When can_preserve is true, the ‘preeminent’ variable is set based on
whether the element exists.  Otherwise it is set to true.

Why the term ‘preeminent’ was chosen I don’t know, but in this case it
means that the element already exists, so it has to be restored after-
wards.  We can’t just do save_delete.

The code for saving a hash element assumes it is non-null, and crashes
otherwise.

The logic for setting can_preserve is wrong.  SvCANEXISTDELETE returns
true for non-magical variables and for variables with those tie meth-
ods implemented.  For magical variables that are not tied, it returns
the wrong answer.  PERL_MAGIC_env seems to have been added as an
exception, to keep it working.  But other magical aggregates were not
accounted for.

This logic was copied from other functions (aslice, hslice, etc.),
which are similarly buggy, but they don’t crash:

$ ./perl -Ilib -le ' { local $::{foo} } print exists $::{foo}'

$ ./perl -Ilib -le 'm??; { local $::{foo} } print exists $::{foo}'
1

In all these cases, it is SvCANEXISTDELETE that is buggy.  So this
commit fixes it and adds tests for all the code paths that use it.
Now no exception needs to be made for PERL_MAGIC_env.

11 years agoclarify the $hints and $bitmask values in caller()
Jesse Luehrs [Sat, 23 Jun 2012 19:45:09 +0000 (14:45 -0500)]
clarify the $hints and $bitmask values in caller()

11 years agoperldelta for 61c2a93 and 68b4061
Jesse Luehrs [Sat, 23 Jun 2012 18:01:59 +0000 (13:01 -0500)]
perldelta for 61c2a93 and 68b4061

11 years agoalso make sure ->isa works on undeclared packages
Jesse Luehrs [Fri, 22 Jun 2012 18:56:15 +0000 (13:56 -0500)]
also make sure ->isa works on undeclared packages

11 years agoall packages can do methods in UNIVERSAL [perl #47113]
Jesse Luehrs [Fri, 22 Jun 2012 18:34:49 +0000 (13:34 -0500)]
all packages can do methods in UNIVERSAL [perl #47113]

Foo->can("can") should be true even if "package Foo" hasn't been seen
yet (obviously, since that method call doesn't die with a method not
found error).

11 years agoregen pod issues
Father Chrysostomos [Sat, 23 Jun 2012 16:36:51 +0000 (09:36 -0700)]
regen pod issues

11 years ago[perl #113798] Don’t hide PATH from perlglob
Father Chrysostomos [Sat, 23 Jun 2012 16:34:26 +0000 (09:34 -0700)]
[perl #113798] Don’t hide PATH from perlglob

To fix another bug, miniperl was changed to clear out %ENV before
shelling out to call the underlying glob program (csh on Unix;
perlglob on Windows), in commit a3342be368.

That proved slightly problematic, as it stopped <~> from working on
Unix, so commit 93b2dae1 changed it to preserve just $ENV{HOME}.

That turns out not to have been enough.  For some compilers, Win-
dows needs PATH preserved for perlglob to find certain DLLs it
needs to load.

11 years agoExporter.pm: long lines in verbatim pod
Father Chrysostomos [Sat, 23 Jun 2012 16:29:02 +0000 (09:29 -0700)]
Exporter.pm: long lines in verbatim pod

11 years agoExporter’s docs: mention require_version, but honestly
Father Chrysostomos [Sat, 23 Jun 2012 16:25:39 +0000 (09:25 -0700)]
Exporter’s docs: mention require_version, but honestly

Since Exporter supplies a require_version method, it does deserve a
mention in the docs.

11 years agoAdd François Perrad to AUTHORS
Father Chrysostomos [Sat, 23 Jun 2012 06:39:46 +0000 (23:39 -0700)]
Add François Perrad to AUTHORS

11 years agosquash with export headres
Father Chrysostomos [Sat, 23 Jun 2012 06:38:30 +0000 (23:38 -0700)]
squash with export headres

11 years agocopy .offs only if not null.
Francois Perrad [Wed, 16 May 2012 15:55:22 +0000 (17:55 +0200)]
copy .offs only if not null.

11 years agoExporter.pm: Capitalise subheaders consistently
Father Chrysostomos [Sat, 23 Jun 2012 06:31:44 +0000 (23:31 -0700)]
Exporter.pm: Capitalise subheaders consistently

11 years agoExporter.pm: Consistent spaces after dots
Father Chrysostomos [Sat, 23 Jun 2012 06:25:00 +0000 (23:25 -0700)]
Exporter.pm: Consistent spaces after dots

11 years agoIncrease $Exporter::VERSION to 5.67
Father Chrysostomos [Sat, 23 Jun 2012 06:21:13 +0000 (23:21 -0700)]
Increase $Exporter::VERSION to 5.67

11 years agocmpVERSION.pl: Correct err msg
Father Chrysostomos [Sat, 23 Jun 2012 06:20:09 +0000 (23:20 -0700)]
cmpVERSION.pl: Correct err msg

11 years ago[perl #112856] Exporter’s docs: expunge require_version
Father Chrysostomos [Sat, 23 Jun 2012 06:16:08 +0000 (23:16 -0700)]
[perl #112856] Exporter’s docs: expunge require_version

This sub hasn’t been called for eleven years, since 22b4675c82b54.

The docs were never updated to account.

There’s no point in even mentioning require_version, as it has
been so long.

11 years ago#101666: horrible regex parsing error error [sic]
Yves Orton [Sat, 23 Jun 2012 11:34:41 +0000 (13:34 +0200)]
#101666: horrible regex parsing error error [sic]

We were producing a very confusing error when a group name
did not start with an identifier. This patch tries to improve the situation.

11 years agoturns out we cant maike a jump trie that starts with a NOTHING regop
Yves Orton [Thu, 21 Jun 2012 18:42:07 +0000 (20:42 +0200)]
turns out we cant maike a jump trie that starts with a NOTHING regop

NOTHING nodes are 1 regop wide. We need 2 regops worth of
space. Which means that we can not safely optimise a sequence
that starts with a NOTHING regop that needs to turn into
a jump trie. We therefore ignore such sequences.

see perl #113770 for details.

11 years agodo not try to restore state of pseudosignal zero
Chip Salzenberg [Thu, 21 Jun 2012 22:51:33 +0000 (15:51 -0700)]
do not try to restore state of pseudosignal zero

11 years agoAlso handle the case IVSIZE == I32SIZE when resetting the array iterator
Vincent Pit [Fri, 22 Jun 2012 17:21:50 +0000 (19:21 +0200)]
Also handle the case IVSIZE == I32SIZE when resetting the array iterator

11 years agoReset the iterator when an array is cleared
Vincent Pit [Fri, 22 Jun 2012 13:55:55 +0000 (15:55 +0200)]
Reset the iterator when an array is cleared

This fixes RT #75596.

11 years ago[perl #112826] Make Tie::StdHandle::READ respect offset
Father Chrysostomos [Fri, 22 Jun 2012 02:02:28 +0000 (19:02 -0700)]
[perl #112826] Make Tie::StdHandle::READ respect offset

Tie::StdHandle::READ was ignoring the optional fourth argument to
read(), specifying the offset into the target string.

11 years agoIncrease $Tie::StdHandle::VERSION to 4.3
Father Chrysostomos [Fri, 22 Jun 2012 01:58:59 +0000 (18:58 -0700)]
Increase $Tie::StdHandle::VERSION to 4.3

11 years agoRevert to the correct value of lddlflags for AddressSanitizer
Vincent Pit [Fri, 22 Jun 2012 12:02:20 +0000 (14:02 +0200)]
Revert to the correct value of lddlflags for AddressSanitizer

-Afoo=val appends 'val' to the value of variable foo after the platform
hints are processed, but before the default value is computed by Configure.
At this time, 'foo' appears as non-empty and Configure skips the default
logic. This is the reason -shared must always be added to lddlflags.

I don't know why I didn't caught this while testing AddressSanitizer builds.

11 years agoRun podtidy on perlhacktips
Vincent Pit [Fri, 22 Jun 2012 09:59:26 +0000 (11:59 +0200)]
Run podtidy on perlhacktips

11 years agoClarify how AddressSanitizer should be invoked when useshrplib is set
Vincent Pit [Fri, 22 Jun 2012 09:57:31 +0000 (11:57 +0200)]
Clarify how AddressSanitizer should be invoked when useshrplib is set

11 years agoPOD typo in perlfunc
Shirakata Kentaro [Fri, 22 Jun 2012 09:12:39 +0000 (11:12 +0200)]
POD typo in perlfunc

This fixes [RT #113788]

11 years agoFixed repeated words
Walt Mankowski [Fri, 22 Jun 2012 02:36:00 +0000 (22:36 -0400)]
Fixed repeated words

11 years agopp_sassign: explain the mix of left<=>right in the optree
Reini Urban [Thu, 21 Jun 2012 22:47:20 +0000 (17:47 -0500)]
pp_sassign: explain the mix of left<=>right in the optree

Fix the names in the function to make it readable. lhs and rhs reflect now
the parsed source not the position on the optree stack.

11 years agotoke.c: Add, clarify comments
Karl Williamson [Thu, 21 Jun 2012 15:40:20 +0000 (09:40 -0600)]
toke.c: Add, clarify comments

11 years agotoke.c: Make new error UTF-8 safe
Brian Fraser [Tue, 19 Jun 2012 20:05:18 +0000 (17:05 -0300)]
toke.c: Make new error UTF-8 safe

Commit 0da72d5e623b55d88fb3772b9c91e8f2d1ea7c40 introduced a new error
message, but did not account for UTF-8 source.

11 years agoperldelta for a3ff80c
Jesse Luehrs [Thu, 21 Jun 2012 14:16:09 +0000 (09:16 -0500)]
perldelta for a3ff80c

11 years agodocument some more Gv* macros
Jesse Luehrs [Thu, 21 Jun 2012 14:06:06 +0000 (09:06 -0500)]
document some more Gv* macros

11 years agoSync Module-CoreList in Maintainers.pl with CPAN
Chris 'BinGOs' Williams [Thu, 21 Jun 2012 07:52:43 +0000 (08:52 +0100)]
Sync Module-CoreList in Maintainers.pl with CPAN

11 years agoMerge fix for File::stat's -x and -X for root, and test improvements.
Nicholas Clark [Thu, 21 Jun 2012 07:01:19 +0000 (09:01 +0200)]
Merge fix for File::stat's -x and -X for root, and test improvements.

11 years agolib/File/stat.t shouldn't test -A $^X
Nicholas Clark [Tue, 19 Jun 2012 10:33:50 +0000 (12:33 +0200)]
lib/File/stat.t shouldn't test -A $^X

Testing this fails intermittently on darwin, which has POSIXly-correct atime
semantics. When tests run in parallel, the atime of $^X will update whenever
another perl process starts, which is a race condition with this test.

11 years agoFix File::stat's -x and -X for root for directories and executable files.
Nicholas Clark [Mon, 18 Jun 2012 11:09:02 +0000 (13:09 +0200)]
Fix File::stat's -x and -X for root for directories and executable files.

Previously File::stat's overloaded -x and -X operators did not give
the correct results for directories or executable files when running as
root. They had been treating executable permissions for root just like for
any other user, performing group membership tests etc. for files not owned
by root. They now follow the correct Unix behaviour - for a directory they
are always true, and for a file if any of the three execute permission bits
are set then they report that root can execute the file. Perl's builtin
-x and -X operators, added in Perl 2, have always been correct.

11 years agoTest that File::stat exports stat by default, overriding the builtin.
Nicholas Clark [Wed, 13 Jun 2012 16:01:48 +0000 (18:01 +0200)]
Test that File::stat exports stat by default, overriding the builtin.

Also, add a test that the array produced by File::stat::stat is identical to
the list produced by the builtin.

11 years agolib/File/stat.t should also test the -X operators on directories.
Nicholas Clark [Mon, 18 Jun 2012 10:53:29 +0000 (12:53 +0200)]
lib/File/stat.t should also test the -X operators on directories.

11 years agoIn lib/File/stat.t, permute the test file's mode for more thorough testing.
Nicholas Clark [Wed, 13 Jun 2012 15:50:14 +0000 (17:50 +0200)]
In lib/File/stat.t, permute the test file's mode for more thorough testing.

For each mode bit set, and all bits clear, test each filetest operator with
and without a File::stat object. Previously the only test was for the mode
the file was created with.

11 years agoRefactor lib/File/stat.t for robustness.
Nicholas Clark [Wed, 13 Jun 2012 15:34:11 +0000 (17:34 +0200)]
Refactor lib/File/stat.t for robustness.

Use CORE::stat instead of stat, to be clear which is the builtin, and which
is the routine that File::stat is prepared to export. As it is now
unambiguous which is which, remove comments that annotated each use.

Use isa_ok() in place of ok() to test the return value of File::stat::stat.
Use is_deeply() in place of is() and arrays interpolated into strings.

Move the data driven loop that tests most of the -X operators into a
function test_X_ops(), and use this to test both the tempfile
(non-executable) and $^X (executable).

Put the first sanity test of File::stat::stat inside a block so that its
lexicals don't leak.

11 years ago*Actually* test that bug 20011110.104 is fixed.
Nicholas Clark [Wed, 13 Jun 2012 14:45:40 +0000 (16:45 +0200)]
*Actually* test that bug 20011110.104 is fixed.

Bug ID 20011110.104 (RT #7896) was fixed by commit 2f173a711df6278f in Nov
2001, but the test that commit added never actually tested this.

The initial problem was that the new code, as written, used C<stat>,
intending that to call File::stat::stat(). However the refactoring of the
test script (all part of the same commit) from C<use File::stat;> to
C<use_ok( 'File::stat' );> (not in a BEGIN block) intentionally eliminated
the export of &File::stat::stat. This means that plain C<stat> is the
core builtin.

Fixing this as-is to File::stat::stat() won't help, as tests have
subsequently been added earlier in the script that trigger the autoloading
of Symbol by File::stat (commit 83716b1ec25b41f2 in Feb 2002). Moving the
tests earlier won't help now that the test uses File::Temp, as that uses
IO::Seekable which uses IO::Handle, which unconditionally loads Symbol.

The simplest solution seems to be to move the test to its own file.

11 years agoSimplify lib/File/stat.t by using a tempfile as the test victim.
Nicholas Clark [Sun, 3 Jun 2012 11:26:31 +0000 (13:26 +0200)]
Simplify lib/File/stat.t by using a tempfile as the test victim.

The previous code had got very gnarly trying to use a file from the
distribution for the test file, attempting to cope with
1) Other programs reading the file and hence the atime updating
2) The perl interpreter reading the file and hence the atime updating :-)
3) Building with -Dmksymlinks meaning that the file is a symlink

All these problems and work arounds simply *vanish* if we use a tempfile.
This will also enable us to change its mode in the future for better testing.

11 years agoRemove needless skip tests from lib/File/stat.t
Nicholas Clark [Wed, 13 Jun 2012 13:53:27 +0000 (15:53 +0200)]
Remove needless skip tests from lib/File/stat.t

The stat builtin is always implemented, so no need for an eval {} test to
check for this. The presence or absence of <sys/stat.h> at the C level isn't
going to affect the outcome of this test.

Both have been in the test script since it was added (as t/lib/filestat.t)
by commit f7a45afb043dafc5 in May 2001. I suspect that both were copied
from one of the Net::* test scripts which was being used as the template.

11 years agoIn lib/File/stat.t, test everything with and without use filetest "access".
Nicholas Clark [Sun, 3 Jun 2012 10:45:24 +0000 (12:45 +0200)]
In lib/File/stat.t, test everything with and without use filetest "access".

Previously the use filetest "access" tests were separate, and didn't test
all the "should not warn" cases. By moving them into the main data-driven
loop it's trivial to test everything.

Also test that all the correct errors are seen on VMS, and not seen anywhere
else.

11 years agoBring the joy of strict (and warnings) to lib/File/stat.t
Nicholas Clark [Sun, 3 Jun 2012 09:42:20 +0000 (11:42 +0200)]
Bring the joy of strict (and warnings) to lib/File/stat.t

11 years agoReplace repetitive code in lib/File/stat.t with a data driven loop.
Nicholas Clark [Sat, 2 Jun 2012 20:51:14 +0000 (22:51 +0200)]
Replace repetitive code in lib/File/stat.t with a data driven loop.

11 years agoConvert lib/File/stat.t from a complex plan calculation to done_testing().
Nicholas Clark [Sat, 2 Jun 2012 20:42:47 +0000 (22:42 +0200)]
Convert lib/File/stat.t from a complex plan calculation to done_testing().

Also replace use_ok (not in BEGIN) with a simple require. If the require
fails it's not worth trying to test anything else, Test::More's END
handing will automatically report a test failure, so the failure will be
recorded.

Add an editor block.

11 years agoIncrease $PerlIO::scalar::VERSION to 0.15
Father Chrysostomos [Thu, 21 Jun 2012 06:34:19 +0000 (23:34 -0700)]
Increase $PerlIO::scalar::VERSION to 0.15

11 years ago[perl #113764] Make &= duping work with PerlIO::scalar
Father Chrysostomos [Thu, 21 Jun 2012 06:33:28 +0000 (23:33 -0700)]
[perl #113764] Make &= duping work with PerlIO::scalar

In trying to fix bug #112780, I made in-memory handle duplication tem-
porarily hide the underlying scalar so it wouldn’t be set to the empty
string (commit 49b69fb3a).

I used PerlIO_sv_dup in j rather than PerlIOScalar_arg.  The for-
mer is usually what is called anyway.  There is only one branch of
PerlIOScalar_arg that doesn’t call PerlIO_sv_dup.  I don’t remember
what I was thinking back then, but I think I thought that branch
was there for paranoia.  But actually, it is used for "&=", so this
started failing:

open FILE, '>', \my $content or die "Couldn't open scalar filehandle";
open my $fh, ">&=FILE" or die "Couldn't open: $!";
print $fh "Foo-Bar\n";
close $fh;
close FILE;
print $content;

This commit fixes the bug in the smallest way possible, which means
switching from PerlIO_sv_dup to PerlIOScalar_arg in PerlIOScalar_arg,
which, in turn, entails fiddling with RVs.