Skip to content

Commit

Permalink
[inseparable changes from patch from perl5.003_08 to perl5.003_09]
Browse files Browse the repository at this point in the history
 CORE LANGUAGE CHANGES

Subject: Lexical locales
From: Chip Salzenberg <chip@atlantic.net>
Files: too many to list

    make effectiveness of locales depend on C<use locale>

Subject: Lexical scoping cleanup
From: Chip Salzenberg <chip@atlantic.net>
Files: many... but mostly perly.y and toke.c

    tighten scoping of lexical variables, somewhat on the
    new constructs and somewhat on the old

Subject: memory corruption / security bug in sysread,syswrite + patch
Date: Mon, 25 Nov 1996 21:46:31 +0200 (EET)
From: Jarkko Hietaniemi <jhi@cc.hut.fi>
Files: MANIFEST pod/perldiag.pod pod/perlfunc.pod pp_sys.c t/op/sysio.t
Msg-ID: <199611251946.VAA30459@alpha.hut.fi>

    (applied based on p5p patch as commit d7090df)

 DOCUMENTATION

Subject: perldiag documentation patch.
Date: Wed, 20 Nov 96 16:07:28 GMT
From: Paul Marquess <pmarquess@bfsec.bt.co.uk>
Files: pod/perldiag.pod

    private-msgid: <9611201607.AA12729@claudius.bfsec.bt.co.uk>

Subject: a missing perldiag entry
Date: Thu, 21 Nov 1996 15:24:02 -0500
From: Gurusamy Sarathy <gsar@engin.umich.edu>
Files: pod/perldiag.pod

    private-msgid: <199611212024.PAA15758@aatma.engin.umich.edu>

Subject: perlfunc patch
Date: Wed, 20 Nov 96 14:04:08 GMT
From: Paul Marquess <pmarquess@bfsec.bt.co.uk>
Files: pod/perlfunc.pod

    Following on from the patch to make uc, lc etc default to $_ (as per
    Camel II), here is a followup patch to perlfunc that documents the
    change. I think I have documented all the other cases where $_
    defaulting works as well.
    
    p5p-msgid: <9611201404.AA12477@claudius.bfsec.bt.co.uk>

 OTHER CORE CHANGES

Subject: Properly prototype safe{malloc,calloc,realloc,free}.
From: Chip Salzenberg <chip@atlantic.net>
Files: proto.h

Subject: UnixWare 2.1 fix for perl5.003_08 - cope with fp->_cnt < -1, allow debugging
Date: Wed, 20 Nov 1996 14:27:06 +0100
From: John Hughes <john@AtlanTech.COM>
Files: sv.c

    UnixWare 2.1 has no fp->_base so most of the debugging stuff in sv_gets just
    core dumps.
    
    Also, for some unknown reason fp->_cnt is sometimes < -1, screwing up the
    initial SvGROW in svgets.
    
    Appart from that its io is std.
    
    p5p-msgid: <01BBD6EE.E915C860@malvinas.AtlanTech.COM>

Subject: die -> croak
Date: Thu, 21 Nov 1996 16:11:21 -0500
From: Gurusamy Sarathy <gsar@engin.umich.edu>
Files: pp_ctl.c

    private-msgid: <199611212111.QAA17070@aatma.engin.umich.edu>

Subject: Cleanup of {,un}pack('w').
From: Chip Salzenberg <chip@atlantic.net>
Files: pp.c

Subject: Cleanups from Ilya.
From: Chip Salzenberg <chip@atlantic.net>
Files: gv.c malloc.c pod/perlguts.pod pp_ctl.c

Subject: Fix for unpack('w') on 64-bit systems.
From: Chip Salzenberg <chip@atlantic.net>
Files: pp.c

