diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-02 16:22:35 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-02 16:22:35 +0000 |
commit | d2aaa77e10d841339f3651b4c6cfc980b9f58b7a (patch) | |
tree | 3dedde5879a7b6a4a29337fbb5cfecb63fd6b8bc | |
parent | d7afa7f598167b0e275229d12c9533fa50997878 (diff) | |
download | perl-d2aaa77e10d841339f3651b4c6cfc980b9f58b7a.tar.gz |
Integrate:
[ 18784]
An already fixed bug from perl-unicode.
[ 18785]
Subject: Re: [PATCH] Re: format, PerlIO and utf8
From: Inaba Hiroto <inaba@st.rim.or.jp>
Date: Mon, 10 Feb 2003 00:04:51 +0900
Message-ID: <3E466E12.E5349D84@st.rim.or.jp>
[ 18794]
Further Unicode formats patching from Inaba Hiroto.
[ 18797]
Patch for [perl #9402], known also as "glibc _moddi3 bug
with negative quads", or also as RedHat bug #65612.
[ 18798]
Go with "right = -right" for greater portability, some platforms
might require llabs() to get abs() of long longs.
[ 18799]
The -CI cannot be easily tested under UTF-8 locale with
the t/test.pl (the 'stdin' data gets doubly UTF-8-ied).
Also other small tweaks in the -C neighbourhood.
[ 18801]
Update all copyrights to 2003, from Jarkko
[ 18802]
Narrow down the -C test skippage.
[ 18803]
Subject: RE: [perl #20613] Perl_magic_setsig/clearsig problems (patch included)
From: "Anders Johnson" <ajohnson@wischip.com>
Date: Mon, 10 Feb 2003 14:09:46 -0800
Message-ID: <000e01c2d151$2228ca90$9800a8c0@wis.com>
p4raw-link: @18803 on //depot/perl: 2d4fcd5e8be8d83efa948a259c49b56fc6c27ee5
p4raw-link: @18802 on //depot/perl: 81ff9b36babbaa3576696f80427c25a4b7bfa9dd
p4raw-link: @18801 on //depot/perl: 4c79ee7a1e7564ef83d0ac25d6677fdebb3ec7aa
p4raw-link: @18799 on //depot/perl: 06e66572fd5541df0d1349cac2b404c3b9e446ee
p4raw-link: @18798 on //depot/perl: 97edce3fcdc8a02187aed95f7b6f4a46eb120a6e
p4raw-link: @18797 on //depot/perl: 224ec32361cf57b93c61b661abceec9635d9d527
p4raw-link: @18794 on //depot/perl: 78da4d13e9515c4d820a5423a160a2c81889d633
p4raw-link: @18785 on //depot/perl: 1bd51a4ce2ce8ac9d8d3503b73fce0e0fc8f8426
p4raw-link: @18784 on //depot/perl: 351208f1b69ff774788ddf0fb62571002594640e
p4raw-id: //depot/maint-5.8/perl@18804
p4raw-branched: from //depot/perl@18791 'branch in' t/uni/write.t
p4raw-integrated: from //depot/perl@18791 'copy in' EXTERN.h INTERN.h
form.h run.c x2p/EXTERN.h x2p/INTERN.h x2p/a2p.c x2p/a2p.y
x2p/hash.h x2p/proto.h x2p/str.h x2p/util.c x2p/util.h
(@14391..) cc_runtime.h fakethr.h unixish.h (@14400..)
globals.c (@14802..) README (@14841..) regcomp.h (@15356..)
utf8.h (@15762..) x2p/hash.c x2p/walk.c (@16076..) gv.h
(@16325..) perlsdio.h (@16368..) hv.h (@16656..) utfebcdic.h
(@16888..) x2p/a2p.h (@17033..) perlsfio.h (@17242..) av.h
(@17727..) x2p/str.c (@17759..) numeric.c (@17874..) handy.h
(@17920..) mg.h (@17947..) perlapi.c (@18113..) taint.c
(@18261..) pad.h (@18311..) scope.h (@18312..) util.h
(@18321..) t/op/magic.t (@18371..) reentr.c reentr.h reentr.pl
(@18498..) fakesdio.h nostdio.h (@18524..) perlio.h (@18556..)
XSUB.h (@18636..) locale.c (@18731..) t/op/pat.t (@18782..)
t/run/switchC.t (@18799..) 'edit in' pp_ctl.c (@18794..) pp.c
(@18798..) perl.c perl.h util.c (@18799..) mg.c (@18801..)
'merge in' keywords.h (@17682..) doop.c (@17984..) deb.c
dosish.h miniperlmain.c pp.h (@18030..) keywords.pl (@18160..)
thread.h (@18229..) perlvars.h (@18239..) perly.y (@18336..)
scope.c (@18410..) opnames.h (@18413..) pp_sort.c (@18456..)
hv.c (@18463..) av.c (@18554..) op.h (@18589..) pad.c
(@18601..) cop.h (@18643..) doio.c (@18676..) universal.c
(@18697..) gv.c (@18715..) regcomp.c regexp.h thrdvar.h
(@18726..) cv.h dump.c xsutils.c (@18727..) embed.pl (@18734..)
patchlevel.h (@18749..) opcode.h opcode.pl pp_pack.c (@18751..)
utf8.c (@18760..) sv.h (@18764..) embedvar.h pp_sys.c
(@18766..) pp_hot.c (@18774..) op.c (@18777..) MANIFEST
(@18779..) perlapi.h (@18781..) proto.h regexec.c sv.c
(@18782..) embed.h (@18795..) global.sym (@18796..)
p4raw-integrated: from //depot/perl@18785 'edit in' toke.c (@18753..)
-rw-r--r-- | EXTERN.h | 2 | ||||
-rw-r--r-- | INTERN.h | 2 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | XSUB.h | 2 | ||||
-rw-r--r-- | av.c | 2 | ||||
-rw-r--r-- | av.h | 2 | ||||
-rw-r--r-- | cc_runtime.h | 2 | ||||
-rw-r--r-- | cop.h | 2 | ||||
-rw-r--r-- | cv.h | 2 | ||||
-rw-r--r-- | deb.c | 2 | ||||
-rw-r--r-- | doio.c | 2 | ||||
-rw-r--r-- | doop.c | 2 | ||||
-rw-r--r-- | dosish.h | 2 | ||||
-rw-r--r-- | dump.c | 2 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rwxr-xr-x | embed.pl | 2 | ||||
-rw-r--r-- | embedvar.h | 2 | ||||
-rw-r--r-- | fakesdio.h | 2 | ||||
-rw-r--r-- | fakethr.h | 2 | ||||
-rw-r--r-- | form.h | 2 | ||||
-rw-r--r-- | global.sym | 2 | ||||
-rw-r--r-- | globals.c | 2 | ||||
-rw-r--r-- | gv.c | 2 | ||||
-rw-r--r-- | gv.h | 2 | ||||
-rw-r--r-- | handy.h | 2 | ||||
-rw-r--r-- | hv.c | 2 | ||||
-rw-r--r-- | hv.h | 2 | ||||
-rw-r--r-- | keywords.h | 2 | ||||
-rwxr-xr-x | keywords.pl | 2 | ||||
-rw-r--r-- | locale.c | 2 | ||||
-rw-r--r-- | mg.c | 127 | ||||
-rw-r--r-- | mg.h | 2 | ||||
-rw-r--r-- | miniperlmain.c | 2 | ||||
-rw-r--r-- | nostdio.h | 2 | ||||
-rw-r--r-- | numeric.c | 2 | ||||
-rw-r--r-- | op.c | 2 | ||||
-rw-r--r-- | op.h | 2 | ||||
-rw-r--r-- | opcode.h | 2 | ||||
-rwxr-xr-x | opcode.pl | 4 | ||||
-rw-r--r-- | opnames.h | 2 | ||||
-rw-r--r-- | pad.c | 2 | ||||
-rw-r--r-- | pad.h | 2 | ||||
-rw-r--r-- | patchlevel.h | 2 | ||||
-rw-r--r-- | perl.c | 17 | ||||
-rw-r--r-- | perl.h | 17 | ||||
-rw-r--r-- | perlapi.c | 2 | ||||
-rw-r--r-- | perlapi.h | 2 | ||||
-rw-r--r-- | perlio.h | 2 | ||||
-rw-r--r-- | perlsdio.h | 2 | ||||
-rw-r--r-- | perlsfio.h | 2 | ||||
-rw-r--r-- | perlvars.h | 2 | ||||
-rw-r--r-- | perly.y | 2 | ||||
-rw-r--r-- | pp.c | 81 | ||||
-rw-r--r-- | pp.h | 2 | ||||
-rw-r--r-- | pp_ctl.c | 79 | ||||
-rw-r--r-- | pp_hot.c | 2 | ||||
-rw-r--r-- | pp_pack.c | 2 | ||||
-rw-r--r-- | pp_sort.c | 2 | ||||
-rw-r--r-- | pp_sys.c | 2 | ||||
-rw-r--r-- | proto.h | 2 | ||||
-rw-r--r-- | reentr.c | 2 | ||||
-rw-r--r-- | reentr.h | 2 | ||||
-rw-r--r-- | reentr.pl | 4 | ||||
-rw-r--r-- | regcomp.c | 2 | ||||
-rw-r--r-- | regcomp.h | 2 | ||||
-rw-r--r-- | regexec.c | 2 | ||||
-rw-r--r-- | regexp.h | 2 | ||||
-rw-r--r-- | run.c | 2 | ||||
-rw-r--r-- | scope.c | 2 | ||||
-rw-r--r-- | scope.h | 2 | ||||
-rw-r--r-- | sv.c | 2 | ||||
-rw-r--r-- | sv.h | 2 | ||||
-rwxr-xr-x | t/op/magic.t | 34 | ||||
-rwxr-xr-x | t/op/pat.t | 20 | ||||
-rw-r--r-- | t/run/switchC.t | 16 | ||||
-rw-r--r-- | t/uni/write.t | 96 | ||||
-rw-r--r-- | taint.c | 2 | ||||
-rw-r--r-- | thrdvar.h | 2 | ||||
-rw-r--r-- | thread.h | 2 | ||||
-rw-r--r-- | toke.c | 8 | ||||
-rw-r--r-- | universal.c | 2 | ||||
-rw-r--r-- | unixish.h | 2 | ||||
-rw-r--r-- | utf8.c | 2 | ||||
-rw-r--r-- | utf8.h | 2 | ||||
-rw-r--r-- | utfebcdic.h | 2 | ||||
-rw-r--r-- | util.c | 4 | ||||
-rw-r--r-- | util.h | 2 | ||||
-rw-r--r-- | x2p/EXTERN.h | 2 | ||||
-rw-r--r-- | x2p/INTERN.h | 2 | ||||
-rw-r--r-- | x2p/a2p.c | 2 | ||||
-rw-r--r-- | x2p/a2p.h | 2 | ||||
-rw-r--r-- | x2p/a2p.y | 2 | ||||
-rw-r--r-- | x2p/hash.c | 2 | ||||
-rw-r--r-- | x2p/hash.h | 2 | ||||
-rw-r--r-- | x2p/proto.h | 2 | ||||
-rw-r--r-- | x2p/str.c | 2 | ||||
-rw-r--r-- | x2p/str.h | 2 | ||||
-rw-r--r-- | x2p/util.c | 2 | ||||
-rw-r--r-- | x2p/util.h | 2 | ||||
-rw-r--r-- | x2p/walk.c | 2 | ||||
-rw-r--r-- | xsutils.c | 2 |
102 files changed, 524 insertions, 160 deletions
@@ -1,6 +1,6 @@ /* EXTERN.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* INTERN.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -2716,6 +2716,7 @@ t/uni/tr_eucjp.t See if Unicode tr/// works t/uni/tr_sjis.t See if Unicode tr/// works t/uni/tr_utf8.t See if Unicode tr/// works t/uni/upper.t See if Unicode casing works +t/uni/write.t See if Unicode formats work t/win32/longpath.t Test if Win32::GetLongPathName() works t/win32/system.t See if system works in Win* t/win32/system_tests Test runner for system.t @@ -1,7 +1,7 @@ Perl Kit, Version 5 - Copyright 1989-2002, Larry Wall + Copyright 1989-2003, Larry Wall All rights reserved. This program is free software; you can redistribute it and/or modify @@ -1,6 +1,6 @@ /* XSUB.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* av.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* av.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/cc_runtime.h b/cc_runtime.h index b1fc5b52b7..3efed14dde 100644 --- a/cc_runtime.h +++ b/cc_runtime.h @@ -1,6 +1,6 @@ /* cc_runtime.h * - * Copyright (c) 1998-2002, Larry Wall + * Copyright (c) 1998-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* cop.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* cv.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* deb.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* doio.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* doop.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* dosish.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* dump.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * embed.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -22,7 +22,7 @@ sub do_not_edit ($) $file - Copyright (c) 1997-2002, Larry Wall + Copyright (c) 1997-2003, Larry Wall You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the README file. diff --git a/embedvar.h b/embedvar.h index a3d5353bc3..02ccff14b2 100644 --- a/embedvar.h +++ b/embedvar.h @@ -1,7 +1,7 @@ /* * embedvar.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/fakesdio.h b/fakesdio.h index 8be514f180..edec0292fe 100644 --- a/fakesdio.h +++ b/fakesdio.h @@ -1,6 +1,6 @@ /* fakestdio.h * - * Copyright (c) 2000-2002, Larry Wall + * Copyright (c) 2000-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* fakethr.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* form.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/global.sym b/global.sym index 37be8965a6..62048d50bd 100644 --- a/global.sym +++ b/global.sym @@ -1,7 +1,7 @@ # # global.sym # -# Copyright (c) 1997-2002, Larry Wall +# Copyright (c) 1997-2003, Larry Wall # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* globals.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* gv.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* gv.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* handy.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* hv.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* hv.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/keywords.h b/keywords.h index 767f356da5..08c2ca03fd 100644 --- a/keywords.h +++ b/keywords.h @@ -1,7 +1,7 @@ /* * keywords.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/keywords.pl b/keywords.pl index 477174db23..5fd954fd8b 100755 --- a/keywords.pl +++ b/keywords.pl @@ -9,7 +9,7 @@ print <<EOM; /* * keywords.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* locale.c * - * Copyright (c) 2001-2002, Larry Wall + * Copyright (c) 2001-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* mg.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1043,6 +1043,14 @@ static int sig_defaulting[SIG_SIZE]; #endif #ifndef PERL_MICRO +#ifdef HAS_SIGPROCMASK +static void +restore_sigmask(pTHX_ SV *save_sv) +{ + sigset_t *ossetp = (sigset_t *) SvPV_nolen( save_sv ); + (void)sigprocmask(SIG_SETMASK, ossetp, (sigset_t *)0); +} +#endif int Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg) { @@ -1076,19 +1084,67 @@ Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) { - I32 i; + /* XXX Some of this code was copied from Perl_magic_setsig. A little + * refactoring might be in order. + */ + register char *s; STRLEN n_a; - /* Are we clearing a signal entry? */ - i = whichsig(MgPV(mg,n_a)); - if (i) { - if(PL_psig_ptr[i]) { - SvREFCNT_dec(PL_psig_ptr[i]); - PL_psig_ptr[i]=0; - } - if(PL_psig_name[i]) { - SvREFCNT_dec(PL_psig_name[i]); - PL_psig_name[i]=0; - } + SV* to_dec; + s = MgPV(mg,n_a); + if (*s == '_') { + SV** svp; + if (strEQ(s,"__DIE__")) + svp = &PL_diehook; + else if (strEQ(s,"__WARN__")) + svp = &PL_warnhook; + else + Perl_croak(aTHX_ "No such hook: %s", s); + if (*svp) { + to_dec = *svp; + *svp = 0; + SvREFCNT_dec(to_dec); + } + } + else { + I32 i; + /* Are we clearing a signal entry? */ + i = whichsig(s); + if (i) { +#ifdef HAS_SIGPROCMASK + sigset_t set, save; + SV* save_sv; + /* Avoid having the signal arrive at a bad time, if possible. */ + sigemptyset(&set); + sigaddset(&set,i); + sigprocmask(SIG_BLOCK, &set, &save); + ENTER; + save_sv = newSVpv((char *)(&save), sizeof(sigset_t)); + SAVEFREESV(save_sv); + SAVEDESTRUCTOR_X(restore_sigmask, save_sv); +#endif + PERL_ASYNC_CHECK(); +#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS) + if (!sig_handlers_initted) Perl_csighandler_init(); +#endif +#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS + sig_defaulting[i] = 1; + (void)rsignal(i, &Perl_csighandler); +#else + (void)rsignal(i, SIG_DFL); +#endif + if(PL_psig_name[i]) { + SvREFCNT_dec(PL_psig_name[i]); + PL_psig_name[i]=0; + } + if(PL_psig_ptr[i]) { + to_dec=PL_psig_ptr[i]; + PL_psig_ptr[i]=0; + LEAVE; + SvREFCNT_dec(to_dec); + } + else + LEAVE; + } } return 0; } @@ -1173,7 +1229,16 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) register char *s; I32 i; SV** svp = 0; + /* Need to be careful with SvREFCNT_dec(), because that can have side + * effects (due to closures). We must make sure that the new disposition + * is in place before it is called. + */ + SV* to_dec = 0; STRLEN len; +#ifdef HAS_SIGPROCMASK + sigset_t set, save; + SV* save_sv; +#endif s = MgPV(mg,len); if (*s == '_') { @@ -1185,7 +1250,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) Perl_croak(aTHX_ "No such hook: %s", s); i = 0; if (*svp) { - SvREFCNT_dec(*svp); + to_dec = *svp; *svp = 0; } } @@ -1196,6 +1261,17 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) Perl_warner(aTHX_ packWARN(WARN_SIGNAL), "No such signal: SIG%s", s); return 0; } +#ifdef HAS_SIGPROCMASK + /* Avoid having the signal arrive at a bad time, if possible. */ + sigemptyset(&set); + sigaddset(&set,i); + sigprocmask(SIG_BLOCK, &set, &save); + ENTER; + save_sv = newSVpv((char *)(&save), sizeof(sigset_t)); + SAVEFREESV(save_sv); + SAVEDESTRUCTOR_X(restore_sigmask, save_sv); +#endif + PERL_ASYNC_CHECK(); #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS) if (!sig_handlers_initted) Perl_csighandler_init(); #endif @@ -1203,20 +1279,26 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) sig_ignoring[i] = 0; #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS - sig_defaulting[i] = 0; + sig_defaulting[i] = 0; #endif SvREFCNT_dec(PL_psig_name[i]); - SvREFCNT_dec(PL_psig_ptr[i]); + to_dec = PL_psig_ptr[i]; PL_psig_ptr[i] = SvREFCNT_inc(sv); SvTEMP_off(sv); /* Make sure it doesn't go away on us */ PL_psig_name[i] = newSVpvn(s, len); SvREADONLY_on(PL_psig_name[i]); } if (SvTYPE(sv) == SVt_PVGV || SvROK(sv)) { - if (i) + if (i) { (void)rsignal(i, &Perl_csighandler); +#ifdef HAS_SIGPROCMASK + LEAVE; +#endif + } else *svp = SvREFCNT_inc(sv); + if(to_dec) + SvREFCNT_dec(to_dec); return 0; } s = SvPV_force(sv,len); @@ -1228,8 +1310,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) #else (void)rsignal(i, SIG_IGN); #endif - } else - *svp = 0; + } } else if (strEQ(s,"DEFAULT") || !*s) { if (i) @@ -1241,8 +1322,6 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) #else (void)rsignal(i, SIG_DFL); #endif - else - *svp = 0; } else { /* @@ -1257,6 +1336,12 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) else *svp = SvREFCNT_inc(sv); } +#ifdef HAS_SIGPROCMASK + if(i) + LEAVE; +#endif + if(to_dec) + SvREFCNT_dec(to_dec); return 0; } #endif /* !PERL_MICRO */ @@ -1,6 +1,6 @@ /* mg.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/miniperlmain.c b/miniperlmain.c index e2415d8a53..7b1e09b057 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -1,6 +1,6 @@ /* miniperlmain.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* nostdio.h * - * Copyright (c) 1987-2002, Larry Wall + * Copyright (c) 1987-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* numeric.c * - * Copyright (c) 2001-2002, Larry Wall + * Copyright (c) 2001-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* op.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* op.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * opcode.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -38,7 +38,7 @@ print <<"END"; /* * opcode.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -59,7 +59,7 @@ print ON <<"END"; /* * opnames.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * opnames.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pad.c * - * Copyright (c) 2002, Larry Wall + * Copyright (c) 2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pad.h * - * Copyright (c) 2002, Larry Wall + * Copyright (c) 2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/patchlevel.h b/patchlevel.h index 79fdde3efe..f29b3fc549 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1,6 +1,6 @@ /* patchlevel.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* perl.c * - * Copyright (c) 1987-2002 Larry Wall + * Copyright (c) 1987-2003 Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1487,14 +1487,15 @@ print \" \\@INC:\\n @INC\\n\";"); * PL_utf8locale is conditionally turned on by * locale.c:Perl_init_i18nl10n() if the environment * look like the user wants to use UTF-8. */ - if (PL_unicode) { /* Requires init_predump_symbols(). */ - IO* io; - PerlIO* fp; - SV* sv; - + if (PL_unicode) { + /* Requires init_predump_symbols(). */ if (!(PL_unicode & PERL_UNICODE_LOCALE_FLAG) || PL_utf8locale) { + IO* io; + PerlIO* fp; + SV* sv; + /* Turn on UTF-8-ness on STDIN, STDOUT, STDERR - * and the default open discipline. */ + * and the default open disciplines. */ if ((PL_unicode & PERL_UNICODE_STDIN_FLAG) && PL_stdingv && (io = GvIO(PL_stdingv)) && (fp = IoIFP(io))) @@ -2559,7 +2560,7 @@ Perl_moreswitches(pTHX_ char *s) #endif PerlIO_printf(PerlIO_stdout(), - "\n\nCopyright 1987-2002, Larry Wall\n"); + "\n\nCopyright 1987-2003, Larry Wall\n"); #ifdef MACOS_TRADITIONAL PerlIO_printf(PerlIO_stdout(), "\nMac OS port Copyright 1991-2002, Matthias Neeracher;\n" @@ -1,6 +1,6 @@ /* perl.h * - * Copyright (c) 1987-2002, Larry Wall + * Copyright (c) 1987-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -4253,15 +4253,22 @@ extern void moncontrol(int); #define PERL_UNICODE_STDIN_FLAG 0x0001 #define PERL_UNICODE_STDOUT_FLAG 0x0002 #define PERL_UNICODE_STDERR_FLAG 0x0004 -#define PERL_UNICODE_STD_FLAG 0x0007 #define PERL_UNICODE_IN_FLAG 0x0008 #define PERL_UNICODE_OUT_FLAG 0x0010 -#define PERL_UNICODE_INOUT_FLAG 0x0018 -#define PERL_UNICODE_ARGV_FLAG 0x0020 /* For @ARGV? */ +#define PERL_UNICODE_ARGV_FLAG 0x0020 #define PERL_UNICODE_LOCALE_FLAG 0x0040 #define PERL_UNICODE_WIDESYSCALLS_FLAG 0x0080 /* for Sarathy */ -#define PERL_UNICODE_DEFAULT_FLAGS \ +#define PERL_UNICODE_STD_FLAG \ + (PERL_UNICODE_STDIN_FLAG | \ + PERL_UNICODE_STDOUT_FLAG | \ + PERL_UNICODE_STDERR_FLAG) + +#define PERL_UNICODE_INOUT_FLAG \ + (PERL_UNICODE_IN_FLAG | \ + PERL_UNICODE_OUT_FLAG) + +#define PERL_UNICODE_DEFAULT_FLAGS \ (PERL_UNICODE_STD_FLAG | \ PERL_UNICODE_INOUT_FLAG | \ PERL_UNICODE_LOCALE_FLAG) @@ -1,7 +1,7 @@ /* * perlapi.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * perlapi.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* perlio.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/perlsdio.h b/perlsdio.h index e78076d24a..fc6bcfaa90 100644 --- a/perlsdio.h +++ b/perlsdio.h @@ -1,6 +1,6 @@ /* perlsdio.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/perlsfio.h b/perlsfio.h index 0a2cf3c558..a41bc4fa0a 100644 --- a/perlsfio.h +++ b/perlsfio.h @@ -1,6 +1,6 @@ /* perlsfio.h * - * Copyright (c) 1987-2002, Larry Wall + * Copyright (c) 1987-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/perlvars.h b/perlvars.h index 8cda4a9feb..71ab13e047 100644 --- a/perlvars.h +++ b/perlvars.h @@ -1,6 +1,6 @@ /* perlvars.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* perly.y * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pp.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -2458,16 +2458,79 @@ PP(pp_i_divide) } } +STATIC +PP(pp_i_modulo_0) +{ + /* This is the vanilla old i_modulo. */ + dSP; dATARGET; tryAMAGICbin(modulo,opASSIGN); + { + dPOPTOPiirl; + if (!right) + DIE(aTHX_ "Illegal modulus zero"); + SETi( left % right ); + RETURN; + } +} + +STATIC +PP(pp_i_modulo_1) +{ +#ifdef __GLIBC__ + /* This is the i_modulo with the workaround for the _moddi3 bug + * in (at least) glibc 2.2.5 (the "right = -right" is the workaround). + * See below for pp_i_modulo. */ + dSP; dATARGET; tryAMAGICbin(modulo,opASSIGN); + { + dPOPTOPiirl; + if (!right) + DIE(aTHX_ "Illegal modulus zero"); + if (right < 0) + right = -right; + SETi( left % right ); + RETURN; + } +#endif +} + PP(pp_i_modulo) { - dSP; dATARGET; tryAMAGICbin(modulo,opASSIGN); - { - dPOPTOPiirl; - if (!right) - DIE(aTHX_ "Illegal modulus zero"); - SETi( left % right ); - RETURN; - } + dSP; dATARGET; tryAMAGICbin(modulo,opASSIGN); + { + dPOPTOPiirl; + if (!right) + DIE(aTHX_ "Illegal modulus zero"); + /* The assumption is to use hereafter the old vanilla version... */ + PL_op->op_ppaddr = + PL_ppaddr[OP_I_MODULO] = + &Perl_pp_i_modulo_0; + /* .. but if we have glibc, we might have a buggy _moddi3 + * (at least glicb 2.2.5 is known to have this bug), in other + * words our integer modulus with negative quad as the second + * argument might be broken. Test for this and re-patch the + * opcode dispatch table if that is the case, remembering to + * also apply the workaround so that this first round works + * right, too. See [perl #9402] for more information. */ +#if defined(__GLIBC__) && IVSIZE == 8 + { + IV l = 3; + IV r = -10; + /* Cannot do this check with inlined IV constants since + * that seems to work correctly even with the buggy glibc. */ + if (l % r == -3) { + /* Yikes, we have the bug. + * Patch in the workaround version. */ + PL_op->op_ppaddr = + PL_ppaddr[OP_I_MODULO] = + &Perl_pp_i_modulo_1; + /* Make certain we work right this time, too. */ + if (right < 0) + right = -right; + } + } +#endif + SETi( left % right ); + RETURN; + } } PP(pp_i_add) @@ -1,6 +1,6 @@ /* pp.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pp_ctl.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -328,7 +328,9 @@ PP(pp_formline) bool gotsome = FALSE; STRLEN len; STRLEN fudge = SvCUR(tmpForm) * (IN_BYTES ? 1 : 3) + 1; - bool item_is_utf = FALSE; + bool item_is_utf8 = FALSE; + bool targ_is_utf8 = FALSE; + SV * nsv = Nullsv; if (!SvMAGICAL(tmpForm) || !SvCOMPILED(tmpForm)) { if (SvREADONLY(tmpForm)) { @@ -339,8 +341,9 @@ PP(pp_formline) else doparseform(tmpForm); } - SvPV_force(PL_formtarget, len); + if (DO_UTF8(PL_formtarget)) + targ_is_utf8 = TRUE; t = SvGROW(PL_formtarget, len + fudge + 1); /* XXX SvCUR bad */ t += len; f = SvPV(tmpForm, len); @@ -387,6 +390,21 @@ PP(pp_formline) case FF_LITERAL: arg = *fpc++; + if (targ_is_utf8 && !SvUTF8(tmpForm)) { + SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget)); + *t = '\0'; + sv_catpvn_utf8_upgrade(PL_formtarget, f, arg, nsv); + t = SvEND(PL_formtarget); + break; + } + if (!targ_is_utf8 && DO_UTF8(tmpForm)) { + SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget)); + *t = '\0'; + sv_utf8_upgrade(PL_formtarget); + SvGROW(PL_formtarget, SvCUR(PL_formtarget) + fudge + 1); + t = SvEND(PL_formtarget); + targ_is_utf8 = TRUE; + } while (arg--) *t++ = *f++; break; @@ -431,13 +449,13 @@ PP(pp_formline) break; s++; } - item_is_utf = TRUE; + item_is_utf8 = TRUE; itemsize = s - item; sv_pos_b2u(sv, &itemsize); break; } } - item_is_utf = FALSE; + item_is_utf8 = FALSE; if (itemsize > fieldsize) itemsize = fieldsize; send = chophere = s + itemsize; @@ -492,11 +510,11 @@ PP(pp_formline) itemsize = chophere - item; sv_pos_b2u(sv, &itemsize); } - item_is_utf = TRUE; + item_is_utf8 = TRUE; break; } } - item_is_utf = FALSE; + item_is_utf8 = FALSE; if (itemsize <= fieldsize) { send = chophere = s + itemsize; while (s < send) { @@ -552,7 +570,15 @@ PP(pp_formline) case FF_ITEM: arg = itemsize; s = item; - if (item_is_utf) { + if (item_is_utf8) { + if (!targ_is_utf8) { + SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget)); + *t = '\0'; + sv_utf8_upgrade(PL_formtarget); + SvGROW(PL_formtarget, SvCUR(PL_formtarget) + fudge + 1); + t = SvEND(PL_formtarget); + targ_is_utf8 = TRUE; + } while (arg--) { if (UTF8_IS_CONTINUED(*s)) { STRLEN skip = UTF8SKIP(s); @@ -578,6 +604,21 @@ PP(pp_formline) } break; } + if (targ_is_utf8 && !item_is_utf8) { + SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget)); + *t = '\0'; + sv_catpvn_utf8_upgrade(PL_formtarget, s, arg, nsv); + for (; t < SvEND(PL_formtarget); t++) { +#ifdef EBCDIC + int ch = *t++ = *s++; + if (iscntrl(ch)) +#else + if (!(*t & ~31)) +#endif + *t = ' '; + } + break; + } while (arg--) { #ifdef EBCDIC int ch = *t++ = *s++; @@ -601,22 +642,32 @@ PP(pp_formline) case FF_LINEGLOB: item = s = SvPV(sv, len); itemsize = len; - item_is_utf = FALSE; /* XXX is this correct? */ + if ((item_is_utf8 = DO_UTF8(sv))) + itemsize = sv_len_utf8(sv); if (itemsize) { + bool chopped = FALSE; gotsome = TRUE; - send = s + itemsize; + send = s + len; while (s < send) { if (*s++ == '\n') { - if (s == send) + if (s == send) { itemsize--; + chopped = TRUE; + } else lines++; } } SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget)); - sv_catpvn(PL_formtarget, item, itemsize); + if (targ_is_utf8) + SvUTF8_on(PL_formtarget); + sv_catsv(PL_formtarget, sv); + if (chopped) + SvCUR_set(PL_formtarget, SvCUR(PL_formtarget) - 1); SvGROW(PL_formtarget, SvCUR(PL_formtarget) + fudge + 1); t = SvPVX(PL_formtarget) + SvCUR(PL_formtarget); + if (item_is_utf8) + targ_is_utf8 = TRUE; } break; @@ -712,6 +763,8 @@ PP(pp_formline) if (strnEQ(linemark, linemark - arg, arg)) DIE(aTHX_ "Runaway format"); } + if (targ_is_utf8) + SvUTF8_on(PL_formtarget); FmLINES(PL_formtarget) = lines; SP = ORIGMARK; RETURNOP(cLISTOP->op_first); @@ -751,6 +804,8 @@ PP(pp_formline) case FF_END: *t = '\0'; SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget)); + if (targ_is_utf8) + SvUTF8_on(PL_formtarget); FmLINES(PL_formtarget) += lines; SP = ORIGMARK; RETPUSHYES; @@ -1,6 +1,6 @@ /* pp_hot.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pp_pack.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pp_sort.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* pp_sys.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * proto.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * reentr.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ /* * reentr.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -41,7 +41,7 @@ print <<EOF; /* * reentr.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -715,7 +715,7 @@ print <<EOF; /* * reentr.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -69,7 +69,7 @@ * **** Alterations to Henry's code are... **** - **** Copyright (c) 1991-2002, Larry Wall + **** Copyright (c) 1991-2003, Larry Wall **** **** You may distribute under the terms of either the GNU General Public **** License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* regcomp.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -67,7 +67,7 @@ * **** Alterations to Henry's code are... **** - **** Copyright (c) 1991-2002, Larry Wall + **** Copyright (c) 1991-2003, Larry Wall **** **** You may distribute under the terms of either the GNU General Public **** License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* regexp.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* run.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* scope.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* scope.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* sv.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* sv.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/t/op/magic.t b/t/op/magic.t index 0619c0dc34..8f598a1049 100755 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -36,7 +36,7 @@ sub skip { return 1; } -print "1..50\n"; +print "1..52\n"; $Is_MSWin32 = $^O eq 'MSWin32'; $Is_NetWare = $^O eq 'NetWare'; @@ -67,7 +67,7 @@ ok $!, $!; close FOO; # just mention it, squelch used-only-once if ($Is_MSWin32 || $Is_NetWare || $Is_Dos || $Is_MPE || $Is_MacOS) { - skip('SIGINT not safe on this platform') for 1..2; + skip('SIGINT not safe on this platform') for 1..4; } else { # the next tests are done in a subprocess because sh spits out a @@ -98,7 +98,35 @@ END close CMDPIPE; - $test += 2; + open( CMDPIPE, "| $PERL"); + print CMDPIPE <<'END'; + + { package X; + sub DESTROY { + kill "INT",$$; + } + } + sub x { + my $x=bless [], 'X'; + return sub { $x }; + } + $| = 1; # command buffering + $SIG{"INT"} = "ok5"; + { + local $SIG{"INT"}=x(); + print ""; # Needed to expose failure in 5.8.0 (why?) + } + sleep 1; + delete $SIG{"INT"}; + kill "INT",$$; sleep 1; + sub ok5 { + print "ok 5\n"; + } +END + close CMDPIPE; + print $? & 0xFF ? "ok 6\n" : "not ok 6\n"; + + $test += 4; } # can we slice ENV? diff --git a/t/op/pat.t b/t/op/pat.t index 40a265882c..b3f42a8b46 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..990\n"; +print "1..993\n"; BEGIN { chdir 't' if -d 't'; @@ -3123,5 +3123,21 @@ ok("bbbbac" =~ /$pattern/ && $1 eq 'a', "[perl #3547]"); ok ( $p == 5, "(??{ }) returns stale values"); } -# last test 990 +{ + # Subject: Odd regexp behavior + # From: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> + # Date: Wed, 26 Feb 2003 16:53:12 +0000 + # Message-Id: <E18o4nw-0008Ly-00@wisbech.cl.cam.ac.uk> + # To: perl-unicode@perl.org + + $x = "\x{2019}\nk"; $x =~ s/(\S)\n(\S)/$1 $2/sg; + ok($x eq "\x{2019} k", "Markus Kuhn 2003-02-26"); + + $x = "b\nk"; $x =~ s/(\S)\n(\S)/$1 $2/sg; + ok($x eq "b k", "Markus Kuhn 2003-02-26"); + + ok("\x{2019}" =~ /\S/, "Markus Kuhn 2003-02-26"); +} + +# last test 993 diff --git a/t/run/switchC.t b/t/run/switchC.t index 9283fa879b..c3cc4033a7 100644 --- a/t/run/switchC.t +++ b/t/run/switchC.t @@ -25,11 +25,17 @@ $r = runperl( switches => [ '-CO', '-w' ], 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' ); +SKIP: { + if (exists $ENV{PERL_UNICODE} && + ($ENV{PERL_UNICODE} eq "" || $ENV{PERL_UNICODE} =~ /[SO]/)) { + skip(qq[cannot test with PERL_UNICODE locale "" or /[SO]/], 1); + } + $r = runperl( switches => [ '-CI', '-w' ], + prog => 'print ord(<STDIN>)', + stderr => 1, + stdin => "\xC4\x80" ); + is( $r, 256, '-CI: read in UTF-8 input' ); +} $r = runperl( switches => [ '-CE', '-w' ], prog => 'warn chr(256), qq(\n)', diff --git a/t/uni/write.t b/t/uni/write.t new file mode 100644 index 0000000000..95c3bbb36a --- /dev/null +++ b/t/uni/write.t @@ -0,0 +1,96 @@ +#!./perl -w +use strict; + +BEGIN { + chdir 't' if -d 't'; + @INC = qw(../lib .); + require "test.pl"; +} + +plan tests => 6; + +# Some tests for UTF8 and format/write + +our ($bitem1, $uitem1) = ("\x{ff}", "\x{100}"); +our ($bitem2, $uitem2) = ("\x{fe}", "\x{101}"); +our ($blite1, $ulite1) = ("\x{fd}", "\x{102}"); +our ($blite2, $ulite2) = ("\x{fc}", "\x{103}"); +our ($bmulti, $umulti) = ("\x{fb}\n\x{fa}\n\x{f9}\n", + "\x{104}\n\x{105}\n\x{106}\n"); + +sub fmwrtest { + no strict 'refs'; + my ($out, $format, $expect, $name) = @_; + eval "format $out =\n$format.\n"; die $@ if $@; + open $out, '>:utf8', 'Uni_write.tmp' or die "Can't create Uni_write.tmp"; + write $out; + close $out or die "Could not close $out: $!"; + + open UIN, '<:utf8', 'Uni_write.tmp' or die "Can't open Uni_write.tmp";; + my $result = do { local $/; <UIN>; }; + close UIN; + + is($result, $expect, $name); +} + +fmwrtest OUT1 => <<EOFORMAT, <<EOEXPECT, "non-UTF8 literal / UTF8 item (1)"; +$blite1 @<< +\$uitem1 +$blite2 @<< +\$bitem2 +EOFORMAT +$blite1 $uitem1 +$blite2 $bitem2 +EOEXPECT + +fmwrtest OUT2 => <<EOFORMAT, <<EOEXPECT, "non-UTF8 literal / UTF8 item (2)"; +$blite1 @<< +\$bitem1 +$blite2 @<< +\$uitem2 +EOFORMAT +$blite1 $bitem1 +$blite2 $uitem2 +EOEXPECT + +fmwrtest OUT3 => <<EOFORMAT, <<EOEXPECT, "UTF8 literal / non-UTF8 item (1)"; +$ulite1 @<< +\$bitem1 +$blite2 @<< +\$bitem2 +EOFORMAT +$ulite1 $bitem1 +$blite2 $bitem2 +EOEXPECT + +fmwrtest OUT4 => <<EOFORMAT, <<EOEXPECT, "UTF8 literal / non-UTF8 item (2)"; +$blite1 @<< +\$bitem1 +$ulite2 @<< +\$bitem2 +EOFORMAT +$blite1 $bitem1 +$ulite2 $bitem2 +EOEXPECT + +fmwrtest OUT5 => <<EOFORMAT, <<EOEXPECT, "non-UTF8 literal / UTF8 multiline"; +$blite1 +@* +\$umulti +$blite2 +EOFORMAT +$blite1 +$umulti$blite2 +EOEXPECT + +fmwrtest OUT6 => <<EOFORMAT, <<EOEXPECT, "UTF8 literal / non-UTF8 multiline"; +$ulite1 +@* +\$bmulti +$blite2 +EOFORMAT +$ulite1 +$bmulti$blite2 +EOEXPECT + +unlink 'Uni_write.tmp'; @@ -1,6 +1,6 @@ /* taint.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* thdrvar.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* thread.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* toke.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -7595,6 +7595,12 @@ S_scan_formline(pTHX_ register char *s) } else PL_lex_state = LEX_FORMLINE; + if (!IN_BYTES) { + if (UTF && is_utf8_string((U8*)SvPVX(stuff), SvCUR(stuff))) + SvUTF8_on(stuff); + else if (PL_encoding) + sv_recode_to_utf8(stuff, PL_encoding); + } PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, stuff); force_next(THING); PL_nextval[PL_nexttoke].ival = OP_FORMLINE; diff --git a/universal.c b/universal.c index 5602a10fa4..1f8a34ba7f 100644 --- a/universal.c +++ b/universal.c @@ -1,6 +1,6 @@ /* universal.c * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* unixish.h * - * Copyright (c) 1997-2002, Larry Wall + * Copyright (c) 1997-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* utf8.c * - * Copyright (c) 1998-2002, Larry Wall + * Copyright (c) 1998-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* utf8.h * - * Copyright (c) 1998-2002, Larry Wall + * Copyright (c) 1998-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/utfebcdic.h b/utfebcdic.h index 93b598c386..aa643fb3c8 100644 --- a/utfebcdic.h +++ b/utfebcdic.h @@ -1,6 +1,6 @@ /* utfebcdic.h * - * Copyright (c) 2001-2002, Larry Wall, Nick Ing-Simmons + * Copyright (c) 2001-2003, Larry Wall, Nick Ing-Simmons * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* util.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -4333,7 +4333,7 @@ Perl_parse_unicode_opts(pTHX_ char **popt) opt = PERL_UNICODE_DEFAULT_FLAGS; if (opt & ~PERL_UNICODE_ALL_FLAGS) - Perl_croak(aTHX_ "Unknown Unicode option value 0x%"UVuf, + Perl_croak(aTHX_ "Unknown Unicode option value %"UVuf, (UV) (opt & ~PERL_UNICODE_ALL_FLAGS)); *popt = p; @@ -1,6 +1,6 @@ /* util.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/EXTERN.h b/x2p/EXTERN.h index 792dc2679f..444016b13c 100644 --- a/x2p/EXTERN.h +++ b/x2p/EXTERN.h @@ -1,6 +1,6 @@ /* $RCSfile: EXTERN.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:05 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/INTERN.h b/x2p/INTERN.h index 424b14b83d..1d85d1aec4 100644 --- a/x2p/INTERN.h +++ b/x2p/INTERN.h @@ -1,6 +1,6 @@ /* $RCSfile: INTERN.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:06 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -5,7 +5,7 @@ #line 2 "a2p.y" /* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* $RCSfile: a2p.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:09 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,7 +1,7 @@ %{ /* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/hash.c b/x2p/hash.c index dbdc928424..b8d2e78e13 100644 --- a/x2p/hash.c +++ b/x2p/hash.c @@ -1,6 +1,6 @@ /* $RCSfile: hash.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:20 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/hash.h b/x2p/hash.h index 85ce07c2f7..0c202d0af3 100644 --- a/x2p/hash.h +++ b/x2p/hash.h @@ -1,6 +1,6 @@ /* $RCSfile: hash.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:21 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/proto.h b/x2p/proto.h index 5deeb3441a..02e0893ad3 100644 --- a/x2p/proto.h +++ b/x2p/proto.h @@ -1,6 +1,6 @@ /* proto.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* $RCSfile: str.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:26 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* $RCSfile: str.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:27 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/util.c b/x2p/util.c index f0875577fe..8ad88990c6 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -1,6 +1,6 @@ /* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/util.h b/x2p/util.h index 146b0899c2..a2ff5b94be 100644 --- a/x2p/util.h +++ b/x2p/util.h @@ -1,6 +1,6 @@ /* $RCSfile: util.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:30 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. diff --git a/x2p/walk.c b/x2p/walk.c index 0823289ef8..44908a232c 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -1,6 +1,6 @@ /* $RCSfile: walk.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:31 $ * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (c) 1991-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -1,6 +1,6 @@ /* xsutils.c * - * Copyright (c) 1999-2002, Larry Wall + * Copyright (c) 1999-2003, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. |