summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-02-26 19:39:59 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-02-26 19:39:59 +0000
commit5835a53570f35b039e8d3e451ea2f3f3b801d7f8 (patch)
tree5a410f90e7e9e57bec70095d1fb703b0d7951a8f
parent338b3df38e7fa09969e9c4ca3c85fdfba880486d (diff)
downloadperl-5835a53570f35b039e8d3e451ea2f3f3b801d7f8.tar.gz
Integrate:
[ 18746] Subject: Re: -Os for Darwin why? From: schwern@pobox.com Date: tis feb 18, 2003 20:37:39 Europe/Stockholm Message-Id: <20030218113739.D25848@ttul.org> [ 18748] Subject: [PATCH IO/Socket/INET.pm] Blocking option ignored From: Dave Mitchell <davem@fdgroup.com> Date: Tue, 18 Feb 2003 21:45:45 +0000 Message-ID: <20030218214545.C18547@fdgroup.com> and tests for the same: From: Dave Mitchell <davem@fdgroup.com> Date: Wed, 19 Feb 2003 00:42:01 +0000 Message-ID: <20030219004201.F18547@fdgroup.com> [ 18753] Subject: Re: [perl #20716] scope error with brackets From: Enache Adrian <enache@rdslink.ro> Date: Thu, 13 Feb 2003 04:52:21 +0200 Message-ID: <20030213025221.GA1215@ratsnest.hole> (better version of change #18687) [ 18754] Document clearly that "_" is always in package "main". [ 18755] Subject: [PATCH] 5.8.0: typo in pod/perlcompile.pod From: Brendan O'Dea <bod@debian.org> Date: Sun, 16 Feb 2003 21:09:23 +1100 Message-ID: <20030216100923.GA29761@londo.c47.org> [ 18756] Doc tweakage on -C. [ 18757] Subject: [PATCH: perl@186389] add probe for yet another dangerous logical name: COMP From: PPrymmer@factset.com Date: Wed, 19 Feb 2003 15:04:40 -0500 Message-ID: <OFC0A627AD.02B9D968-ON85256CD2.006DDC21@factset.com> [ 18758] Subject: [PATCH: perl@18639] add some IV stuff to ext/Devel/Peek/Peek.t test 21 From: PPrymmer@factset.com Date: Thu, 20 Feb 2003 13:28:09 -0500 Message-ID: <OF2DC297F4.A63F24F9-ON85256CD3.006513E4@factset.com> [ 18759] Change regex to be a bit more friendly against various outputs from ps -f, regex suggest by rgs [ 18760] API doc tweaks. [ 18761] Chip noticed that the intended optionality of the 'IV' was forgotten in the change #18758. [ 18762] Remove no-longer-true line from perlop [ 18763] Use PL_{argv,stdin,stdout}gv to avoid unnecessary gv_fetch calls. [ 18764] Patching magic from Inaba-san's keyboard: fix for [perl #8769]: "scalar upgraded to UTF-8 as a side effect of quote-interpolation when 'use encoding' is engaged"-- wasn't actually encoding's fault. [ 18766] PERL_SIGNALS=unsafe enables the old unsafe/immediate signals. [ 18767] In Porting scripts, use standard perl path of "/usr/bin/perl". [ 18768] Include p4d2p in Porting again, because p4genpatch doesn't work until a change has been submitted. [ 18770] A new try at #18765 (for [perl #20920]). [ 18771] Cleanup #18770 as suggested by Rafael. [ 18772] Subject: [perl@18752] warnings from CGI tests under cygwin From: sthoenna@efn.org (Yitzchak Scott-Thoennes) Date: Wed, 19 Feb 2003 13:37:39 -0800 Message-ID: <jk/U+gzkg2DE092yn@efn.org> [ 18773] Subject: [Encode] 1.88 Released From: Dan Kogai <dankogai@dan.co.jp> Date: Thu, 20 Feb 2003 23:49:55 +0900 Message-Id: <935F75D0-44E2-11D7-B310-000393AE4244@dan.co.jp> [ 18774] Subject: Re: [perl #21321] local ${"FOO"} does not work From: Rafael Garcia-Suarez <rgarciasuarez@free.fr> Date: Sun, 23 Feb 2003 00:03:27 +0100 Message-Id: <20030223000327.6f0c11fa.rgarciasuarez@free.fr> [ 18775] Subject: [perl #20684] [fix] s/// with (??{..}) inside returns wrong count From: Enache Adrian <enache@rdslink.ro> Date: Fri, 21 Feb 2003 17:49:41 +0200 Message-ID: <20030221154941.GA793@ratsnest.hole> [ 18776] Subject: [perl #20682] [fix] @- array not visible in s/// From: Enache Adrian <enache@rdslink.ro> Date: Fri, 21 Feb 2003 17:50:14 +0200 Message-ID: <20030221155014.GB793@ratsnest.hole> [ 18777] More variables for change #18776. [ 18778] Add missing file from change #18774. [ 18779] Add tests for the -C switch. Depending on the CLIs some $^O dance may be needed. [ 18780] Two typos found by Philip Newton <pnewton@gmx.de> [ 18781] regen headers [ 18782] Subject: Re: [perl #20683] [fix] Better Patch From: Enache Adrian <enache@rdslink.ro> Date: Sun, 23 Feb 2003 20:16:39 +0200 Message-ID: <20030223181639.GA18713@ratsnest.hole> p4raw-link: @18782 on //depot/perl: faf82a0b75a45f1e4dbb7ad8cecdfaf9a30a643d p4raw-link: @18781 on //depot/perl: bd5cf8491554ab1313db72afbf9e7bc1debe967c p4raw-link: @18780 on //depot/perl: a6d6498ea9ab397c0dd0492b08f0b2d4327052d8 p4raw-link: @18779 on //depot/perl: 76dd4efc0032d8cf72bade55b190df61909f479d p4raw-link: @18778 on //depot/perl: 22efcfd695558c79203ea419fa22b3dfdc2549ee p4raw-link: @18777 on //depot/perl: f702bf4a18c28d214aa0d9f3699ad336576ea7b2 p4raw-link: @18776 on //depot/perl: 83b43d9236da9ea6e31fd2df2474f4d7f7220a85 p4raw-link: @18775 on //depot/perl: 22e13caa16a0052ac27896caeb4c33581f86e239 p4raw-link: @18774 on //depot/perl: 82d039840b913b4eed10833ac05709a5abd02ead p4raw-link: @18773 on //depot/perl: cc7dbc11d7cd9ed68bb2fbc677f60586de194a05 p4raw-link: @18772 on //depot/perl: 3292f4263d4135b93f4022a8bad55fc98397b523 p4raw-link: @18771 on //depot/perl: 16bd9a85dbc3be76d00459adeafa5bf918a5212d p4raw-link: @18770 on //depot/perl: 25da442874cf6136cfd7e0a24430b1ec13c17197 p4raw-link: @18768 on //depot/perl: 70dff1ffd3015a4493d81957b4a83083b5c17679 p4raw-link: @18767 on //depot/perl: 23b3bd7f4ea04a410bbe9a0b67cf4dbaa82b6992 p4raw-link: @18766 on //depot/perl: 4ffa73a366885f682ceccdeee45e43075e0c312e p4raw-link: @18764 on //depot/perl: db79b45b3c913399aef4d2f3647453e63c4772a8 p4raw-link: @18763 on //depot/perl: 8fde6460a7cb90e344d87e1652b5fa8d61c68699 p4raw-link: @18762 on //depot/perl: 573e01ca889ca9a9ae046f92457272ab11ee63d8 p4raw-link: @18761 on //depot/perl: 5e836f438feb614a0470dee68b7765d2c6f79353 p4raw-link: @18760 on //depot/perl: c9ada85fa9dc6257bae067a90718f01476f8c35f p4raw-link: @18759 on //depot/perl: 30cf872d9b23889ef292a003dd99d5ad22957835 p4raw-link: @18758 on //depot/perl: f0fabfd7a60ca1c99e9f3f4c4b66d46eab58e4d5 p4raw-link: @18757 on //depot/perl: b3b333bff9eb56ac9727a5c2f1c71ef38046a60e p4raw-link: @18756 on //depot/perl: 44505768b71a3dab2f8d695f923e3aae59ba065a p4raw-link: @18755 on //depot/perl: d9ba819c51d7d5aa20fa6b495b139a3f34eb63eb p4raw-link: @18754 on //depot/perl: 5b88253beb15ba0b9f2b2ef15037de4950b82796 p4raw-link: @18753 on //depot/perl: 7df0d0422c26edcc954b82bd79e461b99b3c4092 p4raw-link: @18748 on //depot/perl: 3c83a670ef5b88bf7bcdc0857c28022b13bf2106 p4raw-link: @18746 on //depot/perl: c803703701b66ee8fee828b4344c92c4d0124184 p4raw-link: @18687 on //depot/perl: 437fd2104756c25dedf68c6e31cd29ecbf0e2569 p4raw-id: //depot/maint-5.8/perl@18783 p4raw-integrated: from //depot/perl@18775 'ignore' t/op/subst.t (@18533..) p4raw-integrated: from //depot/perl@18774 'edit in' op.c (@18763..) p4raw-integrated: from //depot/perl@18770 'edit in' mg.c (@18769..) p4raw-integrated: from //depot/perl@18768 'edit in' MANIFEST (@18747..) p4raw-integrated: from //depot/perl@18766 'edit in' perl.h (@18727..) p4raw-integrated: from //depot/perl@18764 'edit in' pp_ctl.c (@18726..) p4raw-branched: from //depot/perl@18745 'branch in' t/op/localref.t t/run/switchC.t Porting/p4d2p (@16428..) p4raw-integrated: from //depot/perl@18745 'copy in' Porting/fixvars (@1613..) Porting/fixCORE (@1760..) Porting/patchls (@4633..) t/op/concat.t (@11812..) Porting/findvars (@12027..) ext/IO/lib/IO/t/io_sock.t (@12984..) ext/IO/lib/IO/Socket/INET.pm (@15153..) Porting/check83.pl (@15546..) ext/Encode/ucm/viscii.ucm (@15638..) pod/perlcompile.pod (@15716..) t/op/local.t (@16434..) README.vms (@17268..) Porting/makerel (@17553..) ext/DB_File/DB_File.pm (@18062..) configpm (@18083..) configure.com (@18277..) win32/perlhost.h (@18327..) Porting/genlog (@18390..) ext/threads/t/join.t (@18440..) lib/CGI.pm (@18494..) ext/Encode/t/enc_utf8.t (@18559..) t/op/pat.t (@18661..) ext/Encode/AUTHORS ext/Encode/Changes ext/Encode/Encode.pm ext/Encode/Encode.xs ext/Encode/lib/Encode/CJKConstants.pm ext/Encode/lib/Encode/Encoder.pm ext/Encode/t/enc_eucjp.t (@18663..) ext/Encode/Unicode/Unicode.xs (@18664..) t/comp/parser.t (@18687..) pod/perlrun.pod (@18756..) 'edit in' ext/Devel/Peek/Peek.t (@18761..) pp_hot.c sv.c (@18764..) 'merge in' pod/perlipc.pod (@18183..) pod/perlop.pod (@18300..) utf8.c (@18456..) pp_sys.c (@18581..) pod/perldiag.pod (@18715..) pp.c (@18720..) embed.fnc proto.h regexec.c sv.h (@18726..) embedvar.h intrpvar.h perlapi.h toke.c (@18727..) perl.c (@18730..) pod/perlvar.pod (@18731..) pod/perlapi.pod (@18733..) embed.h (@18734..) hints/darwin.sh (@18740..) util.c (@18741..)
-rw-r--r--MANIFEST5
-rw-r--r--Porting/check83.pl2
-rwxr-xr-xPorting/findvars2
-rwxr-xr-xPorting/fixCORE2
-rwxr-xr-xPorting/fixvars2
-rwxr-xr-xPorting/genlog2
-rw-r--r--Porting/makerel2
-rwxr-xr-xPorting/p4d2p84
-rw-r--r--Porting/patchls2
-rw-r--r--README.vms22
-rwxr-xr-xconfigpm2
-rw-r--r--configure.com1
-rw-r--r--embed.fnc1
-rw-r--r--embed.h6
-rw-r--r--embedvar.h5
-rw-r--r--ext/DB_File/DB_File.pm2
-rw-r--r--ext/Devel/Peek/Peek.t8
-rw-r--r--ext/Encode/AUTHORS1
-rw-r--r--ext/Encode/Changes22
-rw-r--r--ext/Encode/Encode.pm4
-rw-r--r--ext/Encode/Encode.xs4
-rw-r--r--ext/Encode/Unicode/Unicode.xs2
-rw-r--r--ext/Encode/lib/Encode/CJKConstants.pm4
-rw-r--r--ext/Encode/lib/Encode/Encoder.pm2
-rw-r--r--ext/Encode/t/enc_eucjp.t6
-rw-r--r--ext/Encode/t/enc_utf8.t10
-rw-r--r--ext/Encode/ucm/viscii.ucm7
-rw-r--r--ext/IO/lib/IO/Socket/INET.pm7
-rwxr-xr-xext/IO/lib/IO/t/io_sock.t16
-rw-r--r--ext/threads/t/join.t2
-rw-r--r--hints/darwin.sh9
-rw-r--r--intrpvar.h2
-rw-r--r--lib/CGI.pm4
-rw-r--r--mg.c27
-rw-r--r--op.c15
-rw-r--r--perl.c9
-rw-r--r--perl.h44
-rw-r--r--perlapi.h2
-rw-r--r--pod/perlapi.pod11
-rw-r--r--pod/perlcompile.pod10
-rw-r--r--pod/perldiag.pod4
-rw-r--r--pod/perlipc.pod6
-rw-r--r--pod/perlop.pod3
-rw-r--r--pod/perlrun.pod19
-rw-r--r--pod/perlvar.pod2
-rw-r--r--pp.c13
-rw-r--r--pp_ctl.c16
-rw-r--r--pp_hot.c30
-rw-r--r--pp_sys.c26
-rw-r--r--proto.h1
-rw-r--r--regexec.c17
-rw-r--r--sv.c13
-rw-r--r--sv.h12
-rw-r--r--t/comp/parser.t26
-rw-r--r--t/op/concat.t19
-rwxr-xr-xt/op/local.t4
-rw-r--r--t/op/localref.t85
-rwxr-xr-xt/op/pat.t19
-rwxr-xr-xt/op/subst.t13
-rw-r--r--t/run/switchC.t57
-rw-r--r--toke.c6
-rw-r--r--utf8.c11
-rw-r--r--util.c10
-rw-r--r--win32/perlhost.h6
64 files changed, 626 insertions, 162 deletions
diff --git a/MANIFEST b/MANIFEST
index 2d05935b04..b3d037649e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2295,7 +2295,8 @@ Porting/fixvars Find undeclared variables with C compiler and fix em
Porting/genlog Generate formatted changelogs by querying p4d
Porting/Glossary Glossary of config.sh variables
Porting/makerel Release making utility
-Porting/p4genpatch Obsoletes both p4desc and p4d2p
+Porting/p4d2p Generate patch from p4 diff
+Porting/p4genpatch Generate patch from p4 change in repository (obsoletes p4desc)
Porting/patching.pod How to report changes made to Perl
Porting/patchls Flexible patch file listing utility
Porting/pumpkin.pod Guidelines and hints for Perl maintainers
@@ -2582,6 +2583,7 @@ t/op/lex_assign.t See if ops involving lexicals or pad temps work
t/op/lfs.t See if large files work for perlio
t/op/list.t See if array lists work
t/op/local.t See if local works
+t/op/localref.t See if local ${deref} works
t/op/loopctl.t See if next/last/redo work
t/op/lop.t See if logical operators work
t/op/magic.t See if magic variables work
@@ -2687,6 +2689,7 @@ t/run/fresh_perl.t Tests that require a fresh perl.
t/run/noswitch.t Test aliasing ARGV for other switch tests
t/run/runenv.t Test if perl honors its environment variables.
t/run/switcha.t Test the -a switch
+t/run/switchC.t Test the -C switch
t/run/switches.t Tests for the other switches
t/run/switchF.t Test the -F switch
t/run/switchI.t Test the -I switch
diff --git a/Porting/check83.pl b/Porting/check83.pl
index 7006d23c1f..5851d9ffb6 100644
--- a/Porting/check83.pl
+++ b/Porting/check83.pl
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
# Check whether there are naming conflicts when names are truncated to
# the DOSish case-ignoring 8.3 format, plus other portability no-nos.
diff --git a/Porting/findvars b/Porting/findvars
index 2d3a9a3b8f..26a4bcf11d 100755
--- a/Porting/findvars
+++ b/Porting/findvars
@@ -1,4 +1,4 @@
-#!/l/local/bin/perl -w
+#!/usr/bin/perl -w
$pat = '';
# construct word list
diff --git a/Porting/fixCORE b/Porting/fixCORE
index 4c586d8969..f7f4539fd6 100755
--- a/Porting/fixCORE
+++ b/Porting/fixCORE
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/bin/perl -w
use Data::Dumper;
my $targ = shift;
diff --git a/Porting/fixvars b/Porting/fixvars
index a211e5816f..201c37f3ad 100755
--- a/Porting/fixvars
+++ b/Porting/fixvars
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/bin/perl -w
use Data::Dumper;
my $targ = (@ARGV) ? join(' ',@ARGV) : 'miniperl' ;
diff --git a/Porting/genlog b/Porting/genlog
index 48126f4fb4..98bccdd702 100755
--- a/Porting/genlog
+++ b/Porting/genlog
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/bin/perl -w
#
# Generate a nice changelist by querying perforce.
#
diff --git a/Porting/makerel b/Porting/makerel
index 8937b258a5..0f98fc9217 100644
--- a/Porting/makerel
+++ b/Porting/makerel
@@ -1,4 +1,4 @@
-#!/bin/env perl -w
+#!/usr/bin/perl -w
# A first attempt at some automated support for making a perl release.
# Very basic but functional - if you're on a unix system.
diff --git a/Porting/p4d2p b/Porting/p4d2p
new file mode 100755
index 0000000000..83b0021da5
--- /dev/null
+++ b/Porting/p4d2p
@@ -0,0 +1,84 @@
+#!/usr/bin/perl -wspi~
+
+#
+# reads a perforce style diff on stdin and outputs appropriate headers
+# so the diff can be applied with the patch program
+#
+# Gurusamy Sarathy <gsar@activestate.com>
+#
+
+BEGIN {
+ $0 =~ s|.*/||;
+ if ($h or $help) {
+ print STDERR <<USAGE;
+Usage: $0 [-v] [-h] files
+
+ -h print this help
+ -v output progress messages
+
+Does inplace edit of diff files output by the perforce commands
+"p4 describe", "p4 diff", and "p4 diff2". The result is suitable
+for feeding to the "patch" program.
+
+If no files are specified, reads from stdin and writes to stdout.
+
+WARNING: It only handles context or unified diffs.
+
+Example: p4 describe -du 123 | $0 > change-123.patch
+
+USAGE
+ exit(0);
+ }
+ unless (@ARGV) { @ARGV = '-'; undef $^I; }
+ use vars qw($thisfile $time $file $fnum $v $h $help);
+ $thisfile = "";
+ $time = localtime(time);
+}
+
+my ($cur, $match);
+$cur = m<^==== //depot/(.+?)\#\d+.* ====$> ... m<^(\@\@.+\@\@|\*+)$>;
+
+$match = $1;
+
+if ($ARGV ne $thisfile) {
+ warn "processing patchfile [$ARGV]\n" unless $ARGV eq '-';
+ $thisfile = $ARGV;
+}
+
+# while we are within range
+if ($cur) {
+ # set the file name after first line
+ if ($cur == 1) {
+ $file = $match;
+ $fnum++;
+ }
+ # emit the diff header when we hit last line
+ elsif ($cur =~ /E0$/) {
+ my $f = $file;
+
+ # special hack for perl so we can always use "patch -p1"
+ $f =~ s<^.*?(perl.*?/)><$1>;
+
+ # unified diff
+ if ($match =~ /^\@/) {
+ warn "emitting udiff header\n" if $v;
+ $_ = "Index: $f\n--- $f.~1~\t$time\n+++ $f\t$time\n$_";
+ }
+ # context diff
+ elsif ($match =~ /^\*/) {
+ warn "emitting cdiff header\n" if $v;
+ $_ = "Index: $f\n*** $f.~1~\t$time\n--- $f\t$time\n$_";
+ }
+ }
+ # see if we hit another patch (i.e. previous patch was empty)
+ elsif (m<^==== //depot/(.+?)\#\d+.* ====$>) {
+ $file = $match = $1;
+ }
+ # suppress all other lines in the header
+ else {
+ $_ = "";
+ }
+ warn "file [$file] line [$cur] file# [$fnum]\n" if $v;
+}
+
+$_ .= "End of Patch.\n" if eof;
diff --git a/Porting/patchls b/Porting/patchls
index 4329f4cebc..1803ef7263 100644
--- a/Porting/patchls
+++ b/Porting/patchls
@@ -1,4 +1,4 @@
-#!/bin/perl -w
+#!/usr/bin/perl -w
#
# patchls - patch listing utility
#
diff --git a/README.vms b/README.vms
index 2739c0eb8e..5ead137069 100644
--- a/README.vms
+++ b/README.vms
@@ -176,12 +176,22 @@ SYSTEM table then try DEFINE TMP "NL:" or somesuch in your process table)
otherwise simply deassign the dangerous logical names. The potentially
troublesome logicals and symbols are:
- TMP "LOGICAL"
- LIB "LOGICAL"
- T "LOGICAL"
- FOO "LOGICAL"
- EXT "LOGICAL"
- TEST "SYMBOL"
+ COMP "LOGICAL"
+ EXT "LOGICAL"
+ FOO "LOGICAL"
+ LIB "LOGICAL"
+ LIST "LOGICAL"
+ MIME "LOGICAL"
+ POSIX "LOGICAL"
+ SYS "LOGICAL"
+ T "LOGICAL"
+ THREAD "LOGICAL"
+ THREADS "LOGICAL"
+ TIME "LOGICAL"
+ TMP "LOGICAL"
+ UNICODE "LOGICAL"
+ UTIL "LOGICAL"
+ TEST "SYMBOL"
As a handy shortcut, the command:
diff --git a/configpm b/configpm
index 08e7099000..b705997c08 100755
--- a/configpm
+++ b/configpm
@@ -118,7 +118,7 @@ sub fetch_string {
my $quote_type = "'";
my $marker = "$key=";
- # Check for the common case, ' delimeted
+ # Check for the common case, ' delimited
my $start = index($Config_SH, "\n$marker$quote_type");
# If that failed, check for " delimited
if ($start == -1) {
diff --git a/configure.com b/configure.com
index 30dbd10648..be90a82887 100644
--- a/configure.com
+++ b/configure.com
@@ -6297,6 +6297,7 @@ $ EXIT
$ ENDSUBROUTINE ! Bad_environment
$ echo ""
$ echo4 "Checking for dangerous pre-existing global symbols and logical names."
+$ CALL Bad_environment "COMP"
$ CALL Bad_environment "EXT"
$ CALL Bad_environment "FOO"
$ CALL Bad_environment "LIB"
diff --git a/embed.fnc b/embed.fnc
index 833adf9529..fa97520d04 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -424,6 +424,7 @@ p |int |magic_setmglob |SV* sv|MAGIC* mg
p |int |magic_setnkeys |SV* sv|MAGIC* mg
p |int |magic_setpack |SV* sv|MAGIC* mg
p |int |magic_setpos |SV* sv|MAGIC* mg
+p |int |magic_setregexp|SV* sv|MAGIC* mg
p |int |magic_setsig |SV* sv|MAGIC* mg
p |int |magic_setsubstr|SV* sv|MAGIC* mg
p |int |magic_settaint |SV* sv|MAGIC* mg
diff --git a/embed.h b/embed.h
index 38f7f862f4..abd6811a8b 100644
--- a/embed.h
+++ b/embed.h
@@ -600,6 +600,9 @@
#define magic_setpos Perl_magic_setpos
#endif
#ifdef PERL_CORE
+#define magic_setregexp Perl_magic_setregexp
+#endif
+#ifdef PERL_CORE
#define magic_setsig Perl_magic_setsig
#endif
#ifdef PERL_CORE
@@ -3037,6 +3040,9 @@
#define magic_setpos(a,b) Perl_magic_setpos(aTHX_ a,b)
#endif
#ifdef PERL_CORE
+#define magic_setregexp(a,b) Perl_magic_setregexp(aTHX_ a,b)
+#endif
+#ifdef PERL_CORE
#define magic_setsig(a,b) Perl_magic_setsig(aTHX_ a,b)
#endif
#ifdef PERL_CORE
diff --git a/embedvar.h b/embedvar.h
index 74d49b7841..e63ce25ffd 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -425,6 +425,7 @@
#define PL_thrsv (PERL_GET_INTERP->Ithrsv)
#define PL_tokenbuf (PERL_GET_INTERP->Itokenbuf)
#define PL_uid (PERL_GET_INTERP->Iuid)
+#define PL_unicode (PERL_GET_INTERP->Iunicode)
#define PL_unsafe (PERL_GET_INTERP->Iunsafe)
#define PL_utf8_alnum (PERL_GET_INTERP->Iutf8_alnum)
#define PL_utf8_alnumc (PERL_GET_INTERP->Iutf8_alnumc)
@@ -446,8 +447,8 @@
#define PL_utf8_toupper (PERL_GET_INTERP->Iutf8_toupper)
#define PL_utf8_upper (PERL_GET_INTERP->Iutf8_upper)
#define PL_utf8_xdigit (PERL_GET_INTERP->Iutf8_xdigit)
+#define PL_utf8locale (PERL_GET_INTERP->Iutf8locale)
#define PL_uudmap (PERL_GET_INTERP->Iuudmap)
-#define PL_wantutf8 (PERL_GET_INTERP->Iwantutf8)
#define PL_warnhook (PERL_GET_INTERP->Iwarnhook)
#define PL_widesyscalls (PERL_GET_INTERP->Iwidesyscalls)
#define PL_xiv_arenaroot (PERL_GET_INTERP->Ixiv_arenaroot)
@@ -698,6 +699,7 @@
#define PL_sh_path (vTHX->Ish_path)
#define PL_sig_pending (vTHX->Isig_pending)
#define PL_sighandlerp (vTHX->Isighandlerp)
+#define PL_signals (vTHX->Isignals)
#define PL_sort_RealCmp (vTHX->Isort_RealCmp)
#define PL_splitstr (vTHX->Isplitstr)
#define PL_srand_called (vTHX->Isrand_called)
@@ -1007,6 +1009,7 @@
#define PL_Ish_path PL_sh_path
#define PL_Isig_pending PL_sig_pending
#define PL_Isighandlerp PL_sighandlerp
+#define PL_Isignals PL_signals
#define PL_Isort_RealCmp PL_sort_RealCmp
#define PL_Isplitstr PL_splitstr
#define PL_Isrand_called PL_srand_called
diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm
index 240b42ea26..fd5b38592c 100644
--- a/ext/DB_File/DB_File.pm
+++ b/ext/DB_File/DB_File.pm
@@ -1362,7 +1362,7 @@ still have bval default to C<"\n"> for variable length records, and
space for fixed length records.
Also note that the bval option only allows you to specify a single byte
-as a delimeter.
+as a delimiter.
=head2 A Simple Example
diff --git a/ext/Devel/Peek/Peek.t b/ext/Devel/Peek/Peek.t
index 3400ed3f43..fc78fdf5c4 100644
--- a/ext/Devel/Peek/Peek.t
+++ b/ext/Devel/Peek/Peek.t
@@ -260,7 +260,7 @@ do_test(15,
RV = $ADDR
SV = PVMG\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\(OBJECT,RMG\\)
+ FLAGS = \\(OBJECT,SMG\\)
IV = 0
NV = 0
PV = 0
@@ -413,6 +413,7 @@ do_test(20,
#
# TAINTEDDIR is not set on: OS2, AMIGAOS, WIN32, MSDOS
# environment variables may be invisibly case-forced, hence the (?i:PATH)
+# C<scalar(@ARGV)> is turned into an IV on VMS hence the (?:IV)?
#
do_test(21,
$ENV{PATH}=@ARGV, # scalar(@ARGV) is a handy known tainted value
@@ -431,10 +432,11 @@ do_test(21,
TAINTEDDIR
)? MG_LEN = -?\d+
MG_PTR = $ADDR (?:"(?i:PATH)"|=> HEf_SVKEY
- SV = PV\\($ADDR\\) at $ADDR
+ SV = PV(?:IV)?\\($ADDR\\) at $ADDR
REFCNT = \d+
FLAGS = \\(TEMP,POK,pPOK\\)
- PV = $ADDR "(?i:PATH)"\\\0
+(?: IV = 0
+)? PV = $ADDR "(?i:PATH)"\\\0
CUR = \d+
LEN = \d+)
MAGIC = $ADDR
diff --git a/ext/Encode/AUTHORS b/ext/Encode/AUTHORS
index 3f20c7e2d1..4e3035c4d0 100644
--- a/ext/Encode/AUTHORS
+++ b/ext/Encode/AUTHORS
@@ -40,3 +40,4 @@ SUZUKI Norio <ZAP00217@nifty.com>
Spider Boardman <spider@web.zk3.dec.com>
Tatsuhiko Miyagawa <miyagawa@edge.co.jp>
Vadim Konovalov <vkonovalov@peterstar.ru>
+Yitzchak Scott-Thoennes <sthoenna@efn.org>
diff --git a/ext/Encode/Changes b/ext/Encode/Changes
index f327441ce8..3900502b8c 100644
--- a/ext/Encode/Changes
+++ b/ext/Encode/Changes
@@ -1,9 +1,27 @@
# Revision history for Perl extension Encode.
#
-# $Id: Changes,v 1.87 2003/02/06 01:52:11 dankogai Exp dankogai $
+# $Id: Changes,v 1.88 2003/02/20 14:42:34 dankogai Exp dankogai $
#
+$Revision: 1.88 $ $Date: 2003/02/20 14:42:34 $
+! Encode.xs
+ one signedness nit for Encode by jhi
+ <200302161933.h1GJX876018710@kosh.hut.fi>
+! ucm/viscii.ucm
+ VISCII map was incorrect; fixed by Sadahiro-san
+ Message-Id: <20030216120828.47D3.BQW10602@nifty.com>
+! t/enc_eucjp.t t/enc_utf8.t AUTHORS
+ You can't unlink files that are opened in cygwin but the last
+ file handle opened in t/enc_*.t left open. Patch submitted
+ by Yitzchak and he was added to AUTHORS.
+ Message-Id: <iN0Q+gzkgmZN092yn@efn.org>
+! t/CJKT.t
+ now works with 'LC_ALL=en_US.UTF-8 PERL_UTF8_LOCALE=1'
+ Message-Id: <20030206104513.GA11081@kosh.hut.fi>
+! Unicode/Unicode.xs
+ For 1.88: Unicode.xs =~ s/regog/recog/ -- jhi
+ Message-Id: <20030206045153.GA6826@kosh.hut.fi>
-$Revision: 1.87 $ $Date: 2003/02/06 01:52:11 $
+1.87 2003/02/06 01:52:11
! AUTHORS
* Inaba "Sensei" Hirohito added (I thought I have done so a long
ago but apparently I did not).
diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm
index f123baba59..ad1a27d8cd 100644
--- a/ext/Encode/Encode.pm
+++ b/ext/Encode/Encode.pm
@@ -1,9 +1,9 @@
#
-# $Id: Encode.pm,v 1.87 2003/02/06 01:52:11 dankogai Exp dankogai $
+# $Id: Encode.pm,v 1.88 2003/02/20 14:36:25 dankogai Exp $
#
package Encode;
use strict;
-our $VERSION = do { my @r = (q$Revision: 1.87 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.88 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
our $DEBUG = 0;
use XSLoader ();
XSLoader::load(__PACKAGE__, $VERSION);
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs
index 0462a5d62a..1c0de8c536 100644
--- a/ext/Encode/Encode.xs
+++ b/ext/Encode/Encode.xs
@@ -1,5 +1,5 @@
/*
- $Id: Encode.xs,v 1.53 2003/02/06 01:52:11 dankogai Exp dankogai $
+ $Id: Encode.xs,v 1.54 2003/02/20 14:42:34 dankogai Exp dankogai $
*/
#define PERL_NO_GET_CONTEXT
@@ -74,7 +74,7 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
STRLEN dlen = SvLEN(dst)-1;
int code = 0;
STRLEN trmlen = 0;
- U8 *trm = term ? SvPV(term, trmlen) : NULL;
+ U8 *trm = term ? (U8*) SvPV(term, trmlen) : NULL;
if (offset) {
s += *offset;
diff --git a/ext/Encode/Unicode/Unicode.xs b/ext/Encode/Unicode/Unicode.xs
index 56e1bd1076..d0bedc5951 100644
--- a/ext/Encode/Unicode/Unicode.xs
+++ b/ext/Encode/Unicode/Unicode.xs
@@ -1,5 +1,5 @@
/*
- $Id: Unicode.xs,v 1.6 2003/01/10 12:00:16 dankogai Exp $
+ $Id: Unicode.xs,v 1.7 2003/02/20 14:42:34 dankogai Exp dankogai $
*/
#define PERL_NO_GET_CONTEXT
diff --git a/ext/Encode/lib/Encode/CJKConstants.pm b/ext/Encode/lib/Encode/CJKConstants.pm
index e90e854345..73e83b07a4 100644
--- a/ext/Encode/lib/Encode/CJKConstants.pm
+++ b/ext/Encode/lib/Encode/CJKConstants.pm
@@ -1,12 +1,12 @@
#
-# $Id: CJKConstants.pm,v 1.1 2003/02/06 01:52:11 dankogai Exp dankogai $
+# $Id: CJKConstants.pm,v 1.1 2003/02/06 01:52:11 dankogai Exp $
#
package Encode::CJKConstants;
use strict;
-our $RCSID = q$Id: CJKConstants.pm,v 1.1 2003/02/06 01:52:11 dankogai Exp dankogai $;
+our $RCSID = q$Id: CJKConstants.pm,v 1.1 2003/02/06 01:52:11 dankogai Exp $;
our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
use Carp;
diff --git a/ext/Encode/lib/Encode/Encoder.pm b/ext/Encode/lib/Encode/Encoder.pm
index 8f65bdb60f..5f2451b1fa 100644
--- a/ext/Encode/lib/Encode/Encoder.pm
+++ b/ext/Encode/lib/Encode/Encoder.pm
@@ -1,5 +1,5 @@
#
-# $Id: Encoder.pm,v 0.6 2003/02/06 01:52:11 dankogai Exp dankogai $
+# $Id: Encoder.pm,v 0.6 2003/02/06 01:52:11 dankogai Exp $
#
package Encode::Encoder;
use strict;
diff --git a/ext/Encode/t/enc_eucjp.t b/ext/Encode/t/enc_eucjp.t
index 4929d7e376..151bd9aa5b 100644
--- a/ext/Encode/t/enc_eucjp.t
+++ b/ext/Encode/t/enc_eucjp.t
@@ -1,6 +1,5 @@
-# $Id: enc_eucjp.t,v 1.2 2003/02/06 01:52:11 dankogai Exp dankogai $
-# This is the twin of enc_utf8.t, the only difference is that
-# this has "use encoding 'euc-jp'".
+# $Id: enc_eucjp.t,v 1.3 2003/02/20 14:42:34 dankogai Exp dankogai $
+# This is the twin of enc_utf8.t .
BEGIN {
require Config; import Config;
@@ -64,6 +63,7 @@ binmode(F, ":encoding(utf-8)");
local $SIG{__WARN__} = sub { $a = shift };
eval { <F> }; # This should get caught.
}
+close F;
print $a =~ qr{^utf8 "\\x80" does not map to Unicode} ?
"ok $t - illegal utf8 input\n" : "not ok $t - illegal utf8 input: a = " . unpack("H*", $a) . "\n";
diff --git a/ext/Encode/t/enc_utf8.t b/ext/Encode/t/enc_utf8.t
index cce63e337b..5da3047760 100644
--- a/ext/Encode/t/enc_utf8.t
+++ b/ext/Encode/t/enc_utf8.t
@@ -1,12 +1,7 @@
-# $Id: enc_utf8.t,v 1.2 2003/01/22 03:29:07 dankogai Exp $
-# This is the twin of enc_eucjp.t, the only difference is that
-# this has "use encoding 'utf8'".
+# $Id: enc_utf8.t,v 1.3 2003/02/20 14:42:34 dankogai Exp dankogai $
+# This is the twin of enc_eucjp.t .
BEGIN {
-# if ($] <= 5.008){
-# print "1..0 # Skip: Perl 5.8.1 or later required\n";
-# exit 0;
-# }
require Config; import Config;
if ($Config{'extensions'} !~ /\bEncode\b/) {
print "1..0 # Skip: Encode was not built\n";
@@ -63,6 +58,7 @@ binmode(F, ":encoding(utf-8)");
local $SIG{__WARN__} = sub { $a = shift };
eval { <F> }; # This should get caught.
}
+close F;
print $a =~ qr{^utf8 "\\x80" does not map to Unicode} ?
"ok $t - illegal utf8 input\n" : "not ok $t - illegal utf8 input: a = " . unpack("H*", $a) . "\n";
diff --git a/ext/Encode/ucm/viscii.ucm b/ext/Encode/ucm/viscii.ucm
index 0f02f01adc..d73fbf24ab 100644
--- a/ext/Encode/ucm/viscii.ucm
+++ b/ext/Encode/ucm/viscii.ucm
@@ -1,7 +1,7 @@
#
-# $Id: viscii.ucm,v 1.0 2002/03/28 23:26:28 dankogai Exp $
+# $Id: viscii.ucm,v 1.1 2003/02/20 14:42:34 dankogai Exp dankogai $
#
-# Written $Id: viscii.ucm,v 1.0 2002/03/28 23:26:28 dankogai Exp $
+# Written $Id: viscii.ucm,v 1.1 2003/02/20 14:42:34 dankogai Exp dankogai $
# ./compile -n viscii -o Encode/viscii.ucm Encode/viscii.enc
<code_set_name> "viscii"
<mb_cur_min> 1
@@ -143,6 +143,7 @@ CHARMAP
<U1EB6> \x83 |0 # LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW
<U1EA4> \x84 |0 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
<U1EA6> \x85 |0 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE
+<U1EA8> \x86 |0 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
<U1EAC> \x87 |0 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW
<U1EBC> \x88 |0 # LATIN CAPITAL LETTER E WITH TILDE
<U1EB8> \x89 |0 # LATIN CAPITAL LETTER E WITH DOT BELOW
@@ -174,7 +175,7 @@ CHARMAP
<U1EB7> \xA3 |0 # LATIN SMALL LETTER A WITH BREVE AND DOT BELOW
<U1EA5> \xA4 |0 # LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE
<U1EA7> \xA5 |0 # LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE
-<U1EA8> \xA6 |0 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
+<U1EA9> \xA6 |0 # LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
<U1EAD> \xA7 |0 # LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW
<U1EBD> \xA8 |0 # LATIN SMALL LETTER E WITH TILDE
<U1EB9> \xA9 |0 # LATIN SMALL LETTER E WITH DOT BELOW
diff --git a/ext/IO/lib/IO/Socket/INET.pm b/ext/IO/lib/IO/Socket/INET.pm
index f59c810bb4..7d1c94dedd 100644
--- a/ext/IO/lib/IO/Socket/INET.pm
+++ b/ext/IO/lib/IO/Socket/INET.pm
@@ -129,8 +129,6 @@ sub configure {
or return _error($sock, $!, $@);
}
- $sock->blocking($arg->{Blocking}) if defined $arg->{Blocking};
-
$proto ||= (getprotobyname('tcp'))[2];
my $pname = (getprotobynumber($proto))[0];
@@ -149,6 +147,11 @@ sub configure {
$sock->socket(AF_INET, $type, $proto) or
return _error($sock, $!, "$!");
+ if (defined $arg->{Blocking}) {
+ defined $sock->blocking($arg->{Blocking})
+ or return _error($sock, $!, "$!");
+ }
+
if ($arg->{Reuse} || $arg->{ReuseAddr}) {
$sock->sockopt(SO_REUSEADDR,1) or
return _error($sock, $!, "$!");
diff --git a/ext/IO/lib/IO/t/io_sock.t b/ext/IO/lib/IO/t/io_sock.t
index c4bfcc41cd..d91db55eca 100755
--- a/ext/IO/lib/IO/t/io_sock.t
+++ b/ext/IO/lib/IO/t/io_sock.t
@@ -29,7 +29,7 @@ BEGIN {
}
$| = 1;
-print "1..20\n";
+print "1..22\n";
eval {
$SIG{ALRM} = sub { die; };
@@ -220,12 +220,12 @@ if ( $^O eq 'qnx' ) {
#
local @data;
if( !open( SRC, "< $0")) {
- print "not ok 15 - $!";
+ print "not ok 15 - $!\n";
} else {
@data = <SRC>;
close( SRC);
+ print "ok 15\n";
}
-print "ok 15\n";
### TEST 16
### Start the server
@@ -336,6 +336,7 @@ if( $server_pid) {
$sock = undef;
}
$listen->close;
+ exit 0;
} else {
@@ -345,3 +346,12 @@ if( $server_pid) {
die;
}
+# test Blocking option in constructor
+
+$sock = IO::Socket::INET->new(Blocking => 0)
+ or print "not ";
+print "ok 21\n";
+
+my $status = $sock->blocking;
+print "not " unless defined $status && !$status;
+print "ok 22\n";
diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t
index 255704cb34..28be717940 100644
--- a/ext/threads/t/join.t
+++ b/ext/threads/t/join.t
@@ -105,7 +105,7 @@ if ($^O eq 'linux') { # We parse ps output so this is OS-dependent.
while (<PS>) {
s/\s+$//; # there seems to be extra whitespace at the end by ps(1)?
print "# $_\n";
- if (/^\S+\s+$$\s.+\sfoobar$/) {
+ if (/\b$$\b.+\bfoobar\b/) {
$ok++;
last;
}
diff --git a/hints/darwin.sh b/hints/darwin.sh
index 9adcdb4530..19f610ff2a 100644
--- a/hints/darwin.sh
+++ b/hints/darwin.sh
@@ -58,12 +58,15 @@ usenm='true';
# pace with CPU speed over time (on any platform), this is probably a
# reasonable assertion.
if [ -z "${optimize}" ]; then
- case "$osvers" in
- [12345].*) optimize='-O3' ;;
- *) optimize='-Os' ;;
+ case "`${cc:-gcc} -v 2>&1`" in
+ *"gcc version 3."*) optimize='-Os' ;;
+ *) optimize='-O3' ;;
esac
+else
+ optimize='-O3'
fi
+
# -pipe: makes compilation go faster.
# -fno-common because common symbols are not allowed in MH_DYLIB
ccflags="${ccflags} -pipe -fno-common"
diff --git a/intrpvar.h b/intrpvar.h
index fbf9ef61d4..fc975a3745 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -530,6 +530,8 @@ PERLVARI(Iin_load_module, int, 0) /* to prevent recursions in PerlIO_find_layer
PERLVAR(Iunicode, U32) /* Unicode features: $ENV{PERL_UNICODE} or -C */
+PERLVAR(Isignals, U32) /* Using which pre-5.8 signals */
+
/* New variables must be added to the very end, before this comment,
* for binary compatibility (the offsets of the old members must not change).
* XSUB.h provides wrapper functions via perlapi.h that make this
diff --git a/lib/CGI.pm b/lib/CGI.pm
index 62c41ea912..bd9c3354f7 100644
--- a/lib/CGI.pm
+++ b/lib/CGI.pm
@@ -149,8 +149,8 @@ $AutoloadClass = $DefaultClass unless defined $CGI::AutoloadClass;
# The path separator is a slash, backslash or semicolon, depending
# on the paltform.
$SL = {
- UNIX=>'/', OS2=>'\\', EPOC=>'/',
- WINDOWS=>'\\', DOS=>'\\', MACINTOSH=>':', VMS=>'/'
+ UNIX => '/', OS2 => '\\', EPOC => '/', CYGWIN => '/',
+ WINDOWS => '\\', DOS => '\\', MACINTOSH => ':', VMS => '/'
}->{$OS};
# This no longer seems to be necessary
diff --git a/mg.c b/mg.c
index 4b737b4c09..538717dd1d 100644
--- a/mg.c
+++ b/mg.c
@@ -635,7 +635,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setiv(sv, (IV)PL_perldb);
break;
case '\023': /* ^S */
- {
+ if (*(mg->mg_ptr+1) == '\0') {
if (PL_lex_state != LEX_NOTPARSING)
(void)SvOK_off(sv);
else if (PL_in_eval)
@@ -1122,13 +1122,12 @@ Perl_csighandler(int sig)
exit(1);
#endif
#endif
-
-#ifdef PERL_OLD_SIGNALS
- /* Call the perl level handler now with risk we may be in malloc() etc. */
- (*PL_sighandlerp)(sig);
-#else
- Perl_raise_signal(aTHX_ sig);
-#endif
+ if (PL_signals & PERL_SIGNALS_UNSAFE_FLAG)
+ /* Call the perl level handler now--
+ * with risk we may be in malloc() etc. */
+ (*PL_sighandlerp)(sig);
+ else
+ Perl_raise_signal(aTHX_ sig);
}
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
@@ -1159,8 +1158,11 @@ Perl_despatch_signals(pTHX)
PL_sig_pending = 0;
for (sig = 1; sig < SIG_SIZE; sig++) {
if (PL_psig_pend[sig]) {
- PL_psig_pend[sig] = 0;
+ PERL_BLOCKSIG_ADD(set, sig);
+ PL_psig_pend[sig] = 0;
+ PERL_BLOCKSIG_BLOCK(set);
(*PL_sighandlerp)(sig);
+ PERL_BLOCKSIG_UNBLOCK(set);
}
}
}
@@ -1830,6 +1832,13 @@ Perl_magic_setuvar(pTHX_ SV *sv, MAGIC *mg)
}
int
+Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg)
+{
+ sv_unmagic(sv, PERL_MAGIC_qr);
+ return 0;
+}
+
+int
Perl_magic_freeregexp(pTHX_ SV *sv, MAGIC *mg)
{
regexp *re = (regexp *)mg->mg_obj;
diff --git a/op.c b/op.c
index de5f06afea..cb487ab8a2 100644
--- a/op.c
+++ b/op.c
@@ -1596,8 +1596,6 @@ Perl_mod(pTHX_ OP *o, I32 type)
case OP_RV2AV:
case OP_RV2HV:
- if (!type && cUNOPo->op_first->op_type != OP_GV)
- Perl_croak(aTHX_ "Can't localize through a reference");
if (type == OP_REFGEN && o->op_flags & OPf_PARENS) {
PL_modcount = RETURN_UNLIMITED_NUMBER;
return o; /* Treat \(@foo) like ordinary list. */
@@ -1619,8 +1617,6 @@ Perl_mod(pTHX_ OP *o, I32 type)
PL_modcount = RETURN_UNLIMITED_NUMBER;
break;
case OP_RV2SV:
- if (!type && cUNOPo->op_first->op_type != OP_GV)
- Perl_croak(aTHX_ "Can't localize through a reference");
ref(cUNOPo->op_first, o->op_type);
/* FALL THROUGH */
case OP_GV:
@@ -3220,7 +3216,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, OP *repl)
if (curop->op_type == OP_GV) {
GV *gv = cGVOPx_gv(curop);
repl_has_vars = 1;
- if (strchr("&`'123456789+", *GvENAME(gv)))
+ if (strchr("&`'123456789+-\016\022", *GvENAME(gv)))
break;
}
#endif /* USE_5005THREADS */
@@ -5654,8 +5650,7 @@ Perl_ck_eof(pTHX_ OP *o)
if (o->op_flags & OPf_KIDS) {
if (cLISTOPo->op_first->op_type == OP_STUB) {
op_free(o);
- o = newUNOP(type, OPf_SPECIAL,
- newGVOP(OP_GV, 0, gv_fetchpv("main::ARGV", TRUE, SVt_PVAV)));
+ o = newUNOP(type, OPf_SPECIAL, newGVOP(OP_GV, 0, PL_argvgv));
}
return ck_fun(o);
}
@@ -5901,8 +5896,7 @@ Perl_ck_ftst(pTHX_ OP *o)
else {
op_free(o);
if (type == OP_FTTTY)
- o = newGVOP(type, OPf_REF, gv_fetchpv("main::STDIN", TRUE,
- SVt_PVIO));
+ o = newGVOP(type, OPf_REF, PL_stdingv);
else
o = newUNOP(type, 0, newDEFSVOP());
}
@@ -6539,8 +6533,7 @@ Perl_ck_shift(pTHX_ OP *o)
}
#else
argop = newUNOP(OP_RV2AV, 0,
- scalar(newGVOP(OP_GV, 0, !CvUNIQUE(PL_compcv) ?
- PL_defgv : gv_fetchpv("ARGV", TRUE, SVt_PVAV))));
+ scalar(newGVOP(OP_GV, 0, CvUNIQUE(PL_compcv) ? PL_argvgv : PL_defgv)));
#endif /* USE_5005THREADS */
return newUNOP(type, 0, scalar(argop));
}
diff --git a/perl.c b/perl.c
index 62e612ef1c..e3430fc5c3 100644
--- a/perl.c
+++ b/perl.c
@@ -1543,6 +1543,15 @@ print \" \\@INC:\\n @INC\\n\";");
}
}
+ if ((s = PerlEnv_getenv("PERL_SIGNALS"))) {
+ if (strEQ(s, "unsafe"))
+ PL_signals |= PERL_SIGNALS_UNSAFE_FLAG;
+ else if (strEQ(s, "safe"))
+ PL_signals &= ~PERL_SIGNALS_UNSAFE_FLAG;
+ else
+ Perl_croak(aTHX_ "PERL_SIGNALS illegal: \"%s\"", s);
+ }
+
init_lexer();
/* now parse the script */
diff --git a/perl.h b/perl.h
index b8960f886c..ea8c319228 100644
--- a/perl.h
+++ b/perl.h
@@ -2975,6 +2975,8 @@ EXTCONST char PL_no_func[]
INIT("The %s function is unimplemented");
EXTCONST char PL_no_myglob[]
INIT("\"my\" variable %s can't be in a package");
+EXTCONST char PL_no_localize_ref[]
+ INIT("Can't localize through a reference");
EXTCONST char PL_uuemap[65]
INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
@@ -3549,7 +3551,7 @@ EXT MGVTBL PL_vtbl_defelem = {MEMBER_TO_FPTR(Perl_magic_getdefelem),
MEMBER_TO_FPTR(Perl_magic_setdefelem),
0, 0, 0};
-EXT MGVTBL PL_vtbl_regexp = {0,0,0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)};
+EXT MGVTBL PL_vtbl_regexp = {0, MEMBER_TO_FPTR(Perl_magic_setregexp),0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)};
EXT MGVTBL PL_vtbl_regdata = {0, 0, MEMBER_TO_FPTR(Perl_magic_regdata_cnt), 0, 0};
EXT MGVTBL PL_vtbl_regdatum = {MEMBER_TO_FPTR(Perl_magic_regdatum_get),
MEMBER_TO_FPTR(Perl_magic_regdatum_set), 0, 0, 0};
@@ -3935,11 +3937,9 @@ typedef struct am_table_short AMTS;
*/
#ifndef PERL_MICRO
-# ifndef PERL_OLD_SIGNALS
-# ifndef PERL_ASYNC_CHECK
-# define PERL_ASYNC_CHECK() if (PL_sig_pending) despatch_signals()
-# endif
-# endif
+# ifndef PERL_ASYNC_CHECK
+# define PERL_ASYNC_CHECK() if (PL_sig_pending) despatch_signals()
+# endif
#endif
#ifndef PERL_ASYNC_CHECK
@@ -4268,6 +4268,38 @@ extern void moncontrol(int);
#define PERL_UNICODE_LOCALE 'L'
#define PERL_UNICODE_WIDESYSCALLS 'W'
+#define PERL_SIGNALS_UNSAFE_FLAG 0x0001
+
+/* From sigaction(2) (FreeBSD man page):
+ * | Signal routines normally execute with the signal that
+ * | caused their invocation blocked, but other signals may
+ * | yet occur.
+ * Emulation of this behavior (from within Perl) is enabled
+ * by defining PERL_BLOCK_SIGNALS.
+ */
+#define PERL_BLOCK_SIGNALS
+
+#if defined(HAS_SIGPROCMASK) && defined(PERL_BLOCK_SIGNALS)
+# define PERL_BLOCKSIG_ADD(set,sig) \
+ sigset_t set; sigemptyset(&(set)); sigaddset(&(set), sig)
+# define PERL_BLOCKSIG_BLOCK(set) \
+ sigprocmask(SIG_BLOCK, &(set), NULL)
+# define PERL_BLOCKSIG_UNBLOCK(set) \
+ sigprocmask(SIG_UNBLOCK, &(set), NULL)
+#endif /* HAS_SIGPROCMASK && PERL_BLOCK_SIGNALS */
+
+/* How about the old style of sigblock()? */
+
+#ifndef PERL_BLOCKSIG_ADD
+# define PERL_BLOCKSIG_ADD(set, sig) NOOP
+#endif
+#ifndef PERL_BLOCKSIG_BLOCK
+# define PERL_BLOCKSIG_BLOCK(set) NOOP
+#endif
+#ifndef PERL_BLOCKSIG_ADD
+# define PERL_BLOCKSIG_UNBLOCK(set) NOOP
+#endif
+
/* and finally... */
#define PERL_PATCHLEVEL_H_IMPLICIT
#include "patchlevel.h"
diff --git a/perlapi.h b/perlapi.h
index 0858fe479c..6d5fed0667 100644
--- a/perlapi.h
+++ b/perlapi.h
@@ -512,6 +512,8 @@ END_EXTERN_C
#define PL_sig_pending (*Perl_Isig_pending_ptr(aTHX))
#undef PL_sighandlerp
#define PL_sighandlerp (*Perl_Isighandlerp_ptr(aTHX))
+#undef PL_signals
+#define PL_signals (*Perl_Isignals_ptr(aTHX))
#undef PL_sort_RealCmp
#define PL_sort_RealCmp (*Perl_Isort_RealCmp_ptr(aTHX))
#undef PL_splitstr
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index b60f69cae8..cc67cb7c49 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -4577,6 +4577,9 @@ Converts a string C<s> of length C<len> from ASCII into UTF8 encoding.
Returns a pointer to the newly-created string, and sets C<len> to
reflect the new length.
+If you want to convert to UTF8 from other encodings than ASCII,
+see sv_recode_to_utf8().
+
NOTE: this function is experimental and may change or be
removed without notice.
@@ -4627,10 +4630,10 @@ Found in file utf8.c
=item is_utf8_string
-Returns true if first C<len> bytes of the given string form a valid UTF8
-string, false otherwise. Note that 'a valid UTF8 string' does not mean
-'a string that contains UTF8' because a valid ASCII string is a valid
-UTF8 string.
+Returns true if first C<len> bytes of the given string form a valid
+UTF8 string, false otherwise. Note that 'a valid UTF8 string' does
+not mean 'a string that contains code points above 0x7F encoded in
+UTF8' because a valid ASCII string is a valid UTF8 string.
bool is_utf8_string(U8 *s, STRLEN len)
diff --git a/pod/perlcompile.pod b/pod/perlcompile.pod
index ef3e537f68..046576b28a 100644
--- a/pod/perlcompile.pod
+++ b/pod/perlcompile.pod
@@ -236,9 +236,9 @@ execute the bytecode that it produces. The ByteLoader module provides
this functionality.
To turn a Perl program into executable byte code, you can use C<perlcc>
-with the C<-b> switch:
+with the C<-B> switch:
- perlcc -b myperlprogram.pl
+ perlcc -B myperlprogram.pl
The byte code is machine independent, so once you have a compiled
module or program, it is as portable as Perl source (assuming that
@@ -256,15 +256,15 @@ the Perl data structures directly. The program will still link against
the Perl interpreter library, to allow for eval(), C<s///e>,
C<require>, etc.
-The C<perlcc> tool generates such executables when using the -opt
+The C<perlcc> tool generates such executables when using the -O
switch. To compile a Perl program (ending in C<.pl>
or C<.p>):
- perlcc -opt myperlprogram.pl
+ perlcc -O myperlprogram.pl
To produce a shared library from a Perl module (ending in C<.pm>):
- perlcc -opt Myperlmodule.pm
+ perlcc -O Myperlmodule.pm
For more information, see L<perlcc> and L<B::CC>.
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 371e1c0112..fecbc312b6 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -3438,6 +3438,10 @@ superfluous.
(W signal) The signal handler named in %SIG doesn't, in fact, exist.
Perhaps you put it into the wrong package?
+=item PERL_SIGNALS illegal: "%s"
+
+See L<perlrun/PERL_SIGNALS> for legal values.
+
=item sort is now a reserved word
(F) An ancient error message that almost nobody ever runs into anymore.
diff --git a/pod/perlipc.pod b/pod/perlipc.pod
index 4e50886914..f0952a07a8 100644
--- a/pod/perlipc.pod
+++ b/pod/perlipc.pod
@@ -279,7 +279,7 @@ to find out whether anyone (or anything) has accidentally removed our fifo.
sleep 2; # to avoid dup signals
}
-=head2 Deferred Signals (Safe Signals)
+=head2 Deferred Signals (Safe signals)
In Perls before Perl 5.7.3 by installing Perl code to deal with
signals, you were exposing yourself to danger from two things. First,
@@ -380,6 +380,10 @@ there are un-waited-for completed child processes.
=back
+If you want the old signal behaviour back regardless of possible
+memory corruption, set the environment variable C<PERL_SIGNALS> to
+C<"unsafe">.
+
=head1 Using open() for IPC
Perl's basic open() statement can also be used for unidirectional
diff --git a/pod/perlop.pod b/pod/perlop.pod
index cdeeb99add..af50043653 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -178,8 +178,7 @@ operator. See L</"Regexp Quote-Like Operators"> for details.
If the right argument is an expression rather than a search pattern,
substitution, or transliteration, it is interpreted as a search pattern at run
-time. This can be less efficient than an explicit search, because the
-pattern must be compiled every time the expression is evaluated.
+time.
Binary "!~" is just like "=~" except the return value is negated in
the logical sense.
diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index 514a399537..b9adb9b5a0 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -277,10 +277,10 @@ are as follows; listing the letters is equal to summing the numbers.
O 2 STDOUT will be in UTF-8
E 4 STDERR will be in UTF-8
S 7 I + O + E
- i 8 the default input layer expects UTF-8
- o 16 the default output layer enforces UTF-8
+ i 8 UTF-8 is the default PerlIO layer for input streams
+ o 16 UTF-8 is the default PerlIO layer for output streams
D 24 i + o
- A 32 the @ARGV elements are supposed to be in UTF-8
+ A 32 the @ARGV elements are expected to be strings encoded in UTF-8
L 64 normally the "IOEioA" are unconditional,
the L makes them conditional on the locale environment
variables (the LC_ALL, LC_TYPE, and LANG, in the order
@@ -291,6 +291,13 @@ For example, C<-COE> and C<-C6> will both turn on UTF-8-ness on both
STDOUT and STDERR. Repeating letters is just redundant, not cumulative
nor toggling.
+The C<io> options mean that any subsequent open() (or similar I/O
+operations) will have the C<:utf8> PerlIO layer implicitly applied
+to them, in other words, UTF-8 is expected from any input stream,
+and UTF-8 is produced to any output stream. This is just the default,
+with explicit layers in open() and with binmode() one can manipulate
+streams as usual.
+
C<-C> on its own (not followed by any number or option list), or the
empty string C<""> for the C<$ENV{PERL_UNICODE}, has the same effect
as <-CSDL>. In other words, the standard I/O handles and the default
@@ -1084,6 +1091,12 @@ affect perl on VMS include PERLSHR, PERL_ENV_TABLES, and
SYS$TIMEZONE_DIFFERENTIAL but are optional and discussed further in
L<perlvms> and in F<README.vms> in the Perl source distribution.
+=item PERL_SIGNALS
+
+In Perls 5.8.1 and later. If set to C<unsafe> the pre-Perl-5.8.0
+signals behaviour (immediate but unsafe) is restored. If set to
+C<safe> the safe signals are used.
+
=item PERL_UNICODE
Equivalent to the B<-C> command-line switch.
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index 3f48e08558..5b6832e637 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -1482,7 +1482,7 @@ exempt in these ways:
ENV STDIN
INC STDOUT
ARGV STDERR
- ARGVOUT
+ ARGVOUT _
SIG
In particular, the new special C<${^_XYZ}> variables are always taken
diff --git a/pp.c b/pp.c
index f450805c72..62b220f67b 100644
--- a/pp.c
+++ b/pp.c
@@ -211,6 +211,7 @@ PP(pp_rv2gv)
PP(pp_rv2sv)
{
+ GV *gv = Nullgv;
dSP; dTOPss;
if (SvROK(sv)) {
@@ -226,9 +227,9 @@ PP(pp_rv2sv)
}
}
else {
- GV *gv = (GV*)sv;
char *sym;
STRLEN len;
+ gv = (GV*)sv;
if (SvTYPE(gv) != SVt_PVGV) {
if (SvGMAGICAL(sv)) {
@@ -265,8 +266,14 @@ PP(pp_rv2sv)
sv = GvSV(gv);
}
if (PL_op->op_flags & OPf_MOD) {
- if (PL_op->op_private & OPpLVAL_INTRO)
- sv = save_scalar((GV*)TOPs);
+ if (PL_op->op_private & OPpLVAL_INTRO) {
+ if (cUNOP->op_first->op_type == OP_NULL)
+ sv = save_scalar((GV*)TOPs);
+ else if (gv)
+ sv = save_scalar(gv);
+ else
+ Perl_croak(aTHX_ PL_no_localize_ref);
+ }
else if (PL_op->op_private & OPpDEREF)
vivify_ref(sv, PL_op->op_private & OPpDEREF);
}
diff --git a/pp_ctl.c b/pp_ctl.c
index 8b80471e34..aaa0c14070 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -156,6 +156,7 @@ PP(pp_substcont)
register char *m = cx->sb_m;
char *orig = cx->sb_orig;
register REGEXP *rx = cx->sb_rx;
+ SV *nsv = Nullsv;
rxres_restore(&cx->sb_rxres, rx);
RX_MATCH_UTF8_set(rx, SvUTF8(cx->sb_targ));
@@ -178,7 +179,10 @@ PP(pp_substcont)
{
SV *targ = cx->sb_targ;
- sv_catpvn(dstr, s, cx->sb_strend - s);
+ if (DO_UTF8(dstr) && !SvUTF8(targ))
+ sv_catpvn_utf8_upgrade(dstr, s, cx->sb_strend - s, nsv);
+ else
+ sv_catpvn(dstr, s, cx->sb_strend - s);
cx->sb_rxtainted |= RX_MATCH_TAINTED(rx);
(void)SvOOK_off(targ);
@@ -193,7 +197,7 @@ PP(pp_substcont)
sv_free(dstr);
TAINT_IF(cx->sb_rxtainted & 1);
- PUSHs(sv_2mortal(newSViv((I32)cx->sb_iters - 1)));
+ PUSHs(sv_2mortal(newSViv(saviters - 1)));
(void)SvPOK_only_UTF8(targ);
TAINT_IF(cx->sb_rxtainted);
@@ -214,8 +218,12 @@ PP(pp_substcont)
cx->sb_strend = s + (cx->sb_strend - m);
}
cx->sb_m = m = rx->startp[0] + orig;
- if (m > s)
- sv_catpvn(dstr, s, m-s);
+ if (m > s) {
+ if (DO_UTF8(dstr) && !SvUTF8(cx->sb_targ))
+ sv_catpvn_utf8_upgrade(dstr, s, m - s, nsv);
+ else
+ sv_catpvn(dstr, s, m-s);
+ }
cx->sb_s = rx->endp[0] + orig;
{ /* Update the pos() information. */
SV *sv = cx->sb_targ;
diff --git a/pp_hot.c b/pp_hot.c
index 5ed16b0a14..7f70095e00 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -140,11 +140,12 @@ PP(pp_concat)
bool lbyte;
STRLEN rlen;
char* rpv = SvPV(right, rlen); /* mg_get(right) happens here */
- bool rbyte = !SvUTF8(right);
+ bool rbyte = !SvUTF8(right), rcopied = FALSE;
if (TARG == right && right != left) {
right = sv_2mortal(newSVpvn(rpv, rlen));
rpv = SvPV(right, rlen); /* no point setting UTF8 here */
+ rcopied = TRUE;
}
if (TARG != left) {
@@ -180,6 +181,8 @@ PP(pp_concat)
if (lbyte)
sv_utf8_upgrade_nomg(TARG);
else {
+ if (!rcopied)
+ right = sv_2mortal(newSVpvn(rpv, rlen));
sv_utf8_upgrade_nomg(right);
rpv = SvPV(right, rlen);
}
@@ -650,6 +653,9 @@ PP(pp_rv2av)
SETs((SV*)av);
RETURN;
}
+ else if (PL_op->op_flags & OPf_MOD
+ && PL_op->op_private & OPpLVAL_INTRO)
+ Perl_croak(aTHX_ PL_no_localize_ref);
}
else {
if (SvTYPE(sv) == SVt_PVAV) {
@@ -774,6 +780,9 @@ PP(pp_rv2hv)
SETs((SV*)hv);
RETURN;
}
+ else if (PL_op->op_flags & OPf_MOD
+ && PL_op->op_private & OPpLVAL_INTRO)
+ Perl_croak(aTHX_ PL_no_localize_ref);
}
else {
if (SvTYPE(sv) == SVt_PVHV || SvTYPE(sv) == SVt_PVAV) {
@@ -1920,6 +1929,7 @@ PP(pp_subst)
I32 oldsave = PL_savestack_ix;
STRLEN slen;
bool doutf8 = FALSE;
+ SV *nsv = Nullsv;
/* known replacement string? */
dstr = (pm->op_pmflags & PMf_CONST) ? POPs : Nullsv;
@@ -1995,7 +2005,7 @@ PP(pp_subst)
if (dstr) {
/* replacement needing upgrading? */
if (DO_UTF8(TARG) && !doutf8) {
- SV *nsv = sv_newmortal();
+ nsv = sv_newmortal();
SvSetSV(nsv, dstr);
if (PL_encoding)
sv_recode_to_utf8(nsv, PL_encoding);
@@ -2016,7 +2026,8 @@ PP(pp_subst)
/* can do inplace substitution? */
if (c && (I32)clen <= rx->minlen && (once || !(r_flags & REXEC_COPY_STR))
- && !(rx->reganch & ROPT_LOOKBEHIND_SEEN)) {
+ && !(rx->reganch & ROPT_LOOKBEHIND_SEEN)
+ && (!doutf8 || SvUTF8(TARG))) {
if (!CALLREGEXEC(aTHX_ rx, s, strend, orig, 0, TARG, NULL,
r_flags | REXEC_CHECKED))
{
@@ -2151,7 +2162,10 @@ PP(pp_subst)
strend = s + (strend - m);
}
m = rx->startp[0] + orig;
- sv_catpvn(dstr, s, m-s);
+ if (doutf8 && !SvUTF8(dstr))
+ sv_catpvn_utf8_upgrade(dstr, s, m - s, nsv);
+ else
+ sv_catpvn(dstr, s, m-s);
s = rx->endp[0] + orig;
if (clen)
sv_catpvn(dstr, c, clen);
@@ -2159,12 +2173,8 @@ PP(pp_subst)
break;
} while (CALLREGEXEC(aTHX_ rx, s, strend, orig, s == m,
TARG, NULL, r_flags));
- if (doutf8 && !DO_UTF8(dstr)) {
- SV* nsv = sv_2mortal(newSVpvn(s, strend - s));
-
- sv_utf8_upgrade(nsv);
- sv_catpvn(dstr, SvPVX(nsv), SvCUR(nsv));
- }
+ if (doutf8 && !DO_UTF8(TARG))
+ sv_catpvn_utf8_upgrade(dstr, s, strend - s, nsv);
else
sv_catpvn(dstr, s, strend - s);
diff --git a/pp_sys.c b/pp_sys.c
index 800dc7b88d..d256ebb6d2 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3967,13 +3967,14 @@ PP(pp_wait)
Pid_t childpid;
int argflags;
-#ifdef PERL_OLD_SIGNALS
- childpid = wait4pid(-1, &argflags, 0);
-#else
- while ((childpid = wait4pid(-1, &argflags, 0)) == -1 && errno == EINTR) {
- PERL_ASYNC_CHECK();
+ if (PL_signals & PERL_SIGNALS_UNSAFE_FLAG)
+ childpid = wait4pid(-1, &argflags, 0);
+ else {
+ while ((childpid = wait4pid(-1, &argflags, 0)) == -1 &&
+ errno == EINTR) {
+ PERL_ASYNC_CHECK();
+ }
}
-#endif
# if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS)
/* 0 and -1 are both error returns (the former applies to WNOHANG case) */
STATUS_NATIVE_SET((childpid && childpid != -1) ? argflags : -1);
@@ -3997,13 +3998,14 @@ PP(pp_waitpid)
optype = POPi;
childpid = TOPi;
-#ifdef PERL_OLD_SIGNALS
- childpid = wait4pid(childpid, &argflags, optype);
-#else
- while ((childpid = wait4pid(childpid, &argflags, optype)) == -1 && errno == EINTR) {
- PERL_ASYNC_CHECK();
+ if (PL_signals & PERL_SIGNALS_UNSAFE_FLAG)
+ childpid = wait4pid(childpid, &argflags, optype);
+ else {
+ while ((childpid = wait4pid(childpid, &argflags, optype)) == -1 &&
+ errno == EINTR) {
+ PERL_ASYNC_CHECK();
+ }
}
-#endif
# if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS)
/* 0 and -1 are both error returns (the former applies to WNOHANG case) */
STATUS_NATIVE_SET((childpid && childpid != -1) ? argflags : -1);
diff --git a/proto.h b/proto.h
index 71f1cc2d20..dcfd7aac35 100644
--- a/proto.h
+++ b/proto.h
@@ -460,6 +460,7 @@ PERL_CALLCONV int Perl_magic_setmglob(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setnkeys(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setpack(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setpos(pTHX_ SV* sv, MAGIC* mg);
+PERL_CALLCONV int Perl_magic_setregexp(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setsig(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setsubstr(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_settaint(pTHX_ SV* sv, MAGIC* mg);
diff --git a/regexec.c b/regexec.c
index 10550ee3ad..c1b654a5eb 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2853,13 +2853,17 @@ S_regmatch(pTHX_ regnode *prog)
re_cc_state state;
CHECKPOINT cp, lastcp;
int toggleutf;
+ register SV *sv;
- if(SvROK(ret) || SvRMAGICAL(ret)) {
- SV *sv = SvROK(ret) ? SvRV(ret) : ret;
-
- if(SvMAGICAL(sv))
- mg = mg_find(sv, PERL_MAGIC_qr);
+ if(SvROK(ret) && SvSMAGICAL(sv = SvRV(ret)))
+ mg = mg_find(sv, PERL_MAGIC_qr);
+ else if (SvSMAGICAL(ret)) {
+ if (SvGMAGICAL(ret))
+ sv_unmagic(ret, PERL_MAGIC_qr);
+ else
+ mg = mg_find(ret, PERL_MAGIC_qr);
}
+
if (mg) {
re = (regexp *)mg->mg_obj;
(void)ReREFCNT_inc(re);
@@ -2876,7 +2880,8 @@ S_regmatch(pTHX_ regnode *prog)
if (DO_UTF8(ret)) pm.op_pmdynflags |= PMdf_DYN_UTF8;
re = CALLREGCOMP(aTHX_ t, t + len, &pm);
if (!(SvFLAGS(ret)
- & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)))
+ & (SVs_TEMP | SVs_PADTMP | SVf_READONLY
+ | SVs_GMG)))
sv_magic(ret,(SV*)ReREFCNT_inc(re),
PERL_MAGIC_qr,0,0);
PL_regprecomp = oprecomp;
diff --git a/sv.c b/sv.c
index 77743d90e3..3eecc28d95 100644
--- a/sv.c
+++ b/sv.c
@@ -2967,7 +2967,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
case SVt_PVMG:
if ( ((SvFLAGS(sv) &
(SVs_OBJECT|SVf_OK|SVs_GMG|SVs_SMG|SVs_RMG))
- == (SVs_OBJECT|SVs_RMG))
+ == (SVs_OBJECT|SVs_SMG))
&& (mg = mg_find(sv, PERL_MAGIC_qr))) {
regexp *re = (regexp *)mg->mg_obj;
@@ -8012,7 +8012,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
I32 svix = 0;
static char nullstr[] = "(null)";
SV *argsv = Nullsv;
- bool has_utf8 = FALSE; /* has the result utf8? */
+ bool has_utf8; /* has the result utf8? */
+ bool pat_utf8; /* the pattern is in utf8? */
+ SV *nsv = Nullsv;
+
+ has_utf8 = pat_utf8 = DO_UTF8(sv);
/* no matter what, this is a string now */
(void)SvPV_force(sv, origlen);
@@ -8113,7 +8117,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
/* echo everything up to the next format specification */
for (q = p; q < patend && *q != '%'; ++q) ;
if (q > p) {
- sv_catpvn(sv, p, q - p);
+ if (has_utf8 && !pat_utf8)
+ sv_catpvn_utf8_upgrade(sv, p, q - p, nsv);
+ else
+ sv_catpvn(sv, p, q - p);
p = q;
}
if (q++ >= patend)
diff --git a/sv.h b/sv.h
index f927646aa3..2eb3d7b1b3 100644
--- a/sv.h
+++ b/sv.h
@@ -1102,6 +1102,17 @@ otherwise.
#define sv_pvn_force(sv, lp) sv_pvn_force_flags(sv, lp, SV_GMAGIC)
#define sv_utf8_upgrade(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)
+/* Should be named SvCatPVN_utf8_upgrade? */
+#define sv_catpvn_utf8_upgrade(dsv, sstr, slen, nsv) \
+ STMT_START { \
+ if (!(nsv)) \
+ nsv = sv_2mortal(newSVpvn(sstr, slen)); \
+ else \
+ sv_setpvn(nsv, sstr, slen); \
+ SvUTF8_off(nsv); \
+ sv_utf8_upgrade(nsv); \
+ sv_catsv(dsv, nsv); \
+ } STMT_END
/*
=for apidoc Am|SV*|newRV_inc|SV* sv
@@ -1199,6 +1210,7 @@ Returns a pointer to the character buffer.
#define SvSetMagicSV_nosteal(dst,src) \
SvSetSV_nosteal_and(dst,src,SvSETMAGIC(dst))
+
#if !defined(SKIP_DEBUGGING)
#define SvPEEK(sv) sv_peek(sv)
#else
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 88f933c7a6..ad1c5b80bd 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -9,7 +9,7 @@ BEGIN {
}
require "./test.pl";
-plan( tests => 15 );
+plan( tests => 20 );
eval '%@x=0;';
like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' );
@@ -68,9 +68,23 @@ eval {
is( $@, '', 'PL_lex_brackstack' );
{
- undef $a;
- undef @b;
- my $a="a"; is("${a}{", "a{", "scope error #20716");
- my $a="a"; is("${a}[", "a[", "scope error #20716");
- my @b=("b"); is("@{b}{", "b{", "scope error #20716");
+ # tests for bug #20716
+ undef $a;
+ undef @b;
+ my $a="A";
+ is("${a}{", "A{", "interpolation, qq//");
+ is("${a}[", "A[", "interpolation, qq//");
+ my @b=("B");
+ is("@{b}{", "B{", "interpolation, qq//");
+ is(qr/${a}{/, '(?-xism:A{)', "interpolation, qr//");
+ my $c = "A{";
+ $c =~ /${a}{/;
+ is($&, 'A{', "interpolation, m//");
+ $c =~ s/${a}{/foo/;
+ is($c, 'foo', "interpolation, s/...//");
+ $c =~ s/foo/${a}{/;
+ is($c, 'A{', "interpolation, s//.../");
+ is(<<"${a}{", "A{ A[ B{\n", "interpolation, here doc");
+${a}{ ${a}[ @{b}{
+${a}{
}
diff --git a/t/op/concat.t b/t/op/concat.t
index 4813690d6b..c1a6e23e7e 100644
--- a/t/op/concat.t
+++ b/t/op/concat.t
@@ -18,7 +18,7 @@ sub ok {
return $ok;
}
-print "1..12\n";
+print "1..18\n";
($a, $b, $c) = qw(foo bar);
@@ -87,3 +87,20 @@ ok("$c$a$c" eq "foo", "concatenate undef, fore and aft");
eval{"\x{1234}$pi"};
ok(!$@, "bug id 20001020.006, constant right");
}
+
+sub beq { use bytes; $_[0] eq $_[1]; }
+
+{
+ # concat should not upgrade its arguments.
+ my($l, $r, $c);
+
+ ($l, $r, $c) = ("\x{101}", "\x{fe}", "\x{101}\x{fe}");
+ ok(beq($l.$r, $c), "concat utf8 and byte");
+ ok(beq($l, "\x{101}"), "right not changed after concat u+b");
+ ok(beq($r, "\x{fe}"), "left not changed after concat u+b");
+
+ ($l, $r, $c) = ("\x{fe}", "\x{101}", "\x{fe}\x{101}");
+ ok(beq($l.$r, $c), "concat byte and utf8");
+ ok(beq($l, "\x{fe}"), "right not changed after concat b+u");
+ ok(beq($r, "\x{101}"), "left not changed after concat b+u");
+}
diff --git a/t/op/local.t b/t/op/local.t
index 6da03912e9..1bb8b8ac1b 100755
--- a/t/op/local.t
+++ b/t/op/local.t
@@ -45,10 +45,10 @@ print $a,@b,@c,%d,$x,$y;
eval 'local($$e)';
print +($@ =~ /Can't localize through a reference/) ? "" : "not ", "ok 21\n";
-eval 'local(@$e)';
+eval '$e = []; local(@$e)';
print +($@ =~ /Can't localize through a reference/) ? "" : "not ", "ok 22\n";
-eval 'local(%$e)';
+eval '$e = {}; local(%$e)';
print +($@ =~ /Can't localize through a reference/) ? "" : "not ", "ok 23\n";
# Array and hash elements
diff --git a/t/op/localref.t b/t/op/localref.t
new file mode 100644
index 0000000000..9379575ede
--- /dev/null
+++ b/t/op/localref.t
@@ -0,0 +1,85 @@
+#!./perl
+
+chdir 't' if -d 't';
+@INC = qw(. ../lib);
+require "test.pl";
+plan( tests => 63 );
+
+$aa = 1;
+{ local $aa; $aa = 2; is($aa,2); }
+is($aa,1);
+{ local ${aa}; $aa = 3; is($aa,3); }
+is($aa,1);
+{ local ${"aa"}; $aa = 4; is($aa,4); }
+is($aa,1);
+$x = "aa";
+{ local ${$x}; $aa = 5; is($aa,5); undef $x; is($aa,5); }
+is($aa,1);
+$x = "a";
+{ local ${$x x2};$aa = 6; is($aa,6); undef $x; is($aa,6); }
+is($aa,1);
+$x = "aa";
+{ local $$x; $aa = 7; is($aa,7); undef $x; is($aa,7); }
+is($aa,1);
+
+@aa = qw/a b/;
+{ local @aa; @aa = qw/c d/; is("@aa","c d"); }
+is("@aa","a b");
+{ local @{aa}; @aa = qw/e f/; is("@aa","e f"); }
+is("@aa","a b");
+{ local @{"aa"}; @aa = qw/g h/; is("@aa","g h"); }
+is("@aa","a b");
+$x = "aa";
+{ local @{$x}; @aa = qw/i j/; is("@aa","i j"); undef $x; is("@aa","i j"); }
+is("@aa","a b");
+$x = "a";
+{ local @{$x x2};@aa = qw/k l/; is("@aa","k l"); undef $x; is("@aa","k l"); }
+is("@aa","a b");
+$x = "aa";
+{ local @$x; @aa = qw/m n/; is("@aa","m n"); undef $x; is("@aa","m n"); }
+is("@aa","a b");
+
+%aa = qw/a b/;
+{ local %aa; %aa = qw/c d/; is($aa{c},"d"); }
+is($aa{a},"b");
+{ local %{aa}; %aa = qw/e f/; is($aa{e},"f"); }
+is($aa{a},"b");
+{ local %{"aa"}; %aa = qw/g h/; is($aa{g},"h"); }
+is($aa{a},"b");
+$x = "aa";
+{ local %{$x}; %aa = qw/i j/; is($aa{i},"j"); undef $x; is($aa{i},"j"); }
+is($aa{a},"b");
+$x = "a";
+{ local %{$x x2};%aa = qw/k l/; is($aa{k},"l"); undef $x; is($aa{k},"l"); }
+is($aa{a},"b");
+$x = "aa";
+{ local %$x; %aa = qw/m n/; is($aa{m},"n"); undef $x; is($aa{m},"n"); }
+is($aa{a},"b");
+
+sub test_err_localref () {
+ like($@,qr/Can't localize through a reference/,'error');
+}
+$x = \$aa;
+my $y = \$aa;
+eval { local $$x; }; test_err_localref;
+eval { local ${$x}; }; test_err_localref;
+eval { local $$y; }; test_err_localref;
+eval { local ${$y}; }; test_err_localref;
+eval { local ${\$aa}; }; test_err_localref;
+eval { local ${\'aa'}; }; test_err_localref;
+$x = \@aa;
+$y = \@aa;
+eval { local @$x; }; test_err_localref;
+eval { local @{$x}; }; test_err_localref;
+eval { local @$y; }; test_err_localref;
+eval { local @{$y}; }; test_err_localref;
+eval { local @{\@aa}; }; test_err_localref;
+eval { local @{[]}; }; test_err_localref;
+$x = \%aa;
+$y = \%aa;
+eval { local %$x; }; test_err_localref;
+eval { local %{$x}; }; test_err_localref;
+eval { local %$y; }; test_err_localref;
+eval { local %{$y}; }; test_err_localref;
+eval { local %{\%aa}; }; test_err_localref;
+eval { local %{{a=>1}}; };test_err_localref;
diff --git a/t/op/pat.t b/t/op/pat.t
index fe70e12725..40a265882c 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -6,7 +6,7 @@
$| = 1;
-print "1..988\n";
+print "1..990\n";
BEGIN {
chdir 't' if -d 't';
@@ -3108,5 +3108,20 @@ ok("bbbbac" =~ /$pattern/ && $1 eq 'a', "[perl #3547]");
ok ( "0" =~ /\p{N}+\z/, "[perl #19767] variant test" );
}
-# last test 988
+{
+
+ $p = 1;
+ foreach (1,2,3,4) {
+ $p++ if /(??{ $p })/
+ }
+ ok ($p == 5, "[perl #20683] (??{ }) returns stale values");
+ { package P; $a=1; sub TIESCALAR { bless[] } sub FETCH { $a++ } }
+ tie $p, P;
+ foreach (1,2,3,4) {
+ /(??{ $p })/
+ }
+ ok ( $p == 5, "(??{ }) returns stale values");
+}
+
+# last test 990
diff --git a/t/op/subst.t b/t/op/subst.t
index 59c3d21b8d..f30f593e5a 100755
--- a/t/op/subst.t
+++ b/t/op/subst.t
@@ -7,7 +7,7 @@ BEGIN {
}
require './test.pl';
-plan( tests => 126 );
+plan( tests => 128 );
$x = 'foo';
$_ = "x";
@@ -516,3 +516,14 @@ is("<$_> <$s>", "<> <4>", "[perl #7806]");
$f =~ s/x/y/g;
is($f, "yy", "[perl #17757]");
}
+
+# [perl #20684] returned a zero count
+$_ = "1111";
+is(s/(??{1})/2/eg, 4, '#20684 s/// with (??{..}) inside');
+
+# [perl #20682] @- not visible in replacement
+$_ = "123";
+/(2)/; # seed @- with something else
+s/(1)(2)(3)/$#- (@-)/;
+is($_, "3 (0 0 1 2)", '#20682 @- not visible in replacement');
+
diff --git a/t/run/switchC.t b/t/run/switchC.t
new file mode 100644
index 0000000000..9283fa879b
--- /dev/null
+++ b/t/run/switchC.t
@@ -0,0 +1,57 @@
+#!./perl -w
+
+# Tests for the command-line switches
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ unless (find PerlIO::Layer 'perlio') {
+ print "1..0 # Skip: not perlio\n";
+ exit 0;
+ }
+}
+
+require "./test.pl";
+
+plan(tests => 6);
+
+my $r;
+
+my @tmpfiles = ();
+END { unlink @tmpfiles }
+
+$r = runperl( switches => [ '-CO', '-w' ],
+ prog => 'print chr(256)',
+ stderr => 1 );
+is( $r, "\xC4\x80", '-CO: no warning on UTF-8 output' );
+
+$r = runperl( switches => [ '-CI', '-w' ],
+ prog => 'print ord(<STDIN>)',
+ stderr => 1,
+ stdin => chr(256) );
+is( $r, 256, '-CI: read in UTF-8 output' );
+
+$r = runperl( switches => [ '-CE', '-w' ],
+ prog => 'warn chr(256), qq(\n)',
+ stderr => 1 );
+chomp $r;
+is( $r, "\xC4\x80", '-CE: UTF-8 stderr' );
+
+$r = runperl( switches => [ '-Co', '-w' ],
+ prog => 'open(F, q(>out)); print F chr(256); close F',
+ stderr => 1 );
+is( $r, '', '-Co: auto-UTF-8 open for output' );
+
+push @tmpfiles, "out";
+
+$r = runperl( switches => [ '-Ci', '-w' ],
+ prog => 'open(F, q(<out)); print ord(<F>); close F',
+ stderr => 1 );
+is( $r, 256, '-Ci: auto-UTF-8 open for input' );
+
+$r = runperl( switches => [ '-CA', '-w' ],
+ prog => 'print ord shift',
+ stderr => 1,
+ args => [ chr(256) ] );
+is( $r, 256, '-CA: @ARGV' );
+
diff --git a/toke.c b/toke.c
index 507062a115..0b52b213d5 100644
--- a/toke.c
+++ b/toke.c
@@ -6253,8 +6253,10 @@ S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN des
}
if (*s == '}') {
s++;
- if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets)
+ if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) {
PL_lex_state = LEX_INTERPEND;
+ PL_expect = XREF;
+ }
if (funny == '#')
funny = '@';
if (PL_lex_state == LEX_NORMAL) {
@@ -6266,8 +6268,6 @@ S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN des
funny, dest, funny, dest);
}
}
- if (PL_lex_inwhat == OP_STRINGIFY)
- PL_expect = XREF;
}
else {
s = bracket; /* let the parser handle it */
diff --git a/utf8.c b/utf8.c
index a5e92cb7c8..a5d87a2b81 100644
--- a/utf8.c
+++ b/utf8.c
@@ -217,10 +217,10 @@ Perl_is_utf8_char(pTHX_ U8 *s)
/*
=for apidoc A|bool|is_utf8_string|U8 *s|STRLEN len
-Returns true if first C<len> bytes of the given string form a valid UTF8
-string, false otherwise. Note that 'a valid UTF8 string' does not mean
-'a string that contains UTF8' because a valid ASCII string is a valid
-UTF8 string.
+Returns true if first C<len> bytes of the given string form a valid
+UTF8 string, false otherwise. Note that 'a valid UTF8 string' does
+not mean 'a string that contains code points above 0x7F encoded in
+UTF8' because a valid ASCII string is a valid UTF8 string.
=cut
*/
@@ -770,6 +770,9 @@ Converts a string C<s> of length C<len> from ASCII into UTF8 encoding.
Returns a pointer to the newly-created string, and sets C<len> to
reflect the new length.
+If you want to convert to UTF8 from other encodings than ASCII,
+see sv_recode_to_utf8().
+
=cut
*/
diff --git a/util.c b/util.c
index b530517cde..49796166a9 100644
--- a/util.c
+++ b/util.c
@@ -2199,9 +2199,8 @@ Perl_rsignal(pTHX_ int signo, Sighandler_t handler)
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
#ifdef SA_RESTART
-#if defined(PERL_OLD_SIGNALS)
- act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
-#endif
+ if (PL_signals & PERL_SIGNALS_UNSAFE_FLAG)
+ act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
#endif
#ifdef SA_NOCLDWAIT
if (signo == SIGCHLD && handler == (Sighandler_t)SIG_IGN)
@@ -2239,9 +2238,8 @@ Perl_rsignal_save(pTHX_ int signo, Sighandler_t handler, Sigsave_t *save)
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
#ifdef SA_RESTART
-#if defined(PERL_OLD_SIGNALS)
- act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
-#endif
+ if (PL_signals & PERL_SIGNALS_UNSAFE_FLAG)
+ act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
#endif
#ifdef SA_NOCLDWAIT
if (signo == SIGCHLD && handler == (Sighandler_t)SIG_IGN)
diff --git a/win32/perlhost.h b/win32/perlhost.h
index b68f5c771b..371a3a5edc 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -1774,9 +1774,9 @@ restart:
win32_checkTLS(my_perl);
/* close the std handles to avoid fd leaks */
{
- do_close(gv_fetchpv("STDIN", TRUE, SVt_PVIO), FALSE);
- do_close(gv_fetchpv("STDOUT", TRUE, SVt_PVIO), FALSE);
- do_close(gv_fetchpv("STDERR", TRUE, SVt_PVIO), FALSE);
+ do_close(PL_stdingv, FALSE);
+ do_close(gv_fetchpv("STDOUT", TRUE, SVt_PVIO), FALSE); /* PL_stdoutgv - ISAGN */
+ do_close(PL_stderrgv, FALSE);
}
/* destroy everything (waits for any pseudo-forked children) */