Subject: Re: LC_NUMERIC support is ready + performance
Date: Mon, 25 Nov 1996 22:08:27 -0500 (EST)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Files: sv.c

    Chip Salzenberg writes:
    > 
    > Having thought about the use of our own gcvt() and atof(), I've run
    > away in horror.  It's just too hairy.
    > 
    > So I've implemented the only viable alternative I know of: Toggling
    > LC_NUMERIC to/from "C" as needed.
    > 
    > Patch follows.
    > 
    > I think _09 is *very* close.
    
    Since _09 is going to be alpha anyway, I reiterate my question:
    	Is there any reason to not include my hash/array performance
    		patches in _09?
    
    Btw, here is the next performance patch. It makes PADTMP values
    stealable too. I do not do by setting TEMP flags on them, since it
    would be a very distributed patch, and it would break some places
    which check for TEMP for some other reasons (yes, I checked ;-).
    
    This patch decreases *twice* the memory usage of
    	perl -e '$a = "a" x 1e6; 1'
    
    Enjoy,
    
    p5p-msgid: <199611260308.WAA02677@monk.mps.ohio-state.edu>

Subject: Hash key sharing improvements from Ilya.
From: Chip Salzenberg <chip@atlantic.net>
Files: hv.c hv.h proto.h

Subject: Mortal stack pre-allocation from Ilya.
From: Chip Salzenberg <chip@atlantic.net>
Files: pp.c pp.h pp_ctl.c pp_hot.c pp_sys.c

 PORTABILITY

Subject: VMS patches post-5.003_08
Date: Fri, 22 Nov 1996 18:16:31 -0500 (EST)
From: Charles Bailey <bailey@hmivax.humgen.upenn.edu>
Files: lib/ExtUtils/MM_Unix.pm lib/ExtUtils/MM_VMS.pm lib/ExtUtils/MakeMaker.pm lib/File/Path.pm mg.c pp_ctl.c utils/h2xs.PL vms/config.vms vms/descrip.mms vms/gen_shrfls.pl vms/genconfig.pl vms/perlvms.pod vms/vms.c vms/vmsish.h

    Here're diffs to bring a base 5.003_08 up to the current VMS working
    sources.  Nearly all of the changes are VMS-specific, and comprise
    miscellaneous bugfixes accumulated since 5.003_07, rather than any
    particular problem with 5.003_08.  I'm posting them here since some
    of the patches change core files, and I'd like to insure that I
    haven't accidentally created problems for anyone else.
    
    With these and a couple of of the small patches already send to p5p,
    5.003_08 builds clean and passes all tests under VMS.
    
    Thanks, Chip, for all the work.
    
    p5p-msgid: <1996Nov22.181631.1603238@hmivax.humgen.upenn.edu>
  • Loading branch information
Perl 5 Porters authored and Chip Salzenberg committed Nov 26, 1996
1 parent 6d82b38 commit bbce6d6
Show file tree
Hide file tree
Showing 57 changed files with 4,332 additions and 3,137 deletions.
3 changes: 3 additions & 0 deletions MANIFEST
Expand Up @@ -335,6 +335,7 @@ lib/assert.pl assertion and panic with stack trace
lib/bigfloat.pl An arbitrary precision floating point package
lib/bigint.pl An arbitrary precision integer arithmetic package
lib/bigrat.pl An arbitrary precision rational arithmetic package
lib/blib.pm For "use blib"
lib/cacheout.pl Manages output filehandles when you need too many
lib/chat2.inter A chat2 with interaction
lib/chat2.pl Randal's famous expect-ish routines
Expand All @@ -357,6 +358,7 @@ lib/importenv.pl Perl routine to get environment into variables
lib/integer.pm For "use integer"
lib/less.pm For "use less"
lib/lib.pm For "use lib"
lib/locale.pm For "use locale"
lib/look.pl A "look" equivalent
lib/newgetopt.pl A perl library supporting long option parsing
lib/open2.pl Open a two-ended pipe
Expand Down Expand Up @@ -653,6 +655,7 @@ t/op/stat.t See if stat works
t/op/study.t See if study works
t/op/subst.t See if substitution works
t/op/substr.t See if substr works
t/op/sysio.t See if sysread and syswrite work
t/op/tie.t See if tie/untie functions work
t/op/time.t See if time functions work
t/op/undef.t See if undef works
Expand Down
7 changes: 4 additions & 3 deletions doio.c
Expand Up @@ -1073,9 +1073,10 @@ register SV **sp;

if (tainting) {
while (++mark <= sp) {
MAGIC *mg;
if (SvMAGICAL(*mark) && (mg = mg_find(*mark, 't')) && mg->mg_len & 1)
tainted = TRUE;
if (SvTAINTED(*mark)) {
TAINT;
break;
}
}
mark = oldmark;
}
Expand Down
5 changes: 5 additions & 0 deletions doop.c
Expand Up @@ -273,6 +273,11 @@ register SV **sarg;
*t = '\0';
(void)sprintf(xs,f,SvNV(arg));
xlen = strlen(xs);
#ifdef LC_NUMERIC
/* User-defined locales may include arbitrary characters */
if (! numeric_standard)
SvTAINTED_on(sv);
#endif
break;
case 's':
ch = *(++t);
Expand Down
2 changes: 0 additions & 2 deletions dump.c
Expand Up @@ -357,8 +357,6 @@ register PMOP *pm;
(void)strcat(buf,"ALL,");
if (pm->op_pmflags & PMf_SKIPWHITE)
(void)strcat(buf,"SKIPWHITE,");
if (pm->op_pmflags & PMf_FOLD)
(void)strcat(buf,"FOLD,");
if (pm->op_pmflags & PMf_CONST)
(void)strcat(buf,"CONST,");
if (pm->op_pmflags & PMf_KEEP)
Expand Down
31 changes: 24 additions & 7 deletions embed.h
Expand Up @@ -41,6 +41,11 @@
#define bufptr Perl_bufptr
#define bxor_amg Perl_bxor_amg
#define check Perl_check
#define collation_ix Perl_collation_ix
#define collation_name Perl_collation_name
#define collation_standard Perl_collation_standard
#define collxfrm_base Perl_collxfrm_base
#define collxfrm_mult Perl_collxfrm_mult
#define compcv Perl_compcv
#define compiling Perl_compiling
#define compl_amg Perl_compl_amg
Expand Down Expand Up @@ -79,6 +84,7 @@
#define filter_del Perl_filter_del
#define filter_read Perl_filter_read
#define fold Perl_fold
#define fold_locale Perl_fold_locale
#define freq Perl_freq
#define ge_amg Perl_ge_amg
#define gid Perl_gid
Expand All @@ -92,7 +98,6 @@
#define last_lop Perl_last_lop
#define last_lop_op Perl_last_lop_op
#define last_uni Perl_last_uni
#define lc_collate_active Perl_lc_collate_active
#define le_amg Perl_le_amg
#define lex_brackets Perl_lex_brackets
#define lex_brackstack Perl_lex_brackstack
Expand Down Expand Up @@ -157,6 +162,9 @@
#define nomemok Perl_nomemok
#define nomethod_amg Perl_nomethod_amg
#define not_amg Perl_not_amg
#define numeric_local Perl_numeric_local
#define numeric_name Perl_numeric_name
#define numeric_standard Perl_numeric_standard
#define numer_amg Perl_numer_amg
#define oldbufptr Perl_oldbufptr
#define oldoldbufptr Perl_oldoldbufptr
Expand Down Expand Up @@ -189,7 +197,6 @@
#define regendp Perl_regendp
#define regeol Perl_regeol
#define regflags Perl_regflags
#define regfold Perl_regfold
#define reginput Perl_reginput
#define regkind Perl_regkind
#define reglastparen Perl_reglastparen
Expand Down Expand Up @@ -261,6 +268,7 @@
#define vtbl_amagicelem Perl_vtbl_amagicelem
#define vtbl_arylen Perl_vtbl_arylen
#define vtbl_bm Perl_vtbl_bm
#define vtbl_collxfrm Perl_vtbl_collxfrm
#define vtbl_dbline Perl_vtbl_dbline
#define vtbl_env Perl_vtbl_env
#define vtbl_envelem Perl_vtbl_envelem
Expand Down Expand Up @@ -338,9 +346,9 @@
#define ck_eof Perl_ck_eof
#define ck_eval Perl_ck_eval
#define ck_exec Perl_ck_exec
#define ck_formline Perl_ck_formline
#define ck_ftst Perl_ck_ftst
#define ck_fun Perl_ck_fun
#define ck_fun_locale Perl_ck_fun_locale
#define ck_glob Perl_ck_glob
#define ck_grep Perl_ck_grep
#define ck_gvconst Perl_ck_gvconst
Expand All @@ -355,6 +363,7 @@
#define ck_retarget Perl_ck_retarget
#define ck_rfun Perl_ck_rfun
#define ck_rvconst Perl_ck_rvconst
#define ck_scmp Perl_ck_scmp
#define ck_select Perl_ck_select
#define ck_shift Perl_ck_shift
#define ck_sort Perl_ck_sort
Expand Down Expand Up @@ -475,8 +484,10 @@
#define hv_store_ent Perl_hv_store_ent
#define hv_undef Perl_hv_undef
#define ibcmp Perl_ibcmp
#define ibcmp_locale Perl_ibcmp_locale
#define ingroup Perl_ingroup
#define instr Perl_instr
#define intro_my Perl_intro_my
#define intuit_more Perl_intuit_more
#define invert Perl_invert
#define jmaybe Perl_jmaybe
Expand Down Expand Up @@ -507,6 +518,7 @@
#define magic_setamagic Perl_magic_setamagic
#define magic_setarylen Perl_magic_setarylen
#define magic_setbm Perl_magic_setbm
#define magic_setcollxfrm Perl_magic_setcollxfrm
#define magic_setdbline Perl_magic_setdbline
#define magic_setenv Perl_magic_setenv
#define magic_setfm Perl_magic_setfm
Expand Down Expand Up @@ -1062,6 +1074,8 @@
#define sv_clean_objs Perl_sv_clean_objs
#define sv_clear Perl_sv_clear
#define sv_cmp Perl_sv_cmp
#define sv_cmp_locale Perl_sv_cmp_locale
#define sv_collxfrm Perl_sv_collxfrm
#define sv_dec Perl_sv_dec
#define sv_derived_from Perl_sv_derived_from
#define sv_dump Perl_sv_dump
Expand Down Expand Up @@ -1097,12 +1111,14 @@
#define sv_setref_pvn Perl_sv_setref_pvn
#define sv_setsv Perl_sv_setsv
#define sv_setuv Perl_sv_setuv
#define sv_taint Perl_sv_taint
#define sv_tainted Perl_sv_tainted
#define sv_unmagic Perl_sv_unmagic
#define sv_unref Perl_sv_unref
#define sv_untaint Perl_sv_untaint
#define sv_upgrade Perl_sv_upgrade
#define sv_usepvn Perl_sv_usepvn
#define taint_env Perl_taint_env
#define taint_not Perl_taint_not
#define taint_proper Perl_taint_proper
#define too_few_arguments Perl_too_few_arguments
#define too_many_arguments Perl_too_many_arguments
Expand Down Expand Up @@ -1247,7 +1263,6 @@
#define rs (curinterp->Irs)
#define runlevel (curinterp->Irunlevel)
#define sawampersand (curinterp->Isawampersand)
#define sawi (curinterp->Isawi)
#define sawstudy (curinterp->Isawstudy)
#define sawvec (curinterp->Isawvec)
#define screamfirst (curinterp->Iscreamfirst)
Expand Down Expand Up @@ -1400,7 +1415,6 @@
#define Irs rs
#define Irunlevel runlevel
#define Isawampersand sawampersand
#define Isawi sawi
#define Isawstudy sawstudy
#define Isawvec sawvec
#define Iscreamfirst screamfirst
Expand Down Expand Up @@ -1434,6 +1448,8 @@
#define Iunsafe unsafe
#define Iwarnhook warnhook

#ifdef EMBED

#define Argv Perl_Argv
#define Cmd Perl_Cmd
#define DBgv Perl_DBgv
Expand Down Expand Up @@ -1551,7 +1567,6 @@
#define rs Perl_rs
#define runlevel Perl_runlevel
#define sawampersand Perl_sawampersand
#define sawi Perl_sawi
#define sawstudy Perl_sawstudy
#define sawvec Perl_sawvec
#define screamfirst Perl_screamfirst
Expand Down Expand Up @@ -1585,4 +1600,6 @@
#define unsafe Perl_unsafe
#define warnhook Perl_warnhook

#endif /* EMBED */

#endif /* MULTIPLICITY */
59 changes: 55 additions & 4 deletions ext/POSIX/POSIX.xs
Expand Up @@ -2736,8 +2736,59 @@ setlocale(category, locale = 0)
char * locale
CODE:
RETVAL = setlocale(category, locale);
if (RETVAL)
perl_init_fold();
if (RETVAL) {
#ifdef LC_CTYPE
if (category == LC_CTYPE
#ifdef LC_ALL
|| category == LC_ALL
#endif
)
{
char *newctype;
#ifdef LC_ALL
if (category == LC_ALL)
newctype = setlocale(LC_CTYPE, NULL);
else
#endif
newctype = RETVAL;
perl_new_ctype(newctype);
}
#endif /* LC_CTYPE */
#ifdef LC_COLLATE
if (category == LC_COLLATE
#ifdef LC_ALL
|| category == LC_ALL
#endif
)
{
char *newcoll;
#ifdef LC_ALL
if (category == LC_ALL)
newcoll = setlocale(LC_COLLATE, NULL);
else
#endif
newcoll = RETVAL;
perl_new_collate(newcoll);
}
#endif /* LC_COLLATE */
#ifdef LC_NUMERIC
if (category == LC_NUMERIC
#ifdef LC_ALL
|| category == LC_ALL
#endif
)
{
char *newnum;
#ifdef LC_ALL
if (category == LC_ALL)
newnum = setlocale(LC_NUMERIC, NULL);
else
#endif
newnum = RETVAL;
perl_new_numeric(newnum);
}
#endif /* LC_NUMERIC */
}
OUTPUT:
RETVAL

Expand Down Expand Up @@ -2962,8 +3013,7 @@ read(fd, buffer, nbytes)
SvCUR(sv_buffer) = RETVAL;
SvPOK_only(sv_buffer);
*SvEND(sv_buffer) = '\0';
if (tainting)
sv_magic(sv_buffer, 0, 't', 0, 0);
SvTAINTED_on(sv_buffer);
}

SysRet
Expand Down Expand Up @@ -3053,6 +3103,7 @@ strtod(str)
double num;
char *unparsed;
PPCODE:
NUMERIC_LOCAL();
num = strtod(str, &unparsed);
PUSHs(sv_2mortal(newSVnv(num)));
if (GIMME == G_ARRAY) {
Expand Down
5 changes: 2 additions & 3 deletions gv.c
Expand Up @@ -285,8 +285,7 @@ char* name;
sv_catpvn(tmpstr,"::", 2);
sv_catpvn(tmpstr, name, nend - name);
sv_setsv(GvSV(CvGV(cv)), tmpstr);
if (tainting)
sv_unmagic(GvSV(CvGV(cv)), 't');
SvTAINTED_off(GvSV(CvGV(cv)));
}
}
}
Expand Down Expand Up @@ -1231,7 +1230,7 @@ int flags;
ans=SvIV(res)!=0; break;
case inc_amg:
case dec_amg:
SvSetSV(left,res); return res; break;
SvSetSV(left,res); return left;
case not_amg:
ans=!SvOK(res); break;
}
Expand Down

0 comments on commit bbce6d6

Please sign in to comment.