diff options
author | Andrew Fresh <afresh1@cvs.openbsd.org> | 2024-05-14 19:39:02 +0000 |
---|---|---|
committer | Andrew Fresh <afresh1@cvs.openbsd.org> | 2024-05-14 19:39:02 +0000 |
commit | 45c703581717284c37fbb2abc2968de039f80a64 (patch) | |
tree | 4bc6b627547b709d1beaa366b98c92444fe5c5b8 /gnu/usr.bin/perl/ext | |
parent | 0aa19f5e10f3aa68dc15f265cb9e764af0950d32 (diff) |
Fix merge issues, remove excess files - match perl-5.38.2 dist
ok gkoehler@
Commit and we'll fix fallout bluhm@
Right away, please deraadt@
Diffstat (limited to 'gnu/usr.bin/perl/ext')
64 files changed, 1828 insertions, 1595 deletions
diff --git a/gnu/usr.bin/perl/ext/B/B.pm b/gnu/usr.bin/perl/ext/B/B.pm index 9e6f2897c86..d0a04c6a12f 100644 --- a/gnu/usr.bin/perl/ext/B/B.pm +++ b/gnu/usr.bin/perl/ext/B/B.pm @@ -20,7 +20,7 @@ sub import { # walkoptree comes from B.xs BEGIN { - $B::VERSION = '1.83'; + $B::VERSION = '1.88'; @B::EXPORT_OK = (); # Our BOOT code needs $VERSION set, and will append to @EXPORT_OK. @@ -62,6 +62,7 @@ push @B::EXPORT_OK, (qw(minus_c ppname save_BEGINs @B::CV::ISA = 'B::PVMG'; @B::IO::ISA = 'B::PVMG'; @B::FM::ISA = 'B::CV'; +@B::OBJ::ISA = 'B::PVMG'; @B::OP::ISA = 'B::OBJECT'; @B::UNOP::ISA = 'B::OP'; @@ -88,6 +89,12 @@ our @specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no (SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD &PL_sv_zero); +# Back-compat +{ + no warnings 'once'; + *CVf_METHOD = \&CVf_NOWARN_AMBIGUOUS; +} + { # Stop "-w" from complaining about the lack of a real B::OBJECT class package B::OBJECT; @@ -299,7 +306,7 @@ B - The Perl Compiler Backend The C<B> module supplies classes which allow a Perl program to delve into its own innards. It is the module used to implement the "backends" of the Perl compiler. Usage of the compiler does not -require knowledge of this module: see the F<O> module for the +require knowledge of this module: see the L<O> module for the user-visible part. The C<B> module is of use to those who want to write new compiler backends. This documentation assumes that the reader knows a fair amount about perl's internals including such @@ -593,6 +600,26 @@ C<REFCNT> (corresponding to the C function C<SvREFCNT>). =item FLAGS +=item IsBOOL + +Returns true if the SV is a boolean (true or false). +You can then use C<TRUE> to check if the value is true or false. + + my $something = ( 1 == 1 ) # boolean true + || ( 1 == 0 ) # boolean false + || 42 # IV true + || 0; # IV false + my $sv = B::svref_2object(\$something); + + say q[Not a boolean value] + if ! $sv->IsBOOL; + + say q[This is a boolean with value: true] + if $sv->IsBOOL && $sv->TRUE_nomg; + + say q[This is a boolean with value: false] + if $sv->IsBOOL && ! $sv->TRUE_nomg; + =item object_2svref Returns a reference to the regular scalar corresponding to this @@ -601,6 +628,24 @@ to the svref_2object() subroutine. This scalar and other data it points at should be considered read-only: modifying them is neither safe nor guaranteed to have a sensible effect. +=item TRUE + +Returns a boolean indicating hether Perl would evaluate the SV as true or +false. + +B<Warning> this call performs 'get' magic. If you only want to check the +nature of this SV use C<TRUE_nomg> helper. + +This is an alias for C<SvTRUE($sv)>. + +=item TRUE_nomg + +Check if the value is true (do not perform 'get' magic). +Returns a boolean indicating whether Perl would evaluate the SV as true or +false. + +This is an alias for C<SvTRUE_nomg($sv)>. + =back =head2 B::IV Methods @@ -1313,6 +1358,8 @@ pointers and B::PADNAME objects otherwise. =item REFCNT +=item GEN + =item FLAGS For backward-compatibility, if the PADNAMEt_OUTER flag is set, the FLAGS @@ -1349,6 +1396,10 @@ Only meaningful if PADNAMEt_OUTER is set. Only meaningful if PADNAMEt_OUTER is set. +=item IsUndef + +Returns a boolean value to check if the padname is PL_padname_undef. + =back =head2 $B::overlay diff --git a/gnu/usr.bin/perl/ext/B/B.xs b/gnu/usr.bin/perl/ext/B/B.xs index 7cdd0f9c6a9..49b35cbf2fa 100644 --- a/gnu/usr.bin/perl/ext/B/B.xs +++ b/gnu/usr.bin/perl/ext/B/B.xs @@ -40,6 +40,7 @@ static const char* const svclassnames[] = { "B::CV", "B::FM", "B::IO", + "B::OBJ", }; @@ -188,7 +189,7 @@ make_temp_object(pTHX_ SV *temp) static SV * make_warnings_object(pTHX_ const COP *const cop) { - const STRLEN *const warnings = cop->cop_warnings; + const char *const warnings = cop->cop_warnings; const char *type = 0; dMY_CXT; IV iv = sizeof(specialsv_list)/sizeof(SV*); @@ -210,7 +211,7 @@ make_warnings_object(pTHX_ const COP *const cop) } else { /* B assumes that warnings are a regular SV. Seems easier to keep it happy by making them into a regular SV. */ - return make_temp_object(aTHX_ newSVpvn((char *)(warnings + 1), *warnings)); + return make_temp_object(aTHX_ newSVpvn(warnings, RCPV_LEN(warnings))); } } @@ -547,7 +548,7 @@ static const struct OP_methods { #ifdef USE_ITHREADS { STR_WITH_LEN("pmoffset"),IVp, STRUCT_OFFSET(struct pmop, op_pmoffset),},/*20*/ { STR_WITH_LEN("filegv"), op_offset_special, 0, },/*21*/ - { STR_WITH_LEN("file"), char_pp, STRUCT_OFFSET(struct cop, cop_file), },/*22*/ + { STR_WITH_LEN("file"), char_pp, STRUCT_OFFSET(struct cop, cop_file), }, /*22*/ { STR_WITH_LEN("stash"), op_offset_special, 0, },/*23*/ { STR_WITH_LEN("stashpv"), op_offset_special, 0, },/*24*/ { STR_WITH_LEN("stashoff"),PADOFFSETp,STRUCT_OFFSET(struct cop,cop_stashoff),},/*25*/ @@ -703,8 +704,8 @@ walkoptree_debug(...) CODE: dMY_CXT; RETVAL = walkoptree_debug; - if (items > 0 && SvTRUE(ST(1))) - walkoptree_debug = 1; + if (items > 0) + walkoptree_debug = SvTRUE(ST(0)); OUTPUT: RETVAL @@ -902,11 +903,9 @@ next(o) ret = make_sv_object(aTHX_ (SV *)CopFILEGV((COP*)o)); break; #endif -#ifndef USE_ITHREADS case 22: /* B::COP::file */ ret = sv_2mortal(newSVpv(CopFILE((COP*)o), 0)); break; -#endif #ifdef USE_ITHREADS case 23: /* B::COP::stash */ ret = make_sv_object(aTHX_ (SV *)CopSTASH((COP*)o)); @@ -1072,13 +1071,13 @@ next(o) */ ret = make_op_object(aTHX_ o->op_type == OP_METHOD - ? cMETHOPx(o)->op_u.op_first : NULL); + ? cMETHOPo->op_u.op_first : NULL); break; case 54: /* B::METHOP::meth_sv */ /* see comment above about METHOP */ ret = make_sv_object(aTHX_ o->op_type == OP_METHOD - ? NULL : cMETHOPx(o)->op_u.op_meth_sv); + ? NULL : cMETHOPo->op_u.op_meth_sv); break; case 55: /* B::PMOP::pmregexp */ ret = make_sv_object(aTHX_ (SV *)PM_GETRE(cPMOPo)); @@ -1088,13 +1087,13 @@ next(o) ret = sv_2mortal(newSVuv( (o->op_type == OP_METHOD_REDIR || o->op_type == OP_METHOD_REDIR_SUPER) ? - cMETHOPx(o)->op_rclass_targ : 0 + cMETHOPo->op_rclass_targ : 0 )); #else ret = make_sv_object(aTHX_ (o->op_type == OP_METHOD_REDIR || o->op_type == OP_METHOD_REDIR_SUPER) ? - cMETHOPx(o)->op_rclass_sv : NULL + cMETHOPo->op_rclass_sv : NULL ); #endif break; @@ -1398,12 +1397,12 @@ aux_list(o, cv) -MODULE = B PACKAGE = B::SV +MODULE = B PACKAGE = B::SV PREFIX = Sv #define MAGICAL_FLAG_BITS (SVs_GMG|SVs_SMG|SVs_RMG) U32 -REFCNT(sv) +SvREFCNT(sv) B::SV sv ALIAS: FLAGS = 0xFFFFFFFF @@ -1417,11 +1416,23 @@ REFCNT(sv) RETVAL void -object_2svref(sv) +Svobject_2svref(sv) B::SV sv PPCODE: ST(0) = sv_2mortal(newRV(sv)); XSRETURN(1); + +bool +SvIsBOOL(sv) + B::SV sv + +bool +SvTRUE(sv) + B::SV sv + +bool +SvTRUE_nomg(sv) + B::SV sv MODULE = B PACKAGE = B::IV PREFIX = Sv @@ -2252,6 +2263,8 @@ MODULE = B PACKAGE = B::PADNAME PREFIX = Padname sv_U32p | STRUCT_OFFSET(struct padname, xpadn_low) #define PN_cop_seq_range_high_ix \ sv_U32p | STRUCT_OFFSET(struct padname, xpadn_high) +#define PN_xpadn_gen_ix \ + sv_I32p | STRUCT_OFFSET(struct padname, xpadn_gen) #define PNL_refcnt_ix \ sv_U32p | STRUCT_OFFSET(struct padnamelist, xpadnl_refcnt) #define PL_id_ix \ @@ -2259,7 +2272,6 @@ MODULE = B PACKAGE = B::PADNAME PREFIX = Padname #define PL_outid_ix \ sv_U32p | STRUCT_OFFSET(struct padlist, xpadl_outid) - void PadnameTYPE(pn) B::PADNAME pn @@ -2270,6 +2282,7 @@ PadnameTYPE(pn) B::PADNAME::REFCNT = PN_refcnt_ix B::PADNAME::COP_SEQ_RANGE_LOW = PN_cop_seq_range_low_ix B::PADNAME::COP_SEQ_RANGE_HIGH = PN_cop_seq_range_high_ix + B::PADNAME::GEN = PN_xpadn_gen_ix B::PADNAMELIST::REFCNT = PNL_refcnt_ix B::PADLIST::id = PL_id_ix B::PADLIST::outid = PL_outid_ix @@ -2305,6 +2318,14 @@ PadnamePV(pn) SvUTF8_on(TARG); XPUSHTARG; +bool +PadnameIsUndef(padn) + B::PADNAME padn + CODE: + RETVAL = padn == &PL_padname_undef; + OUTPUT: + RETVAL + BOOT: { /* Uses less memory than an ALIAS. */ @@ -2329,7 +2350,7 @@ PadnameFLAGS(pn) RETVAL = PadnameFLAGS(pn); /* backward-compatibility hack, which should be removed if the flags field becomes large enough to hold SVf_FAKE (and - PADNAMEt_OUTER should be renumbered to match SVf_FAKE) */ + PADNAMEf_OUTER should be renumbered to match SVf_FAKE) */ STATIC_ASSERT_STMT(SVf_FAKE >= 1<<(sizeof(PadnameFLAGS((B__PADNAME)NULL)) * 8)); if (PadnameOUTER(pn)) RETVAL |= SVf_FAKE; diff --git a/gnu/usr.bin/perl/ext/B/B/Concise.pm b/gnu/usr.bin/perl/ext/B/B/Concise.pm index a7419d75e04..73d4045a63c 100644 --- a/gnu/usr.bin/perl/ext/B/B/Concise.pm +++ b/gnu/usr.bin/perl/ext/B/B/Concise.pm @@ -14,7 +14,7 @@ use warnings; # uses #3 and #4, since warnings uses Carp use Exporter 'import'; # use #5 -our $VERSION = "1.006"; +our $VERSION = "1.007"; our @EXPORT_OK = qw( set_style set_style_standard add_callback concise_subref concise_cv concise_main add_style walk_output compile reset_sequence ); @@ -1489,6 +1489,11 @@ They're opcode specific, and occur less often than the public ones, so they're represented by short mnemonics instead of single-chars; see B::Op_private and F<regen/op_private> for more details. +Note that a number after a '/' often indicates the number of arguments. +In the I<sassign> example above, the OP takes 2 arguments. These values +are sometimes used at runtime: in particular, the MAXARG macro makes use +of them. + =head1 FORMATTING SPECIFICATIONS For each line-style ('concise', 'terse', 'linenoise', etc.) there are diff --git a/gnu/usr.bin/perl/ext/B/Makefile.PL b/gnu/usr.bin/perl/ext/B/Makefile.PL index 1b30ffd08f7..0ff4f4e2e66 100644 --- a/gnu/usr.bin/perl/ext/B/Makefile.PL +++ b/gnu/usr.bin/perl/ext/B/Makefile.PL @@ -30,7 +30,7 @@ foreach my $tuple (['cop.h'], ['op.h'], ['opcode.h', 'OPp'], ['op_reg_common.h','(?:(?:RXf_)?PMf_)'], - ['pad.h','PADNAMEt_'], + ['pad.h','PADNAMEf_'], ['regexp.h','RXf_'], ['sv.h', 'SV(?:[fps]|pad)_'], ) { diff --git a/gnu/usr.bin/perl/ext/B/t/b.t b/gnu/usr.bin/perl/ext/B/t/b.t index aa67fd37558..bdf831881d3 100644 --- a/gnu/usr.bin/perl/ext/B/t/b.t +++ b/gnu/usr.bin/perl/ext/B/t/b.t @@ -306,7 +306,7 @@ is(B::opnumber("pp_null"), 0, "Testing opnumber with opname (pp_null)"); is(B::class(bless {}, "Wibble::Bibble"), "Bibble", "Testing B::class()"); is(B::cast_I32(3.14), 3, "Testing B::cast_I32()"); -is(B::opnumber("chop"), 38, "Testing opnumber with opname (chop)"); +is(B::opnumber("chop"), 39, "Testing opnumber with opname (chop)"); { no warnings 'once'; diff --git a/gnu/usr.bin/perl/ext/B/t/optree_concise.t b/gnu/usr.bin/perl/ext/B/t/optree_concise.t index cf93bd10565..b3227c62bc6 100755 --- a/gnu/usr.bin/perl/ext/B/t/optree_concise.t +++ b/gnu/usr.bin/perl/ext/B/t/optree_concise.t @@ -178,13 +178,13 @@ checkOptree ( name => "terse basic", UNOP (0x82b0918) leavesub [1] LISTOP (0x82b08d8) lineseq COP (0x82b0880) nextstate - UNOP (0x82b0860) null [14] + UNOP (0x82b0860) null [15] PADOP (0x82b0840) gvsv GV (0x82a818c) *a EOT_EOT # UNOP (0x8282310) leavesub [1] # LISTOP (0x82822f0) lineseq # COP (0x82822b8) nextstate -# UNOP (0x812fc20) null [14] +# UNOP (0x812fc20) null [15] # SVOP (0x812fc00) gvsv GV (0x814692c) *a EONT_EONT diff --git a/gnu/usr.bin/perl/ext/B/t/optree_samples.t b/gnu/usr.bin/perl/ext/B/t/optree_samples.t index 5e489d698d7..329a85b34d8 100755 --- a/gnu/usr.bin/perl/ext/B/t/optree_samples.t +++ b/gnu/usr.bin/perl/ext/B/t/optree_samples.t @@ -67,49 +67,49 @@ checkOptree ( name => '-basic (see above, with my $a = shift)', }, strip_open_hints => 1, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); -# b <1> leavesub[1 ref] K/REFC,1 ->(end) -# - <@> lineseq KP ->b +# a <1> leavesub[1 ref] K/REFC,1 ->(end) +# - <@> lineseq KP ->a # 1 <;> nextstate(main 666 optree_samples.t:70) v:>,<,% ->2 -# 4 <2> sassign vKS/2 ->5 +# 3 <1> padsv_store[$a:666,670] vKS/LVINTRO ->4 # 2 <0> shift s* ->3 -# 3 <0> padsv[$a:666,670] sRM*/LVINTRO ->4 -# 5 <;> nextstate(main 670 optree_samples.t:71) v:>,<,% ->6 +# - <0> ex-padsv sRM*/LVINTRO ->3 +# 4 <;> nextstate(main 670 optree_samples.t:71) v:>,<,% ->5 # - <1> null K/1 ->- -# 7 <|> cond_expr(other->8) K/1 ->c -# 6 <0> padsv[$a:666,670] s ->7 +# 6 <|> cond_expr(other->7) K/1 ->b +# 5 <0> padsv[$a:666,670] s ->6 # - <@> scope K ->- -# - <;> ex-nextstate(main 1603 optree_samples.t:70) v:>,<,% ->8 -# a <@> print sK ->b -# 8 <0> pushmark s ->9 -# 9 <$> const[PV "foo"] s ->a -# h <@> leave KP ->b -# c <0> enter ->d -# d <;> nextstate(main 668 optree_samples.t:72) v:>,<,% ->e -# g <@> print sK ->h -# e <0> pushmark s ->f -# f <$> const[PV "bar"] s ->g +# - <;> ex-nextstate(main 1510 optree_samples.t:66) v:>,<,% ->7 +# 9 <@> print sK ->a +# 7 <0> pushmark s ->8 +# 8 <$> const[PV "foo"] s ->9 +# g <@> leave KP ->a +# b <0> enter ->c +# c <;> nextstate(main 1510 optree_samples.t:66) v:>,<,% ->d +# f <@> print sK ->g +# d <0> pushmark s ->e +# e <$> const[PV "bar"] s ->f EOT_EOT -# b <1> leavesub[1 ref] K/REFC,1 ->(end) -# - <@> lineseq KP ->b -# 1 <;> nextstate(main 666 optree_samples.t:72) v:>,<,% ->2 -# 4 <2> sassign vKS/2 ->5 +# a <1> leavesub[1 ref] K/REFC,1 ->(end) +# - <@> lineseq KP ->a +# 1 <;> nextstate(main 666 optree_samples.t:70) v:>,<,% ->2 +# 3 <1> padsv_store[$a:666,670] vKS/LVINTRO ->4 # 2 <0> shift s* ->3 -# 3 <0> padsv[$a:666,670] sRM*/LVINTRO ->4 -# 5 <;> nextstate(main 670 optree_samples.t:73) v:>,<,% ->6 +# - <0> ex-padsv sRM*/LVINTRO ->3 +# 4 <;> nextstate(main 670 optree_samples.t:71) v:>,<,% ->5 # - <1> null K/1 ->- -# 7 <|> cond_expr(other->8) K/1 ->c -# 6 <0> padsv[$a:666,670] s ->7 +# 6 <|> cond_expr(other->7) K/1 ->b +# 5 <0> padsv[$a:666,670] s ->6 # - <@> scope K ->- -# - <;> ex-nextstate(main 1603 optree_samples.t:70) v:>,<,% ->8 -# a <@> print sK ->b -# 8 <0> pushmark s ->9 -# 9 <$> const(PV "foo") s ->a -# h <@> leave KP ->b -# c <0> enter ->d -# d <;> nextstate(main 668 optree_samples.t:74) v:>,<,% ->e -# g <@> print sK ->h -# e <0> pushmark s ->f -# f <$> const(PV "bar") s ->g +# - <;> ex-nextstate(main 1510 optree_samples.t:70) v:>,<,% ->7 +# 9 <@> print sK ->a +# 7 <0> pushmark s ->8 +# 8 <$> const(PV "foo") s ->9 +# g <@> leave KP ->a +# b <0> enter ->c +# c <;> nextstate(main 668 optree_samples.t:72) v:>,<,% ->d +# f <@> print sK ->g +# d <0> pushmark s ->e +# e <$> const(PV "bar") s ->f EONT_EONT checkOptree ( name => '-exec sub {if shift print then,else}', @@ -160,41 +160,39 @@ checkOptree ( name => '-exec (see above, with my $a = shift)', expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); # 1 <;> nextstate(main 675 optree_samples.t:165) v:>,<,% # 2 <0> shift s* -# 3 <0> padsv[$a:675,679] sRM*/LVINTRO -# 4 <2> sassign vKS/2 -# 5 <;> nextstate(main 679 optree_samples.t:166) v:>,<,% -# 6 <0> padsv[$a:675,679] s -# 7 <|> cond_expr(other->8) K/1 -# 8 <0> pushmark s -# 9 <$> const[PV "foo"] s -# a <@> print sK -# goto b -# c <0> enter -# d <;> nextstate(main 677 optree_samples.t:167) v:>,<,% -# e <0> pushmark s -# f <$> const[PV "bar"] s -# g <@> print sK -# h <@> leave KP -# b <1> leavesub[1 ref] K/REFC,1 +# 3 <1> padsv_store[$a:1522,1529] vKS/LVINTRO +# 4 <;> nextstate(main 679 optree_samples.t:166) v:>,<,% +# 5 <0> padsv[$a:675,679] s +# 6 <|> cond_expr(other->7) K/1 +# 7 <0> pushmark s +# 8 <$> const[PV "foo"] s +# 9 <@> print sK +# goto a +# b <0> enter +# c <;> nextstate(main 677 optree_samples.t:167) v:>,<,% +# d <0> pushmark s +# e <$> const[PV "bar"] s +# f <@> print sK +# g <@> leave KP +# a <1> leavesub[1 ref] K/REFC,1 EOT_EOT # 1 <;> nextstate(main 675 optree_samples.t:171) v:>,<,% # 2 <0> shift s* -# 3 <0> padsv[$a:675,679] sRM*/LVINTRO -# 4 <2> sassign vKS/2 -# 5 <;> nextstate(main 679 optree_samples.t:172) v:>,<,% -# 6 <0> padsv[$a:675,679] s -# 7 <|> cond_expr(other->8) K/1 -# 8 <0> pushmark s -# 9 <$> const(PV "foo") s -# a <@> print sK -# goto b -# c <0> enter -# d <;> nextstate(main 677 optree_samples.t:173) v:>,<,% -# e <0> pushmark s -# f <$> const(PV "bar") s -# g <@> print sK -# h <@> leave KP -# b <1> leavesub[1 ref] K/REFC,1 +# 3 <1> padsv_store[$a:1522,1529] vKS/LVINTRO +# 4 <;> nextstate(main 679 optree_samples.t:172) v:>,<,% +# 5 <0> padsv[$a:675,679] s +# 6 <|> cond_expr(other->7) K/1 +# 7 <0> pushmark s +# 8 <$> const(PV "foo") s +# 9 <@> print sK +# goto a +# b <0> enter +# c <;> nextstate(main 677 optree_samples.t:173) v:>,<,% +# d <0> pushmark s +# e <$> const(PV "bar") s +# f <@> print sK +# g <@> leave KP +# a <1> leavesub[1 ref] K/REFC,1 EONT_EONT checkOptree ( name => '-exec sub { print (shift) ? "foo" : "bar" }', diff --git a/gnu/usr.bin/perl/ext/B/t/optree_specials.t b/gnu/usr.bin/perl/ext/B/t/optree_specials.t index a6dc206a4b6..6207ab6dada 100755 --- a/gnu/usr.bin/perl/ext/B/t/optree_specials.t +++ b/gnu/usr.bin/perl/ext/B/t/optree_specials.t @@ -53,7 +53,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(Exporter::Heavy -1410 Heavy.pm:4) v:*,&,{,x*,x&,x$,$ ->4 # - <@> lineseq K ->- # 4 <;> nextstate(Exporter::Heavy -1410 Heavy.pm:4) :*,&,{,x*,x&,x$,$ ->5 -# 9 <1> entersub[t1] KRS*/TARG,STRICT ->a +# 9 <1> entersub[t1] KRS/TARG,STRICT ->a # 5 <0> pushmark s ->6 # 6 <$> const[PV "strict"] sM ->7 # 7 <$> const[PV "refs"] sM ->8 @@ -67,7 +67,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(Exporter::Heavy -1251 Heavy.pm:202) v:*,&,{,x*,x&,x$ ->e # - <@> lineseq K ->- # e <;> nextstate(Exporter::Heavy -1251 Heavy.pm:202) :*,&,{,x*,x&,x$ ->f -# j <1> entersub[t1] KRS*/TARG ->k +# j <1> entersub[t1] KRS/TARG ->k # f <0> pushmark s ->g # g <$> const[PV "warnings"] sM ->h # h <$> const[PV "once"] sM ->i @@ -92,7 +92,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(B::Concise -1134 Concise.pm:183) v:*,&,x*,x&,x$,$ ->v # - <@> lineseq K ->- # v <;> nextstate(B::Concise -1134 Concise.pm:183) :*,&,x*,x&,x$,$ ->w -# 10 <1> entersub[t1] KRS*/TARG,STRICT ->11 +# 10 <1> entersub[t1] KRS/TARG,STRICT ->11 # w <0> pushmark s ->x # x <$> const[PV "strict"] sM ->y # y <$> const[PV "refs"] sM ->z @@ -106,7 +106,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(B::Concise -1031 Concise.pm:305) v:*,&,x*,x&,x$,$ ->15 # - <@> lineseq K ->- # 15 <;> nextstate(B::Concise -1031 Concise.pm:305) :*,&,x*,x&,x$,$ ->16 -# 1a <1> entersub[t1] KRS*/TARG,STRICT ->1b +# 1a <1> entersub[t1] KRS/TARG,STRICT ->1b # 16 <0> pushmark s ->17 # 17 <$> const[PV "strict"] sM ->18 # 18 <$> const[PV "refs"] sM ->19 @@ -120,7 +120,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(B::Concise -984 Concise.pm:370) v:*,&,{,x*,x&,x$,$ ->1f # - <@> lineseq K ->- # 1f <;> nextstate(B::Concise -984 Concise.pm:370) :*,&,{,x*,x&,x$,$ ->1g -# 1k <1> entersub[t1] KRS*/TARG,STRICT ->1l +# 1k <1> entersub[t1] KRS/TARG,STRICT ->1l # 1g <0> pushmark s ->1h # 1h <$> const[PV "strict"] sM ->1i # 1i <$> const[PV "refs"] sM ->1j @@ -134,7 +134,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(B::Concise -959 Concise.pm:390) v:*,&,x*,x&,x$,$ ->1p # - <@> lineseq K ->- # 1p <;> nextstate(B::Concise -959 Concise.pm:390) :*,&,x*,x&,x$,$ ->1q -# 1u <1> entersub[t1] KRS*/TARG,STRICT ->1v +# 1u <1> entersub[t1] KRS/TARG,STRICT ->1v # 1q <0> pushmark s ->1r # 1r <$> const[PV "strict"] sM ->1s # 1s <$> const[PV "refs"] sM ->1t @@ -148,7 +148,7 @@ checkOptree ( name => 'BEGIN', # - <;> ex-nextstate(B::Concise -945 Concise.pm:410) v:*,&,{,x*,x&,x$,$ ->1z # - <@> lineseq K ->- # 1z <;> nextstate(B::Concise -945 Concise.pm:410) :*,&,{,x*,x&,x$,$ ->20 -# 24 <1> entersub[t1] KRS*/TARG,STRICT ->25 +# 24 <1> entersub[t1] KRS/TARG,STRICT ->25 # 20 <0> pushmark s ->21 # 21 <$> const[PV "warnings"] sM ->22 # 22 <$> const[PV "qw"] sM ->23 @@ -170,7 +170,7 @@ EOT_EOT # - <;> ex-nextstate(Exporter::Heavy -1410 Heavy.pm:4) v:*,&,{,x*,x&,x$,$ ->4 # - <@> lineseq K ->- # 4 <;> nextstate(Exporter::Heavy -1410 Heavy.pm:4) :*,&,{,x*,x&,x$,$ ->5 -# 9 <1> entersub[t1] KRS*/TARG,STRICT ->a +# 9 <1> entersub[t1] KRS/TARG,STRICT ->a # 5 <0> pushmark s ->6 # 6 <$> const(PV "strict") sM ->7 # 7 <$> const(PV "refs") sM ->8 @@ -184,7 +184,7 @@ EOT_EOT # - <;> ex-nextstate(Exporter::Heavy -1251 Heavy.pm:202) v:*,&,{,x*,x&,x$ ->e # - <@> lineseq K ->- # e <;> nextstate(Exporter::Heavy -1251 Heavy.pm:202) :*,&,{,x*,x&,x$ ->f -# j <1> entersub[t1] KRS*/TARG ->k +# j <1> entersub[t1] KRS/TARG ->k # f <0> pushmark s ->g # g <$> const(PV "warnings") sM ->h # h <$> const(PV "once") sM ->i @@ -209,7 +209,7 @@ EOT_EOT # - <;> ex-nextstate(B::Concise -1134 Concise.pm:183) v:*,&,x*,x&,x$,$ ->v # - <@> lineseq K ->- # v <;> nextstate(B::Concise -1134 Concise.pm:183) :*,&,x*,x&,x$,$ ->w -# 10 <1> entersub[t1] KRS*/TARG,STRICT ->11 +# 10 <1> entersub[t1] KRS/TARG,STRICT ->11 # w <0> pushmark s ->x # x <$> const(PV "strict") sM ->y # y <$> const(PV "refs") sM ->z @@ -223,7 +223,7 @@ EOT_EOT # - <;> ex-nextstate(B::Concise -1031 Concise.pm:305) v:*,&,x*,x&,x$,$ ->15 # - <@> lineseq K ->- # 15 <;> nextstate(B::Concise -1031 Concise.pm:305) :*,&,x*,x&,x$,$ ->16 -# 1a <1> entersub[t1] KRS*/TARG,STRICT ->1b +# 1a <1> entersub[t1] KRS/TARG,STRICT ->1b # 16 <0> pushmark s ->17 # 17 <$> const(PV "strict") sM ->18 # 18 <$> const(PV "refs") sM ->19 @@ -237,7 +237,7 @@ EOT_EOT # - <;> ex-nextstate(B::Concise -984 Concise.pm:370) v:*,&,{,x*,x&,x$,$ ->1f # - <@> lineseq K ->- # 1f <;> nextstate(B::Concise -984 Concise.pm:370) :*,&,{,x*,x&,x$,$ ->1g -# 1k <1> entersub[t1] KRS*/TARG,STRICT ->1l +# 1k <1> entersub[t1] KRS/TARG,STRICT ->1l # 1g <0> pushmark s ->1h # 1h <$> const(PV "strict") sM ->1i # 1i <$> const(PV "refs") sM ->1j @@ -251,7 +251,7 @@ EOT_EOT # - <;> ex-nextstate(B::Concise -959 Concise.pm:390) v:*,&,x*,x&,x$,$ ->1p # - <@> lineseq K ->- # 1p <;> nextstate(B::Concise -959 Concise.pm:390) :*,&,x*,x&,x$,$ ->1q -# 1u <1> entersub[t1] KRS*/TARG,STRICT ->1v +# 1u <1> entersub[t1] KRS/TARG,STRICT ->1v # 1q <0> pushmark s ->1r # 1r <$> const(PV "strict") sM ->1s # 1s <$> const(PV "refs") sM ->1t @@ -265,7 +265,7 @@ EOT_EOT # - <;> ex-nextstate(B::Concise -945 Concise.pm:410) v:*,&,{,x*,x&,x$,$ ->1z # - <@> lineseq K ->- # 1z <;> nextstate(B::Concise -945 Concise.pm:410) :*,&,{,x*,x&,x$,$ ->20 -# 24 <1> entersub[t1] KRS*/TARG,STRICT ->25 +# 24 <1> entersub[t1] KRS/TARG,STRICT ->25 # 20 <0> pushmark s ->21 # 21 <$> const(PV "warnings") sM ->22 # 22 <$> const(PV "qw") sM ->23 @@ -382,7 +382,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # 6 <$> const[PV "strict"] sM # 7 <$> const[PV "refs"] sM # 8 <.> method_named[PV "unimport"] -# 9 <1> entersub[t1] KRS*/TARG,STRICT +# 9 <1> entersub[t1] KRS/TARG,STRICT # a <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: # b <;> nextstate(Exporter::Heavy -1251 Heavy.pm:202) v:*,&,{,x*,x&,x$ @@ -393,7 +393,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # g <$> const[PV "warnings"] sM # h <$> const[PV "once"] sM # i <.> method_named[PV "unimport"] -# j <1> entersub[t1] KRS*/TARG +# j <1> entersub[t1] KRS/TARG # k <1> leavesub[1 ref] K/REFC,1 # BEGIN 3: # l <;> nextstate(B::Concise -1175 Concise.pm:117) v:*,&,{,x*,x&,x$,$ @@ -412,7 +412,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # x <$> const[PV "strict"] sM # y <$> const[PV "refs"] sM # z <.> method_named[PV "unimport"] -# 10 <1> entersub[t1] KRS*/TARG,STRICT +# 10 <1> entersub[t1] KRS/TARG,STRICT # 11 <1> leavesub[1 ref] K/REFC,1 # BEGIN 5: # 12 <;> nextstate(B::Concise -1031 Concise.pm:305) v:*,&,x*,x&,x$,$ @@ -423,7 +423,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # 17 <$> const[PV "strict"] sM # 18 <$> const[PV "refs"] sM # 19 <.> method_named[PV "unimport"] -# 1a <1> entersub[t1] KRS*/TARG,STRICT +# 1a <1> entersub[t1] KRS/TARG,STRICT # 1b <1> leavesub[1 ref] K/REFC,1 # BEGIN 6: # 1c <;> nextstate(B::Concise -984 Concise.pm:370) v:*,&,{,x*,x&,x$,$ @@ -434,7 +434,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # 1h <$> const[PV "strict"] sM # 1i <$> const[PV "refs"] sM # 1j <.> method_named[PV "unimport"] -# 1k <1> entersub[t1] KRS*/TARG,STRICT +# 1k <1> entersub[t1] KRS/TARG,STRICT # 1l <1> leavesub[1 ref] K/REFC,1 # BEGIN 7: # 1m <;> nextstate(B::Concise -959 Concise.pm:390) v:*,&,x*,x&,x$,$ @@ -445,7 +445,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # 1r <$> const[PV "strict"] sM # 1s <$> const[PV "refs"] sM # 1t <.> method_named[PV "unimport"] -# 1u <1> entersub[t1] KRS*/TARG,STRICT +# 1u <1> entersub[t1] KRS/TARG,STRICT # 1v <1> leavesub[1 ref] K/REFC,1 # BEGIN 8: # 1w <;> nextstate(B::Concise -945 Concise.pm:410) v:*,&,{,x*,x&,x$,$ @@ -456,7 +456,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', # 21 <$> const[PV "warnings"] sM # 22 <$> const[PV "qw"] sM # 23 <.> method_named[PV "unimport"] -# 24 <1> entersub[t1] KRS*/TARG,STRICT +# 24 <1> entersub[t1] KRS/TARG,STRICT # 25 <1> leavesub[1 ref] K/REFC,1 # BEGIN 9: # 26 <;> nextstate(main 3 -e:1) v:{ @@ -493,7 +493,7 @@ EOT_EOT # 6 <$> const(PV "strict") sM # 7 <$> const(PV "refs") sM # 8 <.> method_named(PV "unimport") -# 9 <1> entersub[t1] KRS*/TARG,STRICT +# 9 <1> entersub[t1] KRS/TARG,STRICT # a <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: # b <;> nextstate(Exporter::Heavy -1251 Heavy.pm:202) v:*,&,{,x*,x&,x$ @@ -504,7 +504,7 @@ EOT_EOT # g <$> const(PV "warnings") sM # h <$> const(PV "once") sM # i <.> method_named(PV "unimport") -# j <1> entersub[t1] KRS*/TARG +# j <1> entersub[t1] KRS/TARG # k <1> leavesub[1 ref] K/REFC,1 # BEGIN 3: # l <;> nextstate(B::Concise -1175 Concise.pm:117) v:*,&,{,x*,x&,x$,$ @@ -523,7 +523,7 @@ EOT_EOT # x <$> const(PV "strict") sM # y <$> const(PV "refs") sM # z <.> method_named(PV "unimport") -# 10 <1> entersub[t1] KRS*/TARG,STRICT +# 10 <1> entersub[t1] KRS/TARG,STRICT # 11 <1> leavesub[1 ref] K/REFC,1 # BEGIN 5: # 12 <;> nextstate(B::Concise -1031 Concise.pm:305) v:*,&,x*,x&,x$,$ @@ -534,7 +534,7 @@ EOT_EOT # 17 <$> const(PV "strict") sM # 18 <$> const(PV "refs") sM # 19 <.> method_named(PV "unimport") -# 1a <1> entersub[t1] KRS*/TARG,STRICT +# 1a <1> entersub[t1] KRS/TARG,STRICT # 1b <1> leavesub[1 ref] K/REFC,1 # BEGIN 6: # 1c <;> nextstate(B::Concise -984 Concise.pm:370) v:*,&,{,x*,x&,x$,$ @@ -545,7 +545,7 @@ EOT_EOT # 1h <$> const(PV "strict") sM # 1i <$> const(PV "refs") sM # 1j <.> method_named(PV "unimport") -# 1k <1> entersub[t1] KRS*/TARG,STRICT +# 1k <1> entersub[t1] KRS/TARG,STRICT # 1l <1> leavesub[1 ref] K/REFC,1 # BEGIN 7: # 1m <;> nextstate(B::Concise -959 Concise.pm:390) v:*,&,x*,x&,x$,$ @@ -556,7 +556,7 @@ EOT_EOT # 1r <$> const(PV "strict") sM # 1s <$> const(PV "refs") sM # 1t <.> method_named(PV "unimport") -# 1u <1> entersub[t1] KRS*/TARG,STRICT +# 1u <1> entersub[t1] KRS/TARG,STRICT # 1v <1> leavesub[1 ref] K/REFC,1 # BEGIN 8: # 1w <;> nextstate(B::Concise -945 Concise.pm:410) v:*,&,{,x*,x&,x$,$ @@ -567,7 +567,7 @@ EOT_EOT # 21 <$> const(PV "warnings") sM # 22 <$> const(PV "qw") sM # 23 <.> method_named(PV "unimport") -# 24 <1> entersub[t1] KRS*/TARG,STRICT +# 24 <1> entersub[t1] KRS/TARG,STRICT # 25 <1> leavesub[1 ref] K/REFC,1 # BEGIN 9: # 26 <;> nextstate(main 3 -e:1) v:{ @@ -611,7 +611,7 @@ checkOptree ( name => 'regression test for patch 25352', # 6 <$> const[PV "strict"] sM # 7 <$> const[PV "refs"] sM # 8 <.> method_named[PV "unimport"] -# 9 <1> entersub[t1] KRS*/TARG,STRICT +# 9 <1> entersub[t1] KRS/TARG,STRICT # a <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: # b <;> nextstate(Exporter::Heavy -1251 Heavy.pm:202) v:*,&,{,x*,x&,x$ @@ -622,7 +622,7 @@ checkOptree ( name => 'regression test for patch 25352', # g <$> const[PV "warnings"] sM # h <$> const[PV "once"] sM # i <.> method_named[PV "unimport"] -# j <1> entersub[t1] KRS*/TARG +# j <1> entersub[t1] KRS/TARG # k <1> leavesub[1 ref] K/REFC,1 # BEGIN 3: # l <;> nextstate(B::Concise -1175 Concise.pm:117) v:*,&,{,x*,x&,x$,$ @@ -641,7 +641,7 @@ checkOptree ( name => 'regression test for patch 25352', # x <$> const[PV "strict"] sM # y <$> const[PV "refs"] sM # z <.> method_named[PV "unimport"] -# 10 <1> entersub[t1] KRS*/TARG,STRICT +# 10 <1> entersub[t1] KRS/TARG,STRICT # 11 <1> leavesub[1 ref] K/REFC,1 # BEGIN 5: # 12 <;> nextstate(B::Concise -1031 Concise.pm:305) v:*,&,x*,x&,x$,$ @@ -652,7 +652,7 @@ checkOptree ( name => 'regression test for patch 25352', # 17 <$> const[PV "strict"] sM # 18 <$> const[PV "refs"] sM # 19 <.> method_named[PV "unimport"] -# 1a <1> entersub[t1] KRS*/TARG,STRICT +# 1a <1> entersub[t1] KRS/TARG,STRICT # 1b <1> leavesub[1 ref] K/REFC,1 # BEGIN 6: # 1c <;> nextstate(B::Concise -984 Concise.pm:370) v:*,&,{,x*,x&,x$,$ @@ -663,7 +663,7 @@ checkOptree ( name => 'regression test for patch 25352', # 1h <$> const[PV "strict"] sM # 1i <$> const[PV "refs"] sM # 1j <.> method_named[PV "unimport"] -# 1k <1> entersub[t1] KRS*/TARG,STRICT +# 1k <1> entersub[t1] KRS/TARG,STRICT # 1l <1> leavesub[1 ref] K/REFC,1 # BEGIN 7: # 1m <;> nextstate(B::Concise -959 Concise.pm:390) v:*,&,x*,x&,x$,$ @@ -674,7 +674,7 @@ checkOptree ( name => 'regression test for patch 25352', # 1r <$> const[PV "strict"] sM # 1s <$> const[PV "refs"] sM # 1t <.> method_named[PV "unimport"] -# 1u <1> entersub[t1] KRS*/TARG,STRICT +# 1u <1> entersub[t1] KRS/TARG,STRICT # 1v <1> leavesub[1 ref] K/REFC,1 # BEGIN 8: # 1w <;> nextstate(B::Concise -945 Concise.pm:410) v:*,&,{,x*,x&,x$,$ @@ -685,7 +685,7 @@ checkOptree ( name => 'regression test for patch 25352', # 21 <$> const[PV "warnings"] sM # 22 <$> const[PV "qw"] sM # 23 <.> method_named[PV "unimport"] -# 24 <1> entersub[t1] KRS*/TARG,STRICT +# 24 <1> entersub[t1] KRS/TARG,STRICT # 25 <1> leavesub[1 ref] K/REFC,1 EOT_EOT # BEGIN 1: @@ -697,7 +697,7 @@ EOT_EOT # 6 <$> const(PV "strict") sM # 7 <$> const(PV "refs") sM # 8 <.> method_named(PV "unimport") -# 9 <1> entersub[t1] KRS*/TARG,STRICT +# 9 <1> entersub[t1] KRS/TARG,STRICT # a <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: # b <;> nextstate(Exporter::Heavy -1251 Heavy.pm:202) v:*,&,{,x*,x&,x$ @@ -708,7 +708,7 @@ EOT_EOT # g <$> const(PV "warnings") sM # h <$> const(PV "once") sM # i <.> method_named(PV "unimport") -# j <1> entersub[t1] KRS*/TARG +# j <1> entersub[t1] KRS/TARG # k <1> leavesub[1 ref] K/REFC,1 # BEGIN 3: # l <;> nextstate(B::Concise -1175 Concise.pm:117) v:*,&,{,x*,x&,x$,$ @@ -727,7 +727,7 @@ EOT_EOT # x <$> const(PV "strict") sM # y <$> const(PV "refs") sM # z <.> method_named(PV "unimport") -# 10 <1> entersub[t1] KRS*/TARG,STRICT +# 10 <1> entersub[t1] KRS/TARG,STRICT # 11 <1> leavesub[1 ref] K/REFC,1 # BEGIN 5: # 12 <;> nextstate(B::Concise -1031 Concise.pm:305) v:*,&,x*,x&,x$,$ @@ -738,7 +738,7 @@ EOT_EOT # 17 <$> const(PV "strict") sM # 18 <$> const(PV "refs") sM # 19 <.> method_named(PV "unimport") -# 1a <1> entersub[t1] KRS*/TARG,STRICT +# 1a <1> entersub[t1] KRS/TARG,STRICT # 1b <1> leavesub[1 ref] K/REFC,1 # BEGIN 6: # 1c <;> nextstate(B::Concise -984 Concise.pm:370) v:*,&,{,x*,x&,x$,$ @@ -749,7 +749,7 @@ EOT_EOT # 1h <$> const(PV "strict") sM # 1i <$> const(PV "refs") sM # 1j <.> method_named(PV "unimport") -# 1k <1> entersub[t1] KRS*/TARG,STRICT +# 1k <1> entersub[t1] KRS/TARG,STRICT # 1l <1> leavesub[1 ref] K/REFC,1 # BEGIN 7: # 1m <;> nextstate(B::Concise -959 Concise.pm:390) v:*,&,x*,x&,x$,$ @@ -760,7 +760,7 @@ EOT_EOT # 1r <$> const(PV "strict") sM # 1s <$> const(PV "refs") sM # 1t <.> method_named(PV "unimport") -# 1u <1> entersub[t1] KRS*/TARG,STRICT +# 1u <1> entersub[t1] KRS/TARG,STRICT # 1v <1> leavesub[1 ref] K/REFC,1 # BEGIN 8: # 1w <;> nextstate(B::Concise -945 Concise.pm:410) v:*,&,{,x*,x&,x$,$ @@ -771,6 +771,6 @@ EOT_EOT # 21 <$> const(PV "warnings") sM # 22 <$> const(PV "qw") sM # 23 <.> method_named(PV "unimport") -# 24 <1> entersub[t1] KRS*/TARG,STRICT +# 24 <1> entersub[t1] KRS/TARG,STRICT # 25 <1> leavesub[1 ref] K/REFC,1 EONT_EONT diff --git a/gnu/usr.bin/perl/ext/B/t/optree_varinit.t b/gnu/usr.bin/perl/ext/B/t/optree_varinit.t index d89afc24f33..393160205e4 100755 --- a/gnu/usr.bin/perl/ext/B/t/optree_varinit.t +++ b/gnu/usr.bin/perl/ext/B/t/optree_varinit.t @@ -129,19 +129,19 @@ checkOptree ( name => 'sub {my $a=undef}', bcopts => '-basic', strip_open_hints => 1, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); -5 <1> leavesub[1 ref] K/REFC,1 ->(end) -- <@> lineseq KP ->5 -1 <;> nextstate(main 641 optree_varinit.t:130) v:>,<,% ->2 -4 <2> sassign sKS/2 ->5 -2 <0> undef s ->3 -3 <0> padsv[$a:641,642] sRM*/LVINTRO ->4 +3 <1> leavesub[1 ref] K/REFC,1 ->(end) +- <@> lineseq KP ->3 +1 <;> nextstate(main 1517 optree_varinit.t:128) v ->2 +- <1> ex-sassign sKS/2 ->- +2 <0> undef[$a:1517,1518] s/LVINTRO,KEEP_PV,TARGMY ->3 +- <0> ex-padsv sRM*/LVINTRO ->- EOT_EOT -# 5 <1> leavesub[1 ref] K/REFC,1 ->(end) -# - <@> lineseq KP ->5 -# 1 <;> nextstate(main 641 optree_varinit.t:130) v:>,<,% ->2 -# 4 <2> sassign sKS/2 ->5 -# 2 <0> undef s ->3 -# 3 <0> padsv[$a:641,642] sRM*/LVINTRO ->4 +# 3 <1> leavesub[1 ref] K/REFC,1 ->(end) +# - <@> lineseq KP ->3 +# 1 <;> nextstate(main 1517 optree_varinit.t:128) v ->2 +# - <1> ex-sassign sKS/2 ->- +# 2 <0> undef[$a:1517,1518] s/LVINTRO,KEEP_PV,TARGMY ->3 +# - <0> ex-padsv sRM*/LVINTRO ->- EONT_EONT checkOptree ( name => 'sub {our $a=undef}', @@ -152,7 +152,7 @@ checkOptree ( name => 'sub {our $a=undef}', expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); 5 <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->5 -1 <;> nextstate(main 26 optree.t:109) v:>,<,%,{ ->2 +1 <;> nextstate(main 1520 optree_varinit.t:148) v:{ ->2 4 <2> sassign sKS/2 ->5 2 <0> undef s ->3 - <1> ex-rv2sv sKRM*/OURINTR,1 ->4 @@ -160,7 +160,7 @@ checkOptree ( name => 'sub {our $a=undef}', EOT_EOT # 5 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->5 -# 1 <;> nextstate(main 446 optree_varinit.t:137) v:>,<,%,{ ->2 +# 1 <;> nextstate(main 1520 optree_varinit.t:148) v:{ ->2 # 4 <2> sassign sKS/2 ->5 # 2 <0> undef s ->3 # - <1> ex-rv2sv sKRM*/OURINTR,1 ->4 @@ -175,7 +175,7 @@ checkOptree ( name => 'sub {local $a=undef}', expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); 5 <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->5 -1 <;> nextstate(main 28 optree.t:122) v:>,<,%,{ ->2 +1 <;> nextstate(main 1523 optree_varinit.t:171) v:{ ->2 4 <2> sassign sKS/2 ->5 2 <0> undef s ->3 - <1> ex-rv2sv sKRM*/LVINTRO,1 ->4 @@ -183,7 +183,7 @@ checkOptree ( name => 'sub {local $a=undef}', EOT_EOT # 5 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->5 -# 1 <;> nextstate(main 58 optree.t:141) v:>,<,%,{ ->2 +# 1 <;> nextstate(main 1523 optree_varinit.t:171) v:{ ->2 # 4 <2> sassign sKS/2 ->5 # 2 <0> undef s ->3 # - <1> ex-rv2sv sKRM*/LVINTRO,1 ->4 @@ -195,19 +195,19 @@ checkOptree ( name => 'my $a=undef', bcopts => '-basic', strip_open_hints => 1, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); -6 <@> leave[1 ref] vKP/REFC ->(end) +4 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter v ->2 -2 <;> nextstate(main 1 -e:1) v:>,<,%,{ ->3 -5 <2> sassign vKS/2 ->6 -3 <0> undef s ->4 -4 <0> padsv[$a:1,2] sRM*/LVINTRO ->5 +2 <;> nextstate(main 1 -e:1) v:{ ->3 +- <1> ex-sassign vKS/2 ->4 +3 <0> undef[$a:1,2] s/LVINTRO,KEEP_PV,TARGMY ->4 +- <0> ex-padsv sRM*/LVINTRO ->- EOT_EOT -# 6 <@> leave[1 ref] vKP/REFC ->(end) +# 4 <@> leave[1 ref] vKP/REFC ->(end) # 1 <0> enter v ->2 -# 2 <;> nextstate(main 1 -e:1) v:>,<,%,{ ->3 -# 5 <2> sassign vKS/2 ->6 -# 3 <0> undef s ->4 -# 4 <0> padsv[$a:1,2] sRM*/LVINTRO ->5 +# 2 <;> nextstate(main 1 -e:1) v:{ ->3 +# - <1> ex-sassign vKS/2 ->4 +# 3 <0> undef[$a:1,2] s/LVINTRO,KEEP_PV,TARGMY ->4 +# - <0> ex-padsv sRM*/LVINTRO ->- EONT_EONT checkOptree ( name => 'our $a=undef', @@ -218,7 +218,7 @@ checkOptree ( name => 'our $a=undef', expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); 6 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter v ->2 -2 <;> nextstate(main 1 -e:1) v:>,<,%,{ ->3 +2 <;> nextstate(main 1 -e:1) v:{ ->3 5 <2> sassign vKS/2 ->6 3 <0> undef s ->4 - <1> ex-rv2sv sKRM*/OURINTR,1 ->5 @@ -226,7 +226,7 @@ checkOptree ( name => 'our $a=undef', EOT_EOT # 6 <@> leave[1 ref] vKP/REFC ->(end) # 1 <0> enter v ->2 -# 2 <;> nextstate(main 1 -e:1) v:>,<,%,{ ->3 +# 2 <;> nextstate(main 1 -e:1) v:{ ->3 # 5 <2> sassign vKS/2 ->6 # 3 <0> undef s ->4 # - <1> ex-rv2sv sKRM*/OURINTR,1 ->5 @@ -242,7 +242,7 @@ checkOptree ( name => 'local $c=undef', expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); 6 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter v ->2 -2 <;> nextstate(main 1 -e:1) v:>,<,%,{ ->3 +2 <;> nextstate(main 1 -e:1) v:{ ->3 5 <2> sassign vKS/2 ->6 3 <0> undef s ->4 - <1> ex-rv2sv sKRM*/LVINTRO,1 ->5 @@ -250,7 +250,7 @@ checkOptree ( name => 'local $c=undef', EOT_EOT # 6 <@> leave[1 ref] vKP/REFC ->(end) # 1 <0> enter v ->2 -# 2 <;> nextstate(main 1 -e:1) v:>,<,%,{ ->3 +# 2 <;> nextstate(main 1 -e:1) v:{ ->3 # 5 <2> sassign vKS/2 ->6 # 3 <0> undef s ->4 # - <1> ex-rv2sv sKRM*/LVINTRO,1 ->5 @@ -264,15 +264,13 @@ checkOptree ( name => 'sub {my $a=()}', expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); 1 <;> nextstate(main -439 optree.t:105) v:>,<,% 2 <0> stub sP -3 <0> padsv[$a:-439,-438] sRM*/LVINTRO -4 <2> sassign sKS/2 -5 <1> leavesub[1 ref] K/REFC,1 +3 <1> padsv_store[$a:1516,1517] sKS/LVINTRO +4 <1> leavesub[1 ref] K/REFC,1 EOT_EOT # 1 <;> nextstate(main 438 optree_varinit.t:247) v:>,<,% # 2 <0> stub sP -# 3 <0> padsv[$a:438,439] sRM*/LVINTRO -# 4 <2> sassign sKS/2 -# 5 <1> leavesub[1 ref] K/REFC,1 +# 3 <1> padsv_store[$a:1516,1517] sKS/LVINTRO +# 4 <1> leavesub[1 ref] K/REFC,1 EONT_EONT checkOptree ( name => 'sub {our $a=()}', @@ -321,16 +319,14 @@ checkOptree ( name => 'my $a=()', 1 <0> enter v 2 <;> nextstate(main 1 -e:1) v:>,<,%,{ 3 <0> stub sP -4 <0> padsv[$a:1,2] sRM*/LVINTRO -5 <2> sassign vKS/2 -6 <@> leave[1 ref] vKP/REFC +4 <1> padsv_store[$a:1516,1517] vKS/LVINTRO +5 <@> leave[1 ref] vKP/REFC EOT_EOT # 1 <0> enter v # 2 <;> nextstate(main 1 -e:1) v:>,<,%,{ # 3 <0> stub sP -# 4 <0> padsv[$a:1,2] sRM*/LVINTRO -# 5 <2> sassign vKS/2 -# 6 <@> leave[1 ref] vKP/REFC +# 4 <1> padsv_store[$a:1516,1517] vKS/LVINTRO +# 5 <@> leave[1 ref] vKP/REFC EONT_EONT checkOptree ( name => 'our $a=()', diff --git a/gnu/usr.bin/perl/ext/Devel-Peek/Peek.pm b/gnu/usr.bin/perl/ext/Devel-Peek/Peek.pm index 68e6768ebf0..f539650efb8 100644 --- a/gnu/usr.bin/perl/ext/Devel-Peek/Peek.pm +++ b/gnu/usr.bin/perl/ext/Devel-Peek/Peek.pm @@ -3,7 +3,7 @@ package Devel::Peek; -$VERSION = '1.32'; +$VERSION = '1.33'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/gnu/usr.bin/perl/ext/Devel-Peek/t/Peek.t b/gnu/usr.bin/perl/ext/Devel-Peek/t/Peek.t index 6ad108754f9..d6267e158b2 100755 --- a/gnu/usr.bin/perl/ext/Devel-Peek/t/Peek.t +++ b/gnu/usr.bin/perl/ext/Devel-Peek/t/Peek.t @@ -392,7 +392,6 @@ do_test('reference to named subroutine without prototype', \\d+\\. $ADDR<\\d+> \\(\\d+,\\d+\\) "\\$dump2" OUTSIDE = $ADDR \\(MAIN\\)'); -if ($] >= 5.011) { # note the conditionals on ENGINE and INTFLAGS were introduced in 5.19.9 do_test('reference to regexp', qr(tic), @@ -406,14 +405,16 @@ do_test('reference to regexp', PV = $ADDR "\\(\\?\\^:tic\\)" CUR = 8 LEN = 0 - STASH = $ADDR\\t"Regexp"' -. ($] < 5.013 ? '' : -' - COMPFLAGS = 0x0 \(\) - EXTFLAGS = 0x680000 \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\) -(?: ENGINE = $ADDR \(STANDARD\) -)? INTFLAGS = 0x0(?: \(\))? + STASH = $ADDR\\s+"Regexp" + COMPFLAGS = 0x0 \\(\\) + EXTFLAGS = 0x680000 \\(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\\) + ENGINE = $ADDR \\(STANDARD\\) + INTFLAGS = 0x0 \\(\\) NPARENS = 0 + LOGICAL_NPARENS = 0 + LOGICAL_TO_PARNO = 0x0 + PARNO_TO_LOGICAL = 0x0 + PARNO_TO_LOGICAL_NEXT = 0x0 LASTPAREN = 0 LASTCLOSEPAREN = 0 MINLEN = 3 @@ -424,20 +425,29 @@ do_test('reference to regexp', SUBOFFSET = 0 SUBCOFFSET = 0 SUBBEG = 0x0 -(?: ENGINE = $ADDR -)? MOTHER_RE = $ADDR' -. ($] < 5.019003 ? '' : ' - SV = REGEXP\($ADDR\) at $ADDR + PAREN_NAMES = 0x0 + SUBSTRS = $ADDR + PPRIVATE = $ADDR + OFFS = $ADDR + \\[ 0:0 \\] + QR_ANONCV = 0x0 + SAVED_COPY = 0x0 + MOTHER_RE = $ADDR + SV = REGEXP\\($ADDR\\) at $ADDR REFCNT = 2 - FLAGS = \(POK,pPOK\) - PV = $ADDR "\(\?\^:tic\)" + FLAGS = \\(POK,pPOK\\) + PV = $ADDR "\\(\\?\\^:tic\\)" CUR = 8 - LEN = \d+ - COMPFLAGS = 0x0 \(\) - EXTFLAGS = 0x680000 \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\) -(?: ENGINE = $ADDR \(STANDARD\) -)? INTFLAGS = 0x0(?: \(\))? + LEN = \\d+ + COMPFLAGS = 0x0 \\(\\) + EXTFLAGS = 0x680000 \\(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\\) + ENGINE = $ADDR \\(STANDARD\\) + INTFLAGS = 0x0 \\(\\) NPARENS = 0 + LOGICAL_NPARENS = 0 + LOGICAL_TO_PARNO = 0x0 + PARNO_TO_LOGICAL = 0x0 + PARNO_TO_LOGICAL_NEXT = 0x0 LASTPAREN = 0 LASTCLOSEPAREN = 0 MINLEN = 3 @@ -448,42 +458,15 @@ do_test('reference to regexp', SUBOFFSET = 0 SUBCOFFSET = 0 SUBBEG = 0x0 -(?: ENGINE = $ADDR -)? MOTHER_RE = 0x0 PAREN_NAMES = 0x0 SUBSTRS = $ADDR PPRIVATE = $ADDR OFFS = $ADDR - QR_ANONCV = 0x0(?: - SAVED_COPY = 0x0)?') . ' - PAREN_NAMES = 0x0 - SUBSTRS = $ADDR - PPRIVATE = $ADDR - OFFS = $ADDR - QR_ANONCV = 0x0(?: - SAVED_COPY = 0x0)?' -)); -} else { -do_test('reference to regexp', - qr(tic), -'SV = $RV\\($ADDR\\) at $ADDR - REFCNT = 1 - FLAGS = \\(ROK\\) - RV = $ADDR - SV = PVMG\\($ADDR\\) at $ADDR - REFCNT = 1 - FLAGS = \\(OBJECT,SMG\\) - IV = 0 - NV = 0 - PV = 0 - MAGIC = $ADDR - MG_VIRTUAL = $ADDR - MG_TYPE = PERL_MAGIC_qr\(r\) - MG_OBJ = $ADDR - PAT = "\(\?^:tic\)" - REFCNT = 2 - STASH = $ADDR\\t"Regexp"'); -} + \\[ 0:0 \\] + QR_ANONCV = 0x0 + SAVED_COPY = 0x0 + MOTHER_RE = 0x0 +'); do_test('reference to blessed hash', (bless {}, "Tac"), @@ -1200,22 +1183,26 @@ unless ($Config{useithreads}) { # note the conditionals on ENGINE and INTFLAGS were introduced in 5.19.9 do_test('UTF-8 in a regular expression', qr/\x{100}/, -'SV = IV\($ADDR\) at $ADDR +'SV = IV\\($ADDR\\) at $ADDR REFCNT = 1 - FLAGS = \(ROK\) + FLAGS = \\(ROK\\) RV = $ADDR - SV = REGEXP\($ADDR\) at $ADDR + SV = REGEXP\\($ADDR\\) at $ADDR REFCNT = 1 FLAGS = \(OBJECT,POK,FAKE,pPOK,UTF8\) - PV = $ADDR "\(\?\^u:\\\\\\\\x\{100\}\)" \[UTF8 "\(\?\^u:\\\\\\\\x\{100\}\)"\] + PV = $ADDR "\\(\\?\\^u:\\\\\\\\x\\{100\\}\\)" \\[UTF8 "\\(\\?\\^u:\\\\\\\\x\\{100\\}\\)"\\] CUR = 13 LEN = 0 - STASH = $ADDR "Regexp" - COMPFLAGS = 0x0 \(\) - EXTFLAGS = $ADDR \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\) -(?: ENGINE = $ADDR \(STANDARD\) -)? INTFLAGS = 0x0(?: \(\))? + STASH = $ADDR\\s+"Regexp" + COMPFLAGS = 0x0 \\(\\) + EXTFLAGS = $ADDR \\(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\\) +(?: ENGINE = $ADDR \\(STANDARD\\) +)? INTFLAGS = 0x0(?: \\(\\))? NPARENS = 0 + LOGICAL_NPARENS = 0 + LOGICAL_TO_PARNO = 0x0 + PARNO_TO_LOGICAL = 0x0 + PARNO_TO_LOGICAL_NEXT = 0x0 LASTPAREN = 0 LASTCLOSEPAREN = 0 MINLEN = 1 @@ -1226,20 +1213,29 @@ do_test('UTF-8 in a regular expression', SUBOFFSET = 0 SUBCOFFSET = 0 SUBBEG = 0x0 -(?: ENGINE = $ADDR -)? MOTHER_RE = $ADDR' -. ($] < 5.019003 ? '' : ' - SV = REGEXP\($ADDR\) at $ADDR + PAREN_NAMES = 0x0 + SUBSTRS = $ADDR + PPRIVATE = $ADDR + OFFS = $ADDR + \\[ 0:0 \\] + QR_ANONCV = 0x0 + SAVED_COPY = 0x0 + MOTHER_RE = $ADDR + SV = REGEXP\\($ADDR\\) at $ADDR REFCNT = 2 - FLAGS = \(POK,pPOK,UTF8\) - PV = $ADDR "\(\?\^u:\\\\\\\\x\{100\}\)" \[UTF8 "\(\?\^u:\\\\\\\\x\{100\}\)"\] + FLAGS = \\(POK,pPOK,UTF8\\) + PV = $ADDR "\\(\\?\\^u:\\\\\\\\x\\{100\\}\\)" \\[UTF8 "\\(\\?\\^u:\\\\\\\\x\\{100\\}\\)"\\] CUR = 13 - LEN = \d+ - COMPFLAGS = 0x0 \(\) - EXTFLAGS = $ADDR \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\) -(?: ENGINE = $ADDR \(STANDARD\) -)? INTFLAGS = 0x0(?: \(\))? + LEN = \\d+ + COMPFLAGS = 0x0 \\(\\) + EXTFLAGS = 0x680100 \\(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\\) + ENGINE = $ADDR \\(STANDARD\\) + INTFLAGS = 0x0 \\(\\) NPARENS = 0 + LOGICAL_NPARENS = 0 + LOGICAL_TO_PARNO = 0x0 + PARNO_TO_LOGICAL = 0x0 + PARNO_TO_LOGICAL_NEXT = 0x0 LASTPAREN = 0 LASTCLOSEPAREN = 0 MINLEN = 1 @@ -1250,22 +1246,98 @@ do_test('UTF-8 in a regular expression', SUBOFFSET = 0 SUBCOFFSET = 0 SUBBEG = 0x0 -(?: ENGINE = $ADDR -)? MOTHER_RE = 0x0 PAREN_NAMES = 0x0 SUBSTRS = $ADDR PPRIVATE = $ADDR OFFS = $ADDR - QR_ANONCV = 0x0(?: - SAVED_COPY = 0x0)?') . ' + \\[ 0:0 \\] + QR_ANONCV = 0x0 + SAVED_COPY = 0x0 + MOTHER_RE = 0x0 +'); + +do_test('Branch Reset regexp', + qr/(?|(foo)|(bar))(?|(baz)|(bop))/, +'SV = IV\\($ADDR\\) at $ADDR + REFCNT = 1 + FLAGS = \\(ROK\\) + RV = $ADDR + SV = REGEXP\\($ADDR\\) at $ADDR + REFCNT = 1 + FLAGS = \\(OBJECT,POK,FAKE,pPOK\\) + PV = $ADDR "\\(\\?\\^:\\(\\?\\|\\(foo\\)\\|\\(bar\\)\\)\\(\\?\\|\\(baz\\)\\|\\(bop\\)\\)\\)" + CUR = 35 + LEN = 0 + STASH = $ADDR\\s+"Regexp" + COMPFLAGS = 0x0 \\(\\) + EXTFLAGS = 0x0 \\(\\) + ENGINE = $ADDR \\(STANDARD\\) + INTFLAGS = 0x0 \\(\\) + NPARENS = 4 + LOGICAL_NPARENS = 2 + LOGICAL_TO_PARNO = $ADDR + \\{ 0, 1, 3 \\} + PARNO_TO_LOGICAL = $ADDR + \\{ 0, 1, 1, 2, 2 \\} + PARNO_TO_LOGICAL_NEXT = $ADDR + \\{ 0, 2, 0, 4, 0 \\} + LASTPAREN = 0 + LASTCLOSEPAREN = 0 + MINLEN = 6 + MINLENRET = 6 + GOFS = 0 + PRE_PREFIX = 4 + SUBLEN = 0 + SUBOFFSET = 0 + SUBCOFFSET = 0 + SUBBEG = 0x0 PAREN_NAMES = 0x0 SUBSTRS = $ADDR PPRIVATE = $ADDR OFFS = $ADDR - QR_ANONCV = 0x0(?: - SAVED_COPY = 0x0)? + \\[ 0:0, 0:0, 0:0, 0:0, 0:0 \\] + QR_ANONCV = 0x0 + SAVED_COPY = 0x0 + MOTHER_RE = $ADDR + SV = REGEXP\\($ADDR\\) at $ADDR + REFCNT = 2 + FLAGS = \\(POK,pPOK\\) + PV = $ADDR "\\(\\?\\^:\\(\\?\\|\\(foo\\)\\|\\(bar\\)\\)\\(\\?\\|\\(baz\\)\\|\\(bop\\)\\)\\)" + CUR = 35 + LEN = \\d+ + COMPFLAGS = 0x0 \\(\\) + EXTFLAGS = 0x0 \\(\\) + ENGINE = $ADDR \\(STANDARD\\) + INTFLAGS = 0x0 \\(\\) + NPARENS = 4 + LOGICAL_NPARENS = 2 + LOGICAL_TO_PARNO = $ADDR + \\{ 0, 1, 3 \\} + PARNO_TO_LOGICAL = $ADDR + \\{ 0, 1, 1, 2, 2 \\} + PARNO_TO_LOGICAL_NEXT = $ADDR + \\{ 0, 2, 0, 4, 0 \\} + LASTPAREN = 0 + LASTCLOSEPAREN = 0 + MINLEN = 6 + MINLENRET = 6 + GOFS = 0 + PRE_PREFIX = 4 + SUBLEN = 0 + SUBOFFSET = 0 + SUBCOFFSET = 0 + SUBBEG = 0x0 + PAREN_NAMES = 0x0 + SUBSTRS = $ADDR + PPRIVATE = $ADDR + OFFS = $ADDR + \\[ 0:0, 0:0, 0:0, 0:0, 0:0 \\] + QR_ANONCV = 0x0 + SAVED_COPY = 0x0 + MOTHER_RE = 0x0 '); + { # perl #117793: Extend SvREFCNT* to work on any perl variable type my %hash; my $base_count = Devel::Peek::SvREFCNT(%hash); @@ -1516,6 +1588,7 @@ dumpindent is 4 at -e line 1. | FLAGS = (VOID,SLABBED,MORESIB) | LINE = 1 | PACKAGE = "t" + | HINTS = 00000100 | | 5 +--entersub UNOP(0xNNN) ===> 1 [leave 0xNNN] TARG = 1 diff --git a/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL b/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL index 93a858a0b34..f428472c7c4 100644 --- a/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL +++ b/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL @@ -90,7 +90,7 @@ package DynaLoader; # Tim.Bunce@ig.co.uk, August 1994 BEGIN { - our $VERSION = '1.52'; + our $VERSION = '1.54'; } # Note: in almost any other piece of code "our" would have been a better diff --git a/gnu/usr.bin/perl/ext/DynaLoader/dl_dyld.xs b/gnu/usr.bin/perl/ext/DynaLoader/dl_dyld.xs index 38a38400d45..716c6ea421d 100644 --- a/gnu/usr.bin/perl/ext/DynaLoader/dl_dyld.xs +++ b/gnu/usr.bin/perl/ext/DynaLoader/dl_dyld.xs @@ -104,7 +104,7 @@ static void TranslateError sv_setpv(MY_CXT.x_dl_last_error, error); } -static char *dlopen(char *path, int mode /* mode is ignored */) +static char *dlopen(char *path) { int dyld_result; NSObjectFileImage ofile; @@ -159,13 +159,11 @@ void * dl_load_file(filename, flags=0) char * filename int flags - PREINIT: - int mode = 1; CODE: DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dl_load_file(%s,%x):\n", filename,flags)); if (flags & 0x01) Perl_warn(aTHX_ "Can't make loaded symbols global on this platform while loading %s",filename); - RETVAL = dlopen(filename, mode) ; + RETVAL = dlopen(filename); DLDEBUG(2,PerlIO_printf(Perl_debug_log, " libref=%x\n", RETVAL)); ST(0) = sv_newmortal() ; if (RETVAL == NULL) diff --git a/gnu/usr.bin/perl/ext/DynaLoader/dl_win32.xs b/gnu/usr.bin/perl/ext/DynaLoader/dl_win32.xs index b076f2141cb..32249c9d2ab 100644 --- a/gnu/usr.bin/perl/ext/DynaLoader/dl_win32.xs +++ b/gnu/usr.bin/perl/ext/DynaLoader/dl_win32.xs @@ -188,7 +188,7 @@ void dl_install_xsub(perl_name, symref, filename="$Package") char * perl_name void * symref - char * filename + const char * filename CODE: DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_install_xsub(name=%s, symref=%x)\n", perl_name, symref)); diff --git a/gnu/usr.bin/perl/ext/Errno/Errno_pm.PL b/gnu/usr.bin/perl/ext/Errno/Errno_pm.PL index ee2f4a3a928..ae647d5f06c 100644 --- a/gnu/usr.bin/perl/ext/Errno/Errno_pm.PL +++ b/gnu/usr.bin/perl/ext/Errno/Errno_pm.PL @@ -2,7 +2,7 @@ use ExtUtils::MakeMaker; use Config; use strict; -our $VERSION = "1.36"; +our $VERSION = "1.37"; my %err = (); @@ -18,18 +18,11 @@ if ($Config{gccversion} ne '' && $^O eq 'MSWin32') { # MinGW complains "warning: #pragma system_header ignored outside include # file" if the header files are processed individually, so include them # all in .c file and process that instead. - my %seen; open INCS, '>', 'includes.c' or die "Cannot open includes.c"; foreach $file (@files) { next if $file eq 'errno.c'; next unless -f $file; - if ( $file eq 'avx512vpopcntdqvlintrin.h' || $file eq 'avx512bwintrin.h' ) { - # "Never use <avx512bwintrin.h> directly; include <immintrin.h> instead." - # "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead." - $file = 'immintrin.h'; - } - next if ++$seen{$file} > 1; print INCS qq[#include "$file"\n]; } close INCS; @@ -114,7 +107,7 @@ sub default_cpp { } sub get_files { - my %file = (); + my @file; # When cross-compiling we may store a path for gcc's "sysroot" option: my $sysroot = $Config{sysroot} || ''; my $linux_errno_h; @@ -128,19 +121,19 @@ sub get_files { # VMS keeps its include files in system libraries if ($^O eq 'VMS') { - $file{'Sys$Library:DECC$RTLDEF.TLB'} = 1; + push(@file, 'Sys$Library:DECC$RTLDEF.TLB'); } elsif ($^O eq 'os390') { # OS/390 C compiler doesn't generate #file or #line directives # and it does not tag the header as 1047 (EBCDIC), so make a local # copy and tag it my $cp = `cp /usr/include/errno.h ./errno.h`; my $chtag = `chtag -t -cIBM-1047 ./errno.h`; - $file{'./errno.h'} = 1; + push(@file, './errno.h'); } elsif ($Config{archname} eq 'arm-riscos') { # Watch out for cross compiling for RISC OS my $dep = `echo "#include <errno.h>" | gcc -E -M -`; if ($dep =~ /(\S+errno\.h)/) { - $file{$1} = 1; + push(@file, $1); } } elsif ($^O eq 'linux' && $Config{gccversion} ne '' && @@ -148,14 +141,14 @@ sub get_files { # might be using, say, Intel's icc $linux_errno_h ) { - $file{$linux_errno_h} = 1; + push(@file, $linux_errno_h); } elsif ($^O eq 'haiku') { # hidden in a special place - $file{'/boot/system/develop/headers/posix/errno.h'} = 1; + push(@file, '/boot/system/develop/headers/posix/errno.h'); } elsif ($^O eq 'vos') { # avoid problem where cpp returns non-POSIX pathnames - $file{'/system/include_library/errno.h'} = 1; + push(@file, '/system/include_library/errno.h'); } else { open(CPPI, '>', 'errno.c') or die "Cannot open errno.c"; @@ -183,16 +176,28 @@ sub get_files { if (/$pat/o) { my $f = $1; $f =~ s,\\\\,/,g; - $file{$f} = 1; + push(@file, $f); } } else { - $file{$1} = 1 if /$pat/o; + push(@file, $1) if /$pat/o; } } close(CPPO); } - return keys %file; + return uniq(@file); +} + +# +# +sub uniq +{ + # At this point List::Util::uniq appears not to be usable so + # roll our own. + # + # Returns a list with unique values, while keeping the order + # + return do { my %seen; grep { !$seen{$_}++ } @_ }; } sub write_errno_pm { @@ -364,7 +369,7 @@ ESQ if ($IsMSWin32) { print " WINSOCK => [qw(\n"; - $k = join(" ", grep { /^WSAE/ } keys %err); + $k = join(" ", grep { /^WSAE/ } sort keys %err); $k =~ s/(.{50,70})\s/$1\n\t/g; print "\t",$k,"\n )],\n"; } diff --git a/gnu/usr.bin/perl/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm b/gnu/usr.bin/perl/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm index e90b4aeb092..18627f8a5e8 100644 --- a/gnu/usr.bin/perl/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm +++ b/gnu/usr.bin/perl/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm @@ -5,7 +5,7 @@ use Exporter 'import'; use ExtUtils::Embed 1.31, qw(xsi_header xsi_protos xsi_body); our @EXPORT = qw(writemain); -our $VERSION = '1.11'; +our $VERSION = '1.13'; # blead will run this with miniperl, hence we can't use autodie or File::Temp my $temp; @@ -99,9 +99,6 @@ main(int argc, char **argv, char **env) #ifndef NO_ENV_ARRAY_IN_MAIN PERL_UNUSED_ARG(env); #endif -#ifndef PERL_USE_SAFE_PUTENV - PL_use_safe_putenv = FALSE; -#endif /* PERL_USE_SAFE_PUTENV */ /* if user wants control of gprof profiling off by default */ /* noop unless Configure is given -Accflags=-DPERL_GPROF_CONTROL */ @@ -138,8 +135,29 @@ main(int argc, char **argv, char **env) PL_perl_destruct_level = 0; } PL_exit_flags |= PERL_EXIT_DESTRUCT_END; - if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) + if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) { + + /* perl_parse() may end up starting its own run loops, which + * might end up "leaking" PL_restartop from the parse phase into + * the run phase which then ends up confusing run_body(). This + * leakage shouldn't happen and if it does its a bug. + * + * Note we do not do this assert in perl_run() or perl_parse() + * as there are modules out there which explicitly set + * PL_restartop before calling perl_run() directly from XS code + * (Coro), and it is conceivable PL_restartop could be set prior + * to calling perl_parse() by XS code as well. + * + * What we want to check is that the top level perl_parse(), + * perl_run() pairing does not allow a leaking PL_restartop, as + * that indicates a bug in perl. By putting the assert here we + * can validate that Perl itself is operating correctly without + * risking breakage to XS code under DEBUGGING. - Yves + */ + assert(!PL_restartop); + perl_run(my_perl); + } #ifndef PERL_MICRO /* Unregister our signal handler before destroying my_perl */ @@ -154,19 +172,6 @@ main(int argc, char **argv, char **env) perl_free(my_perl); -#if defined(USE_ENVIRON_ARRAY) && defined(PERL_TRACK_MEMPOOL) && !defined(NO_ENV_ARRAY_IN_MAIN) - /* - * The old environment may have been freed by perl_free() - * when PERL_TRACK_MEMPOOL is defined, but without having - * been restored by perl_destruct() before (this is only - * done if destruct_level > 0). - * - * It is important to have a valid environment for atexit() - * routines that are eventually called. - */ - environ = env; -#endif - PERL_SYS_TERM(); exit(exitstatus); diff --git a/gnu/usr.bin/perl/ext/File-Find/lib/File/Find.pm b/gnu/usr.bin/perl/ext/File-Find/lib/File/Find.pm index ae58d00b71e..a41a6f5a566 100644 --- a/gnu/usr.bin/perl/ext/File-Find/lib/File/Find.pm +++ b/gnu/usr.bin/perl/ext/File-Find/lib/File/Find.pm @@ -3,7 +3,7 @@ use 5.006; use strict; use warnings; use warnings::register; -our $VERSION = '1.40'; +our $VERSION = '1.43'; use Exporter 'import'; require Cwd; @@ -43,25 +43,35 @@ sub contract_name { return $abs_name; } +sub _is_absolute { + return $_[0] =~ m|^(?:[A-Za-z]:)?/| if $Is_Win32; + return substr($_[0], 0, 1) eq '/'; +} + +sub _is_root { + return $_[0] =~ m|^(?:[A-Za-z]:)?/\z| if $Is_Win32; + return $_[0] eq '/'; +} + sub PathCombine($$) { my ($Base,$Name) = @_; my $AbsName; - if (substr($Name,0,1) eq '/') { - $AbsName= $Name; + if (_is_absolute($Name)) { + $AbsName= $Name; } else { - $AbsName= contract_name($Base,$Name); + $AbsName= contract_name($Base,$Name); } # (simple) check for recursion my $newlen= length($AbsName); if ($newlen <= length($Base)) { - if (($newlen == length($Base) || substr($Base,$newlen,1) eq '/') - && $AbsName eq substr($Base,0,$newlen)) - { - return undef; - } + if (($newlen == length($Base) || substr($Base,$newlen,1) eq '/') + && $AbsName eq substr($Base,0,$newlen)) + { + return undef; + } } return $AbsName; } @@ -73,37 +83,40 @@ sub Follow_SymLink($) { ($DEV, $INO)= lstat $AbsName; while (-l _) { - if ($SLnkSeen{$DEV, $INO}++) { - if ($follow_skip < 2) { - die "$AbsName is encountered a second time"; - } - else { - return undef; - } - } - $NewName= PathCombine($AbsName, readlink($AbsName)); - unless(defined $NewName) { - if ($follow_skip < 2) { - die "$AbsName is a recursive symbolic link"; - } - else { - return undef; - } - } - else { - $AbsName= $NewName; - } - ($DEV, $INO) = lstat($AbsName); - return undef unless defined $DEV; # dangling symbolic link + if ($SLnkSeen{$DEV, $INO}++) { + if ($follow_skip < 2) { + die "$AbsName is encountered a second time"; + } + else { + return undef; + } + } + my $Link = readlink($AbsName); + # canonicalize directory separators + $Link =~ s|\\|/|g if $Is_Win32; + $NewName= PathCombine($AbsName, $Link); + unless(defined $NewName) { + if ($follow_skip < 2) { + die "$AbsName is a recursive symbolic link"; + } + else { + return undef; + } + } + else { + $AbsName= $NewName; + } + ($DEV, $INO) = lstat($AbsName); + return undef unless defined $DEV; # dangling symbolic link } if ($full_check && defined $DEV && $SLnkSeen{$DEV, $INO}++) { - if ( ($follow_skip < 1) || ((-d _) && ($follow_skip < 2)) ) { - die "$AbsName encountered a second time"; - } - else { - return undef; - } + if ( ($follow_skip < 1) || ((-d _) && ($follow_skip < 2)) ) { + die "$AbsName encountered a second time"; + } + else { + return undef; + } } return $AbsName; @@ -123,6 +136,7 @@ sub is_tainted_pp { return length($@) != 0; } + sub _find_opt { my $wanted = shift; return unless @_; @@ -133,25 +147,25 @@ sub _find_opt { local %SLnkSeen; local ($wanted_callback, $avoid_nlink, $bydepth, $no_chdir, $follow, - $follow_skip, $full_check, $untaint, $untaint_skip, $untaint_pat, - $pre_process, $post_process, $dangling_symlinks); + $follow_skip, $full_check, $untaint, $untaint_skip, $untaint_pat, + $pre_process, $post_process, $dangling_symlinks); local($dir, $name, $fullname, $prune); local *_ = \my $a; my $cwd = $wanted->{bydepth} ? Cwd::fastcwd() : Cwd::getcwd(); if ($Is_VMS) { - # VMS returns this by default in VMS format which just doesn't - # work for the rest of this module. - $cwd = VMS::Filespec::unixpath($cwd); - - # Apparently this is not expected to have a trailing space. - # To attempt to make VMS/UNIX conversions mostly reversible, - # a trailing slash is needed. The run-time functions ignore the - # resulting double slash, but it causes the perl tests to fail. + # VMS returns this by default in VMS format which just doesn't + # work for the rest of this module. + $cwd = VMS::Filespec::unixpath($cwd); + + # Apparently this is not expected to have a trailing space. + # To attempt to make VMS/UNIX conversions mostly reversible, + # a trailing slash is needed. The run-time functions ignore the + # resulting double slash, but it causes the perl tests to fail. $cwd =~ s#/\z##; - # This comes up in upper case now, but should be lower. - # In the future this could be exact case, no need to change. + # This comes up in upper case now, but should be lower. + # In the future this could be exact case, no need to change. } my $cwd_untainted = $cwd; my $check_t_cwd = 1; @@ -178,109 +192,107 @@ sub _find_opt { Proc_Top_Item: foreach my $TOP (@_) { - my $top_item = $TOP; - $top_item = VMS::Filespec::unixify($top_item) if $Is_VMS; - - ($topdev,$topino,$topmode,$topnlink) = $follow ? stat $top_item : lstat $top_item; - - if ($Is_Win32) { - $top_item =~ s|[/\\]\z|| - unless $top_item =~ m{^(?:\w:)?[/\\]$}; - } - else { - $top_item =~ s|/\z|| unless $top_item eq '/'; - } - - $Is_Dir= 0; - - if ($follow) { - - if (substr($top_item,0,1) eq '/') { - $abs_dir = $top_item; - } - elsif ($top_item eq $File::Find::current_dir) { - $abs_dir = $cwd; - } - else { # care about any ../ - $top_item =~ s/\.dir\z//i if $Is_VMS; - $abs_dir = contract_name("$cwd/",$top_item); - } - $abs_dir= Follow_SymLink($abs_dir); - unless (defined $abs_dir) { - if ($dangling_symlinks) { - if (ref $dangling_symlinks eq 'CODE') { - $dangling_symlinks->($top_item, $cwd); - } else { - warnings::warnif "$top_item is a dangling symbolic link\n"; - } - } - next Proc_Top_Item; - } - - if (-d _) { - $top_item =~ s/\.dir\z//i if $Is_VMS; - _find_dir_symlnk($wanted, $abs_dir, $top_item); - $Is_Dir= 1; - } - } - else { # no follow - $topdir = $top_item; - unless (defined $topnlink) { - warnings::warnif "Can't stat $top_item: $!\n"; - next Proc_Top_Item; - } - if (-d _) { - $top_item =~ s/\.dir\z//i if $Is_VMS; - _find_dir($wanted, $top_item, $topnlink); - $Is_Dir= 1; - } - else { - $abs_dir= $top_item; - } - } - - unless ($Is_Dir) { - unless (($_,$dir) = File::Basename::fileparse($abs_dir)) { - ($dir,$_) = ('./', $top_item); - } - - $abs_dir = $dir; - if (( $untaint ) && (is_tainted($dir) )) { - ( $abs_dir ) = $dir =~ m|$untaint_pat|; - unless (defined $abs_dir) { - if ($untaint_skip == 0) { - die "directory $dir is still tainted"; - } - else { - next Proc_Top_Item; - } - } - } - - unless ($no_chdir || chdir $abs_dir) { - warnings::warnif "Couldn't chdir $abs_dir: $!\n"; - next Proc_Top_Item; - } - - $name = $abs_dir . $_; # $File::Find::name - $_ = $name if $no_chdir; - - { $wanted_callback->() }; # protect against wild "next" - - } - - unless ( $no_chdir ) { - if ( ($check_t_cwd) && (($untaint) && (is_tainted($cwd) )) ) { - ( $cwd_untainted ) = $cwd =~ m|$untaint_pat|; - unless (defined $cwd_untainted) { - die "insecure cwd in find(depth)"; - } - $check_t_cwd = 0; - } - unless (chdir $cwd_untainted) { - die "Can't cd to $cwd: $!\n"; - } - } + my $top_item = $TOP; + $top_item = VMS::Filespec::unixify($top_item) if $Is_VMS; + + ($topdev,$topino,$topmode,$topnlink) = $follow ? stat $top_item : lstat $top_item; + + # canonicalize directory separators + $top_item =~ s|[/\\]|/|g if $Is_Win32; + + # no trailing / unless path is root + $top_item =~ s|/\z|| unless _is_root($top_item); + + $Is_Dir= 0; + + if ($follow) { + + if (_is_absolute($top_item)) { + $abs_dir = $top_item; + } + elsif ($top_item eq $File::Find::current_dir) { + $abs_dir = $cwd; + } + else { # care about any ../ + $top_item =~ s/\.dir\z//i if $Is_VMS; + $abs_dir = contract_name("$cwd/",$top_item); + } + $abs_dir= Follow_SymLink($abs_dir); + unless (defined $abs_dir) { + if ($dangling_symlinks) { + if (ref $dangling_symlinks eq 'CODE') { + $dangling_symlinks->($top_item, $cwd); + } else { + warnings::warnif "$top_item is a dangling symbolic link\n"; + } + } + next Proc_Top_Item; + } + + if (-d _) { + $top_item =~ s/\.dir\z//i if $Is_VMS; + _find_dir_symlnk($wanted, $abs_dir, $top_item); + $Is_Dir= 1; + } + } + else { # no follow + $topdir = $top_item; + unless (defined $topnlink) { + warnings::warnif "Can't stat $top_item: $!\n"; + next Proc_Top_Item; + } + if (-d _) { + $top_item =~ s/\.dir\z//i if $Is_VMS; + _find_dir($wanted, $top_item, $topnlink); + $Is_Dir= 1; + } + else { + $abs_dir= $top_item; + } + } + + unless ($Is_Dir) { + unless (($_,$dir) = File::Basename::fileparse($abs_dir)) { + ($dir,$_) = ('./', $top_item); + } + + $abs_dir = $dir; + if (( $untaint ) && (is_tainted($dir) )) { + ( $abs_dir ) = $dir =~ m|$untaint_pat|; + unless (defined $abs_dir) { + if ($untaint_skip == 0) { + die "directory $dir is still tainted"; + } + else { + next Proc_Top_Item; + } + } + } + + unless ($no_chdir || chdir $abs_dir) { + warnings::warnif "Couldn't chdir $abs_dir: $!\n"; + next Proc_Top_Item; + } + + $name = $abs_dir . $_; # $File::Find::name + $_ = $name if $no_chdir; + + { $wanted_callback->() }; # protect against wild "next" + + } + + unless ( $no_chdir ) { + if ( ($check_t_cwd) && (($untaint) && (is_tainted($cwd) )) ) { + ( $cwd_untainted ) = $cwd =~ m|$untaint_pat|; + unless (defined $cwd_untainted) { + die "insecure cwd in find(depth)"; + } + $check_t_cwd = 0; + } + unless (chdir $cwd_untainted) { + die "Can't cd to $cwd: $!\n"; + } + } } } @@ -304,179 +316,170 @@ sub _find_dir($$$) { my $tainted = 0; my $no_nlink; - if ($Is_Win32) { - $dir_pref - = ($p_dir =~ m{^(?:\w:[/\\]?|[/\\])$} ? $p_dir : "$p_dir/" ); - } elsif ($Is_VMS) { - - # VMS is returning trailing .dir on directories - # and trailing . on files and symbolic links - # in UNIX syntax. - # + if ($Is_VMS) { + # VMS is returning trailing .dir on directories + # and trailing . on files and symbolic links + # in UNIX syntax. + # - $p_dir =~ s/\.(dir)?$//i unless $p_dir eq '.'; + $p_dir =~ s/\.(dir)?$//i unless $p_dir eq '.'; - $dir_pref = ($p_dir =~ m/[\]>]+$/ ? $p_dir : "$p_dir/" ); + $dir_pref = ($p_dir =~ m/[\]>]+$/ ? $p_dir : "$p_dir/" ); } else { - $dir_pref= ( $p_dir eq '/' ? '/' : "$p_dir/" ); + $dir_pref = _is_root($p_dir) ? $p_dir : "$p_dir/"; } local ($dir, $name, $prune); unless ( $no_chdir || ($p_dir eq $File::Find::current_dir)) { - my $udir = $p_dir; - if (( $untaint ) && (is_tainted($p_dir) )) { - ( $udir ) = $p_dir =~ m|$untaint_pat|; - unless (defined $udir) { - if ($untaint_skip == 0) { - die "directory $p_dir is still tainted"; - } - else { - return; - } - } - } - unless (chdir ($Is_VMS && $udir !~ /[\/\[<]+/ ? "./$udir" : $udir)) { - warnings::warnif "Can't cd to $udir: $!\n"; - return; - } + my $udir = $p_dir; + if (( $untaint ) && (is_tainted($p_dir) )) { + ( $udir ) = $p_dir =~ m|$untaint_pat|; + unless (defined $udir) { + if ($untaint_skip == 0) { + die "directory $p_dir is still tainted"; + } + else { + return; + } + } + } + unless (chdir ($Is_VMS && $udir !~ /[\/\[<]+/ ? "./$udir" : $udir)) { + warnings::warnif "Can't cd to $udir: $!\n"; + return; + } } # push the starting directory push @Stack,[$CdLvl,$p_dir,$dir_rel,-1] if $bydepth; while (defined $SE) { - unless ($bydepth) { - $dir= $p_dir; # $File::Find::dir - $name= $dir_name; # $File::Find::name - $_= ($no_chdir ? $dir_name : $dir_rel ); # $_ - # prune may happen here - $prune= 0; - { $wanted_callback->() }; # protect against wild "next" - next if $prune; - } - - # change to that directory - unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { - my $udir= $dir_rel; - if ( ($untaint) && (($tainted) || ($tainted = is_tainted($dir_rel) )) ) { - ( $udir ) = $dir_rel =~ m|$untaint_pat|; - unless (defined $udir) { - if ($untaint_skip == 0) { - die "directory (" . ($p_dir ne '/' ? $p_dir : '') . "/) $dir_rel is still tainted"; - } else { # $untaint_skip == 1 - next; - } - } - } - unless (chdir ($Is_VMS && $udir !~ /[\/\[<]+/ ? "./$udir" : $udir)) { - warnings::warnif "Can't cd to (" . - ($p_dir ne '/' ? $p_dir : '') . "/) $udir: $!\n"; - next; - } - $CdLvl++; - } - - $dir= $dir_name; # $File::Find::dir - - # Get the list of files in the current directory. - my $dh; - unless (opendir $dh, ($no_chdir ? $dir_name : $File::Find::current_dir)) { - warnings::warnif "Can't opendir($dir_name): $!\n"; - next; - } - @filenames = readdir $dh; - closedir($dh); - @filenames = $pre_process->(@filenames) if $pre_process; - push @Stack,[$CdLvl,$dir_name,"",-2] if $post_process; - - # default: use whatever was specified + unless ($bydepth) { + $dir= $p_dir; # $File::Find::dir + $name= $dir_name; # $File::Find::name + $_= ($no_chdir ? $dir_name : $dir_rel ); # $_ + # prune may happen here + $prune= 0; + { $wanted_callback->() }; # protect against wild "next" + next if $prune; + } + + # change to that directory + unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { + my $udir= $dir_rel; + if ( ($untaint) && (($tainted) || ($tainted = is_tainted($dir_rel) )) ) { + ( $udir ) = $dir_rel =~ m|$untaint_pat|; + unless (defined $udir) { + if ($untaint_skip == 0) { + die "directory (" . ($p_dir ne '/' ? $p_dir : '') . "/) $dir_rel is still tainted"; + } else { # $untaint_skip == 1 + next; + } + } + } + unless (chdir ($Is_VMS && $udir !~ /[\/\[<]+/ ? "./$udir" : $udir)) { + warnings::warnif "Can't cd to (" . + ($p_dir ne '/' ? $p_dir : '') . "/) $udir: $!\n"; + next; + } + $CdLvl++; + } + + $dir= $dir_name; # $File::Find::dir + + # Get the list of files in the current directory. + my $dh; + unless (opendir $dh, ($no_chdir ? $dir_name : $File::Find::current_dir)) { + warnings::warnif "Can't opendir($dir_name): $!\n"; + next; + } + @filenames = readdir $dh; + closedir($dh); + @filenames = $pre_process->(@filenames) if $pre_process; + push @Stack,[$CdLvl,$dir_name,"",-2] if $post_process; + + # default: use whatever was specified # (if $nlink >= 2, and $avoid_nlink == 0, this will switch back) $no_nlink = $avoid_nlink; # if dir has wrong nlink count, force switch to slower stat method $no_nlink = 1 if ($nlink < 2); - if ($nlink == 2 && !$no_nlink) { - # This dir has no subdirectories. - for my $FN (@filenames) { - if ($Is_VMS) { - # Big hammer here - Compensate for VMS trailing . and .dir - # No win situation until this is changed, but this - # will handle the majority of the cases with breaking the fewest - - $FN =~ s/\.dir\z//i; - $FN =~ s#\.$## if ($FN ne '.'); - } - next if $FN =~ $File::Find::skip_pattern; - - $name = $dir_pref . $FN; # $File::Find::name - $_ = ($no_chdir ? $name : $FN); # $_ - { $wanted_callback->() }; # protect against wild "next" - } - - } - else { - # This dir has subdirectories. - $subcount = $nlink - 2; - - # HACK: insert directories at this position, so as to preserve - # the user pre-processed ordering of files (thus ensuring - # directory traversal is in user sorted order, not at random). + if ($nlink == 2 && !$no_nlink) { + # This dir has no subdirectories. + for my $FN (@filenames) { + if ($Is_VMS) { + # Big hammer here - Compensate for VMS trailing . and .dir + # No win situation until this is changed, but this + # will handle the majority of the cases with breaking the fewest + + $FN =~ s/\.dir\z//i; + $FN =~ s#\.$## if ($FN ne '.'); + } + next if $FN =~ $File::Find::skip_pattern; + + $name = $dir_pref . $FN; # $File::Find::name + $_ = ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + + } + else { + # This dir has subdirectories. + $subcount = $nlink - 2; + + # HACK: insert directories at this position, so as to preserve + # the user pre-processed ordering of files (thus ensuring + # directory traversal is in user sorted order, not at random). my $stack_top = @Stack; - for my $FN (@filenames) { - next if $FN =~ $File::Find::skip_pattern; - if ($subcount > 0 || $no_nlink) { - # Seen all the subdirs? - # check for directoriness. - # stat is faster for a file in the current directory - $sub_nlink = (lstat ($no_chdir ? $dir_pref . $FN : $FN))[3]; - - if (-d _) { - --$subcount; - $FN =~ s/\.dir\z//i if $Is_VMS; - # HACK: replace push to preserve dir traversal order - #push @Stack,[$CdLvl,$dir_name,$FN,$sub_nlink]; - splice @Stack, $stack_top, 0, - [$CdLvl,$dir_name,$FN,$sub_nlink]; - } - else { - $name = $dir_pref . $FN; # $File::Find::name - $_= ($no_chdir ? $name : $FN); # $_ - { $wanted_callback->() }; # protect against wild "next" - } - } - else { - $name = $dir_pref . $FN; # $File::Find::name - $_= ($no_chdir ? $name : $FN); # $_ - { $wanted_callback->() }; # protect against wild "next" - } - } - } + for my $FN (@filenames) { + next if $FN =~ $File::Find::skip_pattern; + if ($subcount > 0 || $no_nlink) { + # Seen all the subdirs? + # check for directoriness. + # stat is faster for a file in the current directory + $sub_nlink = (lstat ($no_chdir ? $dir_pref . $FN : $FN))[3]; + + if (-d _) { + --$subcount; + $FN =~ s/\.dir\z//i if $Is_VMS; + # HACK: replace push to preserve dir traversal order + #push @Stack,[$CdLvl,$dir_name,$FN,$sub_nlink]; + splice @Stack, $stack_top, 0, + [$CdLvl,$dir_name,$FN,$sub_nlink]; + } + else { + $name = $dir_pref . $FN; # $File::Find::name + $_= ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + } + else { + $name = $dir_pref . $FN; # $File::Find::name + $_= ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + } + } } continue { - while ( defined ($SE = pop @Stack) ) { - ($Level, $p_dir, $dir_rel, $nlink) = @$SE; - if ($CdLvl > $Level && !$no_chdir) { - my $tmp; - if ($Is_VMS) { - $tmp = '[' . ('-' x ($CdLvl-$Level)) . ']'; - } - else { - $tmp = join('/',('..') x ($CdLvl-$Level)); - } - die "Can't cd to $tmp from $dir_name: $!" - unless chdir ($tmp); - $CdLvl = $Level; - } - - if ($Is_Win32) { - $dir_name = ($p_dir =~ m{^(?:\w:[/\\]?|[/\\])$} - ? "$p_dir$dir_rel" : "$p_dir/$dir_rel"); - $dir_pref = "$dir_name/"; - } - elsif ($^O eq 'VMS') { + while ( defined ($SE = pop @Stack) ) { + ($Level, $p_dir, $dir_rel, $nlink) = @$SE; + if ($CdLvl > $Level && !$no_chdir) { + my $tmp; + if ($Is_VMS) { + $tmp = '[' . ('-' x ($CdLvl-$Level)) . ']'; + } + else { + $tmp = join('/',('..') x ($CdLvl-$Level)); + } + die "Can't cd to $tmp from $dir_name: $!" + unless chdir ($tmp); + $CdLvl = $Level; + } + + if ($^O eq 'VMS') { if ($p_dir =~ m/[\]>]+$/) { $dir_name = $p_dir; $dir_name =~ s/([\]>]+)$/.$dir_rel$1/; @@ -486,34 +489,34 @@ sub _find_dir($$$) { $dir_name = "$p_dir/$dir_rel"; $dir_pref = "$dir_name/"; } - } - else { - $dir_name = ($p_dir eq '/' ? "/$dir_rel" : "$p_dir/$dir_rel"); - $dir_pref = "$dir_name/"; - } - - if ( $nlink == -2 ) { - $name = $dir = $p_dir; # $File::Find::name / dir + } + else { + $dir_name = _is_root($p_dir) ? "$p_dir$dir_rel" : "$p_dir/$dir_rel"; + $dir_pref = "$dir_name/"; + } + + if ( $nlink == -2 ) { + $name = $dir = $p_dir; # $File::Find::name / dir $_ = $File::Find::current_dir; - $post_process->(); # End-of-directory processing - } - elsif ( $nlink < 0 ) { # must be finddepth, report dirname now - $name = $dir_name; - if ( substr($name,-2) eq '/.' ) { - substr($name, length($name) == 2 ? -1 : -2) = ''; - } - $dir = $p_dir; - $_ = ($no_chdir ? $dir_name : $dir_rel ); - if ( substr($_,-2) eq '/.' ) { - substr($_, length($_) == 2 ? -1 : -2) = ''; - } - { $wanted_callback->() }; # protect against wild "next" - } - else { - push @Stack,[$CdLvl,$p_dir,$dir_rel,-1] if $bydepth; - last; - } - } + $post_process->(); # End-of-directory processing + } + elsif ( $nlink < 0 ) { # must be finddepth, report dirname now + $name = $dir_name; + if ( substr($name,-2) eq '/.' ) { + substr($name, length($name) == 2 ? -1 : -2) = ''; + } + $dir = $p_dir; + $_ = ($no_chdir ? $dir_name : $dir_rel ); + if ( substr($_,-2) eq '/.' ) { + substr($_, length($_) == 2 ? -1 : -2) = ''; + } + { $wanted_callback->() }; # protect against wild "next" + } + else { + push @Stack,[$CdLvl,$p_dir,$dir_rel,-1] if $bydepth; + last; + } + } } } @@ -540,172 +543,172 @@ sub _find_dir_symlnk($$$) { my $tainted = 0; my $ok = 1; - $dir_pref = ( $p_dir eq '/' ? '/' : "$p_dir/" ); - $loc_pref = ( $dir_loc eq '/' ? '/' : "$dir_loc/" ); + $dir_pref = _is_root($p_dir) ? $p_dir : "$p_dir/"; + $loc_pref = _is_root($dir_loc) ? $dir_loc : "$dir_loc/"; local ($dir, $name, $fullname, $prune); unless ($no_chdir) { - # untaint the topdir - if (( $untaint ) && (is_tainted($dir_loc) )) { - ( $updir_loc ) = $dir_loc =~ m|$untaint_pat|; # parent dir, now untainted - # once untainted, $updir_loc is pushed on the stack (as parent directory); - # hence, we don't need to untaint the parent directory every time we chdir - # to it later - unless (defined $updir_loc) { - if ($untaint_skip == 0) { - die "directory $dir_loc is still tainted"; - } - else { - return; - } - } - } - $ok = chdir($updir_loc) unless ($p_dir eq $File::Find::current_dir); - unless ($ok) { - warnings::warnif "Can't cd to $updir_loc: $!\n"; - return; - } + # untaint the topdir + if (( $untaint ) && (is_tainted($dir_loc) )) { + ( $updir_loc ) = $dir_loc =~ m|$untaint_pat|; # parent dir, now untainted + # once untainted, $updir_loc is pushed on the stack (as parent directory); + # hence, we don't need to untaint the parent directory every time we chdir + # to it later + unless (defined $updir_loc) { + if ($untaint_skip == 0) { + die "directory $dir_loc is still tainted"; + } + else { + return; + } + } + } + $ok = chdir($updir_loc) unless ($p_dir eq $File::Find::current_dir); + unless ($ok) { + warnings::warnif "Can't cd to $updir_loc: $!\n"; + return; + } } push @Stack,[$dir_loc,$updir_loc,$p_dir,$dir_rel,-1] if $bydepth; while (defined $SE) { - unless ($bydepth) { - # change (back) to parent directory (always untainted) - unless ($no_chdir) { - unless (chdir $updir_loc) { - warnings::warnif "Can't cd to $updir_loc: $!\n"; - next; - } - } - $dir= $p_dir; # $File::Find::dir - $name= $dir_name; # $File::Find::name - $_= ($no_chdir ? $dir_name : $dir_rel ); # $_ - $fullname= $dir_loc; # $File::Find::fullname - # prune may happen here - $prune= 0; - lstat($_); # make sure file tests with '_' work - { $wanted_callback->() }; # protect against wild "next" - next if $prune; - } - - # change to that directory - unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { - $updir_loc = $dir_loc; - if ( ($untaint) && (($tainted) || ($tainted = is_tainted($dir_loc) )) ) { - # untaint $dir_loc, what will be pushed on the stack as (untainted) parent dir - ( $updir_loc ) = $dir_loc =~ m|$untaint_pat|; - unless (defined $updir_loc) { - if ($untaint_skip == 0) { - die "directory $dir_loc is still tainted"; - } - else { - next; - } - } - } - unless (chdir $updir_loc) { - warnings::warnif "Can't cd to $updir_loc: $!\n"; - next; - } - } - - $dir = $dir_name; # $File::Find::dir - - # Get the list of files in the current directory. - my $dh; - unless (opendir $dh, ($no_chdir ? $dir_loc : $File::Find::current_dir)) { - warnings::warnif "Can't opendir($dir_loc): $!\n"; - next; - } - @filenames = readdir $dh; - closedir($dh); - - for my $FN (@filenames) { - if ($Is_VMS) { - # Big hammer here - Compensate for VMS trailing . and .dir - # No win situation until this is changed, but this - # will handle the majority of the cases with breaking the fewest. - - $FN =~ s/\.dir\z//i; - $FN =~ s#\.$## if ($FN ne '.'); - } - next if $FN =~ $File::Find::skip_pattern; - - # follow symbolic links / do an lstat - $new_loc = Follow_SymLink($loc_pref.$FN); - - # ignore if invalid symlink - unless (defined $new_loc) { - if (!defined -l _ && $dangling_symlinks) { + unless ($bydepth) { + # change (back) to parent directory (always untainted) + unless ($no_chdir) { + unless (chdir $updir_loc) { + warnings::warnif "Can't cd to $updir_loc: $!\n"; + next; + } + } + $dir= $p_dir; # $File::Find::dir + $name= $dir_name; # $File::Find::name + $_= ($no_chdir ? $dir_name : $dir_rel ); # $_ + $fullname= $dir_loc; # $File::Find::fullname + # prune may happen here + $prune= 0; + lstat($_); # make sure file tests with '_' work + { $wanted_callback->() }; # protect against wild "next" + next if $prune; + } + + # change to that directory + unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { + $updir_loc = $dir_loc; + if ( ($untaint) && (($tainted) || ($tainted = is_tainted($dir_loc) )) ) { + # untaint $dir_loc, what will be pushed on the stack as (untainted) parent dir + ( $updir_loc ) = $dir_loc =~ m|$untaint_pat|; + unless (defined $updir_loc) { + if ($untaint_skip == 0) { + die "directory $dir_loc is still tainted"; + } + else { + next; + } + } + } + unless (chdir $updir_loc) { + warnings::warnif "Can't cd to $updir_loc: $!\n"; + next; + } + } + + $dir = $dir_name; # $File::Find::dir + + # Get the list of files in the current directory. + my $dh; + unless (opendir $dh, ($no_chdir ? $dir_loc : $File::Find::current_dir)) { + warnings::warnif "Can't opendir($dir_loc): $!\n"; + next; + } + @filenames = readdir $dh; + closedir($dh); + + for my $FN (@filenames) { + if ($Is_VMS) { + # Big hammer here - Compensate for VMS trailing . and .dir + # No win situation until this is changed, but this + # will handle the majority of the cases with breaking the fewest. + + $FN =~ s/\.dir\z//i; + $FN =~ s#\.$## if ($FN ne '.'); + } + next if $FN =~ $File::Find::skip_pattern; + + # follow symbolic links / do an lstat + $new_loc = Follow_SymLink($loc_pref.$FN); + + # ignore if invalid symlink + unless (defined $new_loc) { + if (!defined -l _ && $dangling_symlinks) { $fullname = undef; - if (ref $dangling_symlinks eq 'CODE') { - $dangling_symlinks->($FN, $dir_pref); - } else { - warnings::warnif "$dir_pref$FN is a dangling symbolic link\n"; - } - } + if (ref $dangling_symlinks eq 'CODE') { + $dangling_symlinks->($FN, $dir_pref); + } else { + warnings::warnif "$dir_pref$FN is a dangling symbolic link\n"; + } + } else { $fullname = $loc_pref . $FN; } - $name = $dir_pref . $FN; - $_ = ($no_chdir ? $name : $FN); - { $wanted_callback->() }; - next; - } - - if (-d _) { - if ($Is_VMS) { - $FN =~ s/\.dir\z//i; - $FN =~ s#\.$## if ($FN ne '.'); - $new_loc =~ s/\.dir\z//i; - $new_loc =~ s#\.$## if ($new_loc ne '.'); - } - push @Stack,[$new_loc,$updir_loc,$dir_name,$FN,1]; - } - else { - $fullname = $new_loc; # $File::Find::fullname - $name = $dir_pref . $FN; # $File::Find::name - $_ = ($no_chdir ? $name : $FN); # $_ - { $wanted_callback->() }; # protect against wild "next" - } - } + $name = $dir_pref . $FN; + $_ = ($no_chdir ? $name : $FN); + { $wanted_callback->() }; + next; + } + + if (-d _) { + if ($Is_VMS) { + $FN =~ s/\.dir\z//i; + $FN =~ s#\.$## if ($FN ne '.'); + $new_loc =~ s/\.dir\z//i; + $new_loc =~ s#\.$## if ($new_loc ne '.'); + } + push @Stack,[$new_loc,$updir_loc,$dir_name,$FN,1]; + } + else { + $fullname = $new_loc; # $File::Find::fullname + $name = $dir_pref . $FN; # $File::Find::name + $_ = ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + } } continue { - while (defined($SE = pop @Stack)) { - ($dir_loc, $updir_loc, $p_dir, $dir_rel, $byd_flag) = @$SE; - $dir_name = ($p_dir eq '/' ? "/$dir_rel" : "$p_dir/$dir_rel"); - $dir_pref = "$dir_name/"; - $loc_pref = "$dir_loc/"; - if ( $byd_flag < 0 ) { # must be finddepth, report dirname now - unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { - unless (chdir $updir_loc) { # $updir_loc (parent dir) is always untainted - warnings::warnif "Can't cd to $updir_loc: $!\n"; - next; - } - } - $fullname = $dir_loc; # $File::Find::fullname - $name = $dir_name; # $File::Find::name - if ( substr($name,-2) eq '/.' ) { - substr($name, length($name) == 2 ? -1 : -2) = ''; # $File::Find::name - } - $dir = $p_dir; # $File::Find::dir - $_ = ($no_chdir ? $dir_name : $dir_rel); # $_ - if ( substr($_,-2) eq '/.' ) { - substr($_, length($_) == 2 ? -1 : -2) = ''; - } - - lstat($_); # make sure file tests with '_' work - { $wanted_callback->() }; # protect against wild "next" - } - else { - push @Stack,[$dir_loc, $updir_loc, $p_dir, $dir_rel,-1] if $bydepth; - last; - } - } + while (defined($SE = pop @Stack)) { + ($dir_loc, $updir_loc, $p_dir, $dir_rel, $byd_flag) = @$SE; + $dir_name = _is_root($p_dir) ? "$p_dir$dir_rel" : "$p_dir/$dir_rel"; + $dir_pref = "$dir_name/"; + $loc_pref = "$dir_loc/"; + if ( $byd_flag < 0 ) { # must be finddepth, report dirname now + unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { + unless (chdir $updir_loc) { # $updir_loc (parent dir) is always untainted + warnings::warnif "Can't cd to $updir_loc: $!\n"; + next; + } + } + $fullname = $dir_loc; # $File::Find::fullname + $name = $dir_name; # $File::Find::name + if ( substr($name,-2) eq '/.' ) { + substr($name, length($name) == 2 ? -1 : -2) = ''; # $File::Find::name + } + $dir = $p_dir; # $File::Find::dir + $_ = ($no_chdir ? $dir_name : $dir_rel); # $_ + if ( substr($_,-2) eq '/.' ) { + substr($_, length($_) == 2 ? -1 : -2) = ''; + } + + lstat($_); # make sure file tests with '_' work + { $wanted_callback->() }; # protect against wild "next" + } + else { + push @Stack,[$dir_loc, $updir_loc, $p_dir, $dir_rel,-1] if $bydepth; + last; + } + } } } @@ -913,8 +916,6 @@ a dangling symbolic link, then fullname will be set to C<undef>. =back -This is a no-op on Win32. - =item C<follow_fast> This is similar to I<follow> except that it may report some files more @@ -923,8 +924,6 @@ have to be hashed, this is much cheaper both in space and time. If processing a file more than once (by the user's C<wanted()> function) is worse than just taking time, the option I<follow> should be used. -This is also a no-op on Win32. - =item C<follow_skip> C<follow_skip==1>, which is the default, causes all files which are diff --git a/gnu/usr.bin/perl/ext/File-Find/t/find.t b/gnu/usr.bin/perl/ext/File-Find/t/find.t index add20c26839..b6359d86ae8 100644 --- a/gnu/usr.bin/perl/ext/File-Find/t/find.t +++ b/gnu/usr.bin/perl/ext/File-Find/t/find.t @@ -33,15 +33,21 @@ use Testing qw( symlink_ok dir_path file_path + _cleanup_start ); use Errno (); +use File::Temp qw(tempdir); my %Expect_File = (); # what we expect for $_ my %Expect_Name = (); # what we expect for $File::Find::name/fullname my %Expect_Dir = (); # what we expect for $File::Find::dir my (@files); -my $orig_dir = cwd(); +my $test_root_dir = cwd(); +ok($test_root_dir,"We were able to determine our starting directory"); +my $test_temp_dir = tempdir("FF_find_t_XXXXXX",CLEANUP=>1); +ok($test_temp_dir,"We were able to set up a temp directory"); + # Uncomment this to see where File::Find is chdir-ing to. Helpful for # debugging its little jaunts around the filesystem. @@ -59,8 +65,6 @@ my $orig_dir = cwd(); # }; # } -cleanup(); - ##### Sanity checks ##### # Do find() and finddepth() work correctly with an empty list of # directories? @@ -73,23 +77,34 @@ cleanup(); } # Do find() and finddepth() work correctly in the directory -# from which we start? (Test presumes the presence of 'taint.t' in same +# from which we start? (Test presumes the presence of 'find.t' in same # directory as this test file.) -$::count_taint = 0; -find({wanted => sub { ++$::count_taint if $_ eq 'taint.t'; } }, +my $count_found = 0; +find({wanted => sub { ++$count_found if $_ eq 'find.t'; } }, File::Spec->curdir); -is($::count_taint, 1, "'find' found exactly 1 file named 'taint.t'"); +is($count_found, 1, "'find' found exactly 1 file named 'find.t'"); -$::count_taint = 0; -finddepth({wanted => sub { ++$::count_taint if $_ eq 'taint.t'; } }, +$count_found = 0; +finddepth({wanted => sub { ++$count_found if $_ eq 'find.t'; } }, File::Spec->curdir); -is($::count_taint, 1, "'finddepth' found exactly 1 file named 'taint.t'"); +is($count_found, 1, "'finddepth' found exactly 1 file named 'find.t'"); my $FastFileTests_OK = 0; +my $chdir_error = ""; +chdir($test_temp_dir) + or $chdir_error = "Failed to chdir to '$test_temp_dir': $!"; +is($chdir_error,"","chdir to temp dir '$test_temp_dir' successful") + or die $chdir_error; + sub cleanup { - chdir($orig_dir); + # the following chdirs into $test_root_dir/$test_temp_dir but + # handles various possible edge case errors cleanly. If it returns + # false then we bail out of the cleanup. + _cleanup_start($test_root_dir, $test_temp_dir) + or return; + my $need_updir = 0; if (-d dir_path('for_find')) { $need_updir = 1 if chdir(dir_path('for_find')); @@ -138,6 +153,7 @@ sub cleanup { if (-d dir_path('for_find')) { rmdir dir_path('for_find') or print "# Can't rmdir for_find: $!\n"; } + chdir($test_root_dir) or die "Failed to chdir to '$test_root_dir': $!"; } END { @@ -235,7 +251,6 @@ sub my_postprocess { *file_path_name = \&file_path; ##### Create directories, files and symlinks used in testing ##### - mkdir_ok( dir_path('for_find'), 0770 ); ok( chdir( dir_path('for_find')), "Able to chdir to 'for_find'") or die("Unable to chdir to 'for_find'"); @@ -865,7 +880,7 @@ if ( $symlink_exists ) { if ($^O eq 'MSWin32') { require File::Spec::Win32; - my ($volume) = File::Spec::Win32->splitpath($orig_dir, 1); + my ($volume) = File::Spec::Win32->splitpath($test_root_dir, 1); print STDERR "VOLUME = $volume\n"; ##### ##### @@ -1023,7 +1038,7 @@ if ($^O eq 'MSWin32') { # Check F:F:f correctly handles a root directory path. # Rather than processing the entire drive (!), simply test that the # first file passed to the wanted routine is correct and then bail out. - $orig_dir =~ /^(\w:)/ or die "expected a drive: $orig_dir"; + $test_root_dir =~ /^(\w:)/ or die "expected a drive: $test_root_dir"; my $drive = $1; # Determine the file in the root directory which would be @@ -1050,7 +1065,7 @@ if ($^O eq 'MSWin32') { # Run F:F:f with/without no_chdir for each possible style of root path. # NB. If HOME were "/", then an inadvertent chdir('') would fluke the # expected result, so ensure it is something else: - local $ENV{HOME} = $orig_dir; + local $ENV{HOME} = $test_root_dir; foreach my $no_chdir (0, 1) { foreach my $root_dir ("/", "\\", "$drive/", "$drive\\") { eval { @@ -1060,7 +1075,7 @@ if ($^O eq 'MSWin32') { 'wanted' => sub { -f or return; # the first call is for $root_dir itself. my $got = $File::Find::name; - my $exp = "$root_dir$expected_first_file"; + (my $exp = "$root_dir$expected_first_file") =~ s|\\|/|g; print "# no_chdir=$no_chdir $root_dir '$got'\n"; is($got, $exp, "Win32: Run 'find' with 'no_chdir' set to $no_chdir" ); @@ -1111,5 +1126,4 @@ if ($^O eq 'MSWin32') { like($@, qr/invalid top directory/, "find() correctly died due to undefined top directory"); } - done_testing(); diff --git a/gnu/usr.bin/perl/ext/File-Glob/Glob.pm b/gnu/usr.bin/perl/ext/File-Glob/Glob.pm index 74b6af7504e..f7b89f490a4 100644 --- a/gnu/usr.bin/perl/ext/File-Glob/Glob.pm +++ b/gnu/usr.bin/perl/ext/File-Glob/Glob.pm @@ -33,7 +33,7 @@ $EXPORT_TAGS{bsd_glob} = [@{$EXPORT_TAGS{glob}}]; our @EXPORT_OK = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob'); -our $VERSION = '1.37'; +our $VERSION = '1.40'; sub import { require Exporter; diff --git a/gnu/usr.bin/perl/ext/File-Glob/Glob.xs b/gnu/usr.bin/perl/ext/File-Glob/Glob.xs index 4e1ae80b722..a65337e9796 100644 --- a/gnu/usr.bin/perl/ext/File-Glob/Glob.xs +++ b/gnu/usr.bin/perl/ext/File-Glob/Glob.xs @@ -99,7 +99,7 @@ iterate(pTHX_ bool(*globber)(pTHX_ AV *entries, const char *pat, STRLEN len, boo } else { pat = SvPV_nomg(patsv,len); - is_utf8 = !!SvUTF8(patsv); + is_utf8 = cBOOL(SvUTF8(patsv)); /* the lower-level code expects a null-terminated string */ if (!SvPOK(patsv) || pat != SvPVX(patsv) || pat[len] != '\0') { SV *newpatsv = newSVpvn_flags(pat, len, SVs_TEMP); @@ -451,11 +451,13 @@ BOOT: { dMY_CXT; MY_CXT.x_GLOB_ENTRIES = NULL; - MY_CXT.x_GLOB_OLD_OPHOOK = PL_opfreehook; #ifdef USE_ITHREADS MY_CXT.interp = aTHX; #endif - PL_opfreehook = glob_ophook; + if(!MY_CXT.x_GLOB_OLD_OPHOOK) { + MY_CXT.x_GLOB_OLD_OPHOOK = PL_opfreehook; + PL_opfreehook = glob_ophook; + } } } diff --git a/gnu/usr.bin/perl/ext/File-Glob/bsd_glob.c b/gnu/usr.bin/perl/ext/File-Glob/bsd_glob.c index 8fab443d2c6..3d402e0b457 100644 --- a/gnu/usr.bin/perl/ext/File-Glob/bsd_glob.c +++ b/gnu/usr.bin/perl/ext/File-Glob/bsd_glob.c @@ -81,9 +81,9 @@ static char sscsid[]= "$OpenBSD: glob.c,v 1.8.10.1 2001/04/10 jason Exp $"; #ifndef MAXPATHLEN # ifdef PATH_MAX -# define MAXPATHLEN PATH_MAX +# define MAXPATHLEN PATH_MAX # else -# define MAXPATHLEN 1024 +# define MAXPATHLEN 1024 # endif #endif @@ -91,71 +91,71 @@ static char sscsid[]= "$OpenBSD: glob.c,v 1.8.10.1 2001/04/10 jason Exp $"; #ifndef ARG_MAX # ifdef _SC_ARG_MAX -# define ARG_MAX (sysconf(_SC_ARG_MAX)) +# define ARG_MAX (sysconf(_SC_ARG_MAX)) # else # ifdef _POSIX_ARG_MAX -# define ARG_MAX _POSIX_ARG_MAX +# define ARG_MAX _POSIX_ARG_MAX # else # ifdef WIN32 -# define ARG_MAX 14500 /* from VC's limits.h */ +# define ARG_MAX 14500 /* from VC's limits.h */ # else -# define ARG_MAX 4096 /* from POSIX, be conservative */ +# define ARG_MAX 4096 /* from POSIX, be conservative */ # endif # endif # endif #endif -#define BG_DOLLAR '$' -#define BG_DOT '.' -#define BG_EOS '\0' -#define BG_LBRACKET '[' -#define BG_NOT '!' -#define BG_QUESTION '?' -#define BG_QUOTE '\\' -#define BG_RANGE '-' -#define BG_RBRACKET ']' -#define BG_SEP '/' +#define BG_DOLLAR '$' +#define BG_DOT '.' +#define BG_EOS '\0' +#define BG_LBRACKET '[' +#define BG_NOT '!' +#define BG_QUESTION '?' +#define BG_QUOTE '\\' +#define BG_RANGE '-' +#define BG_RBRACKET ']' +#define BG_SEP '/' #ifdef DOSISH #define BG_SEP2 '\\' #endif -#define BG_STAR '*' -#define BG_TILDE '~' -#define BG_UNDERSCORE '_' -#define BG_LBRACE '{' -#define BG_RBRACE '}' -#define BG_SLASH '/' -#define BG_COMMA ',' +#define BG_STAR '*' +#define BG_TILDE '~' +#define BG_UNDERSCORE '_' +#define BG_LBRACE '{' +#define BG_RBRACE '}' +#define BG_SLASH '/' +#define BG_COMMA ',' #ifndef GLOB_DEBUG -#define M_QUOTE 0x8000 -#define M_PROTECT 0x4000 -#define M_MASK 0xffff -#define M_ASCII 0x00ff +#define M_QUOTE 0x8000 +#define M_PROTECT 0x4000 +#define M_MASK 0xffff +#define M_ASCII 0x00ff typedef U16 Char; #else -#define M_QUOTE 0x80 -#define M_PROTECT 0x40 -#define M_MASK 0xff -#define M_ASCII 0x7f +#define M_QUOTE 0x80 +#define M_PROTECT 0x40 +#define M_MASK 0xff +#define M_ASCII 0x7f typedef U8 Char; #endif /* !GLOB_DEBUG */ -#define CHAR(c) ((Char)((c)&M_ASCII)) -#define META(c) ((Char)((c)|M_QUOTE)) -#define M_ALL META('*') -#define M_END META(']') -#define M_NOT META('!') -#define M_ONE META('?') -#define M_RNG META('-') -#define M_SET META('[') -#define ismeta(c) (((c)&M_QUOTE) != 0) +#define CHAR(c) ((Char)((c)&M_ASCII)) +#define META(c) ((Char)((c)|M_QUOTE)) +#define M_ALL META('*') +#define M_END META(']') +#define M_NOT META('!') +#define M_ONE META('?') +#define M_RNG META('-') +#define M_SET META('[') +#define ismeta(c) (((c)&M_QUOTE) != 0) static int compare(const void *, const void *); @@ -204,7 +204,7 @@ my_readdir(DIR *d) } # else -# define my_readdir readdir +# define my_readdir readdir # endif diff --git a/gnu/usr.bin/perl/ext/GDBM_File/GDBM_File.pm b/gnu/usr.bin/perl/ext/GDBM_File/GDBM_File.pm index fe422a592ae..45a1a93cd5d 100644 --- a/gnu/usr.bin/perl/ext/GDBM_File/GDBM_File.pm +++ b/gnu/usr.bin/perl/ext/GDBM_File/GDBM_File.pm @@ -733,7 +733,7 @@ require XSLoader; ); # This module isn't dual life, so no need for dev version numbers. -$VERSION = '1.23'; +$VERSION = '1.24'; our $gdbm_errno; diff --git a/gnu/usr.bin/perl/ext/Hash-Util/Util.xs b/gnu/usr.bin/perl/ext/Hash-Util/Util.xs index 4e49a095e32..b266f4a81c1 100644 --- a/gnu/usr.bin/perl/ext/Hash-Util/Util.xs +++ b/gnu/usr.bin/perl/ext/Hash-Util/Util.xs @@ -115,7 +115,7 @@ hash_traversal_mask(rhv, ...) if (items>1) { hv_rand_set(hv, SvUV(ST(1))); } - if (SvOOK(hv)) { + if (HvHasAUX(hv)) { XSRETURN_UV(HvRAND_get(hv)); } else { XSRETURN_UNDEF; diff --git a/gnu/usr.bin/perl/ext/Hash-Util/lib/Hash/Util.pm b/gnu/usr.bin/perl/ext/Hash-Util/lib/Hash/Util.pm index 0b42922c966..a0da8ba1b0b 100644 --- a/gnu/usr.bin/perl/ext/Hash-Util/lib/Hash/Util.pm +++ b/gnu/usr.bin/perl/ext/Hash-Util/lib/Hash/Util.pm @@ -42,7 +42,7 @@ our @EXPORT_OK = qw( BEGIN { # make sure all our XS routines are available early so their prototypes # are correctly applied in the following code. - our $VERSION = '0.28'; + our $VERSION = '0.30'; require XSLoader; XSLoader::load(); } @@ -92,7 +92,7 @@ Hash::Util - A selection of general-utility hash subroutines hash_traversal_mask ); - %hash = (foo => 42, bar => 23); + my %hash = (foo => 42, bar => 23); # Ways to restrict a hash lock_keys(%hash); lock_keys(%hash, @keyset); diff --git a/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.pm b/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.pm index fd34a8a29ff..8ff6eda2d73 100644 --- a/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.pm +++ b/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.pm @@ -70,7 +70,7 @@ our @EXPORT_OK = qw( YESSTR ); -our $VERSION = '0.21'; +our $VERSION = '0.22'; XSLoader::load(); @@ -180,8 +180,11 @@ For the eras based on typically some ruler, such as the Japanese Emperor =head2 For systems without C<nl_langinfo> -Starting in Perl 5.28, this module is available even on systems that lack a -native C<nl_langinfo>. On such systems, it uses various methods to construct +This module originally was just a wrapper for the libc C<nl_langinfo> +function, and did not work on systems lacking it, such as Windows. + +Starting in Perl 5.28, this module works on all platforms. When +C<nl_langinfo> is not available, it uses various methods to construct what that function, if present, would return. But there are potential glitches. These are the items that could be different: @@ -193,8 +196,11 @@ Unimplemented, so returns C<"">. =item C<CODESET> -Unimplemented, except on Windows, due to the vagaries of vendor locale names, -returning C<""> on non-Windows. +This should work properly for Windows platforms. On almost all other modern +platforms, it will reliably return "UTF-8" if that is the code set. +Otherwise, it depends on the locale's name. If that is of the form +C<foo.bar>, it will assume C<bar> is the code set; and it also knows about the +two locales "C" and "POSIX". If none of those apply it returns C<"">. =item C<YESEXPR> @@ -272,8 +278,6 @@ workaround for this; patches welcome: see L<perlapi/switch_to_global_locale>. L<perllocale>, L<POSIX/localeconv>, L<POSIX/setlocale>, L<nl_langinfo(3)>. -The langinfo() function is just a wrapper for the C nl_langinfo() interface. - =head1 AUTHOR Jarkko Hietaniemi, E<lt>jhi@hut.fiE<gt>. Now maintained by Perl 5 porters. diff --git a/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.xs b/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.xs index 904b424b192..3b05e9f7917 100644 --- a/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.xs +++ b/gnu/usr.bin/perl/ext/I18N-Langinfo/Langinfo.xs @@ -25,8 +25,8 @@ SV* langinfo(code) int code PREINIT: - const char * value; - STRLEN len; + const char * value; + utf8ness_t is_utf8; PROTOTYPE: _ CODE: #ifdef HAS_NL_LANGINFO @@ -36,64 +36,8 @@ langinfo(code) } else #endif { - value = Perl_langinfo(code); - len = strlen(value); - RETVAL = newSVpvn(Perl_langinfo(code), len); - - /* Now see if the UTF-8 flag should be turned on */ -#ifdef USE_LOCALE_CTYPE /* No utf8 strings if not using LC_CTYPE */ - - /* If 'value' is ASCII or not legal UTF-8, the flag doesn't get - * turned on, so skip the followin code */ - if (is_utf8_non_invariant_string((U8 *) value, len)) { - int category; - - /* Check if the locale is a UTF-8 one. The returns from - * Perl_langinfo() are in different locale categories, so check the - * category corresponding to this item */ - switch (code) { - - /* This should always return ASCII, so we could instead - * legitimately panic here, but soldier on */ - case CODESET: - category = LC_CTYPE; - break; - - case RADIXCHAR: - case THOUSEP: -# ifdef USE_LOCALE_NUMERIC - category = LC_NUMERIC; -# else - /* Not ideal, but the best we can do on such a platform */ - category = LC_CTYPE; -# endif - break; - - case CRNCYSTR: -# ifdef USE_LOCALE_MONETARY - category = LC_MONETARY; -# else - category = LC_CTYPE; -# endif - break; - - default: -# ifdef USE_LOCALE_TIME - category = LC_TIME; -# else - category = LC_CTYPE; -# endif - break; - } - - /* Here the return is legal UTF-8. Turn on that flag if the - * locale is UTF-8. (Otherwise, could just be a coincidence.) - * */ - if (_is_cur_LC_category_utf8(category)) { - SvUTF8_on(RETVAL); - } - } -#endif /* USE_LOCALE_CTYPE */ + value = Perl_langinfo8(code, &is_utf8); + RETVAL = newSVpvn_utf8(value, strlen(value), is_utf8 == UTF8NESS_YES); } OUTPUT: diff --git a/gnu/usr.bin/perl/ext/NDBM_File/Makefile.PL b/gnu/usr.bin/perl/ext/NDBM_File/Makefile.PL index 539a377488f..fe2cb407f57 100644 --- a/gnu/usr.bin/perl/ext/NDBM_File/Makefile.PL +++ b/gnu/usr.bin/perl/ext/NDBM_File/Makefile.PL @@ -1,7 +1,7 @@ use ExtUtils::MakeMaker; WriteMakefile( NAME => 'NDBM_File', - #LIBS => ["-L/usr/local/lib -lndbm", "-ldbm -lucb"], + LIBS => ["-L/usr/local/lib -lndbm", "-ldbm -lucb"], XSPROTOARG => '-noprototypes', # XXX remove later? VERSION_FROM => 'NDBM_File.pm', ); diff --git a/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.pm b/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.pm index ead745da24b..316c92df0bd 100644 --- a/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.pm +++ b/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.pm @@ -7,7 +7,7 @@ require Tie::Hash; require XSLoader; our @ISA = qw(Tie::Hash); -our $VERSION = "1.15"; +our $VERSION = "1.16"; XSLoader::load(); diff --git a/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.xs b/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.xs index eed671a6fcc..243a618a36d 100644 --- a/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.xs +++ b/gnu/usr.bin/perl/ext/NDBM_File/NDBM_File.xs @@ -97,6 +97,12 @@ ndbm_FETCH(db, key) NDBM_File db datum_key key +#define ndbm_EXISTS(db,key) dbm_fetch(db->dbp,key).dptr +bool +ndbm_EXISTS(db, key) + NDBM_File db + datum_key key + #define ndbm_STORE(db,key,value,flags) dbm_store(db->dbp,key,value,flags) int ndbm_STORE(db, key, value, flags = DBM_REPLACE) diff --git a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm index 1b49440f3a0..874ccf0e4de 100644 --- a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm +++ b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm @@ -7,7 +7,7 @@ require Tie::Hash; require XSLoader; our @ISA = qw(Tie::Hash); -our $VERSION = "1.17"; +our $VERSION = "1.18"; XSLoader::load(); diff --git a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs index 38e6dbf446a..2675f7e9e33 100644 --- a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs +++ b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs @@ -28,13 +28,13 @@ datum nextkey(datum key); #ifdef DBM_BUG_DUPLICATE_FREE /* - * DBM on at least Ultrix and HPUX call dbmclose() from dbminit(), + * DBM on at least HPUX call dbmclose() from dbminit(), * resulting in duplicate free() because dbmclose() does *not* * check if it has already been called for this DBM. * If some malloc/free calls have been done between dbmclose() and * the next dbminit(), the memory might be used for something else when * it is freed. - * Verified to work on ultrix4.3. Probably will work on HP/UX. + * Probably will work on HP/UX. * Set DBM_BUG_DUPLICATE_FREE in the extension hint file. */ /* Close the previous dbm, and fail to open a new dbm */ diff --git a/gnu/usr.bin/perl/ext/ODBM_File/hints/ultrix.pl b/gnu/usr.bin/perl/ext/ODBM_File/hints/ultrix.pl deleted file mode 100644 index b9b99ab8b5b..00000000000 --- a/gnu/usr.bin/perl/ext/ODBM_File/hints/ultrix.pl +++ /dev/null @@ -1,4 +0,0 @@ -# Try to work around "bad free" messages. See note in ODBM_File.xs. -# Andy Dougherty <doughera@lafayette.edu> -# Sun Sep 8 12:57:52 EDT 1996 -$self->{CCFLAGS} = $Config{ccflags} . ' -DDBM_BUG_DUPLICATE_FREE' ; diff --git a/gnu/usr.bin/perl/ext/Opcode/Opcode.pm b/gnu/usr.bin/perl/ext/Opcode/Opcode.pm index 051fad78912..b4aead9e401 100644 --- a/gnu/usr.bin/perl/ext/Opcode/Opcode.pm +++ b/gnu/usr.bin/perl/ext/Opcode/Opcode.pm @@ -1,31 +1,21 @@ -package Opcode; - -use 5.006_001; +package Opcode 1.64; use strict; -our($VERSION, @ISA, @EXPORT_OK); - -$VERSION = "1.57"; - use Carp; use Exporter 'import'; use XSLoader; -BEGIN { - @EXPORT_OK = qw( +sub opset (;@); +sub opset_to_hex ($); +sub opdump (;$); +use subs our @EXPORT_OK = qw( opset ops_to_opset opset_to_ops opset_to_hex invert_opset empty_opset full_opset opdesc opcodes opmask define_optag opmask_add verify_opset opdump - ); -} - -sub opset (;@); -sub opset_to_hex ($); -sub opdump (;$); -use subs @EXPORT_OK; +); XSLoader::load(); @@ -312,10 +302,10 @@ invert_opset function. null stub scalar pushmark wantarray const defined undef - rv2sv sassign + rv2sv sassign padsv_store rv2av aassign aelem aelemfast aelemfast_lex aslice kvaslice - av2arylen + av2arylen aelemfastlex_store rv2hv helem hslice kvhslice each values keys exists delete aeach akeys avalues multideref argelem argdefelem argcheck @@ -342,10 +332,12 @@ invert_opset function. list lslice splice push pop shift unshift reverse cond_expr flip flop andassign orassign dorassign and or dor xor + helemexistsor warn die lineseq nextstate scope enter leave rv2cv anoncode prototype coreargs avhvswitch anonconst + emptyavhv entersub leavesub leavesublv return method method_named method_super method_redir method_redir_super @@ -359,6 +351,8 @@ invert_opset function. leaveeval -- needed for Safe to operate, is safe without entereval + methstart initfield + =item :base_mem These memory related ops are not included in :base_core because they @@ -451,6 +445,8 @@ These are a hotchpotch of opcodes still waiting to be considered ceil floor + is_tainted + =item :base_math These ops are not included in :base_core because of the risk of them being diff --git a/gnu/usr.bin/perl/ext/Opcode/Opcode.xs b/gnu/usr.bin/perl/ext/Opcode/Opcode.xs index 44a6d7c3543..bdd192f7633 100644 --- a/gnu/usr.bin/perl/ext/Opcode/Opcode.xs +++ b/gnu/usr.bin/perl/ext/Opcode/Opcode.xs @@ -12,7 +12,6 @@ typedef struct { HV * x_op_named_bits; /* cache shared for whole process */ SV * x_opset_all; /* mask with all bits set */ - IV x_opset_len; /* length of opmasks in bytes */ #ifdef OPCODE_DEBUG int x_opcode_debug; /* unused warn() emitting debugging code */ #endif @@ -20,9 +19,11 @@ typedef struct { START_MY_CXT +/* length of opmasks in bytes */ +static const STRLEN opset_len = (PL_maxo + 7) / 8; + #define op_named_bits (MY_CXT.x_op_named_bits) #define opset_all (MY_CXT.x_opset_all) -#define opset_len (MY_CXT.x_opset_len) #ifdef OPCODE_DEBUG # define opcode_debug (MY_CXT.x_opcode_debug) #else @@ -50,13 +51,13 @@ op_names_init(pTHX) { int i; STRLEN len; - char **op_names; + const char *const *op_names; U8 *bitmap; dMY_CXT; op_named_bits = newHV(); hv_ksplit(op_named_bits, PL_maxo); - op_names = get_op_names(); + op_names = PL_op_name; for(i=0; i < PL_maxo; ++i) { SV * const sv = newSViv(i); SvREADONLY_on(sv); @@ -128,7 +129,6 @@ static SV * new_opset(pTHX_ SV *old_opset) { SV *opset; - dMY_CXT; if (old_opset) { verify_opset(aTHX_ old_opset,1); @@ -149,11 +149,10 @@ static int verify_opset(pTHX_ SV *opset, int fatal) { const char *err = NULL; - dMY_CXT; if (!SvOK(opset)) err = "undefined"; else if (!SvPOK(opset)) err = "wrong type"; - else if (SvCUR(opset) != (STRLEN)opset_len) err = "wrong size"; + else if (SvCUR(opset) != opset_len) err = "wrong size"; if (err && fatal) { croak("Invalid opset: %s", err); } @@ -164,8 +163,6 @@ verify_opset(pTHX_ SV *opset, int fatal) static void set_opset_bits(pTHX_ char *bitmap, SV *bitspec, int on, const char *opname) { - dMY_CXT; - if (SvIOK(bitspec)) { const int myopcode = SvIV(bitspec); const int offset = myopcode >> 3; @@ -180,7 +177,7 @@ set_opset_bits(pTHX_ char *bitmap, SV *bitspec, int on, const char *opname) else bitmap[offset] &= ~(1 << bit); } - else if (SvPOK(bitspec) && SvCUR(bitspec) == (STRLEN)opset_len) { + else if (SvPOK(bitspec) && SvCUR(bitspec) == opset_len) { STRLEN len; const char * const specbits = SvPV(bitspec, len); @@ -200,11 +197,10 @@ set_opset_bits(pTHX_ char *bitmap, SV *bitspec, int on, const char *opname) static void opmask_add(pTHX_ SV *opset) /* THE ONLY FUNCTION TO EDIT PL_op_mask ITSELF */ { - int i,j; + int j; char *bitmask; STRLEN len; int myopcode = 0; - dMY_CXT; verify_opset(aTHX_ opset,1); /* croaks on bad opset */ @@ -214,7 +210,7 @@ opmask_add(pTHX_ SV *opset) /* THE ONLY FUNCTION TO EDIT PL_op_mask ITSELF */ /* OPCODES ALREADY MASKED ARE NEVER UNMASKED. See opmask_addlocal() */ bitmask = SvPV(opset, len); - for (i=0; i < opset_len; i++) { + for (STRLEN i=0; i < opset_len; i++) { const U16 bits = bitmask[i]; if (!bits) { /* optimise for sparse masks */ myopcode += 8; @@ -258,7 +254,6 @@ BOOT: { MY_CXT_INIT; STATIC_ASSERT_STMT(PL_maxo < OP_MASK_BUF_SIZE); - opset_len = (PL_maxo + 7) / 8; if (opcode_debug >= 1) warn("opset_len %ld\n", (long)opset_len); op_names_init(aTHX); @@ -353,7 +348,6 @@ invert_opset(opset) CODE: { char *bitmap; - dMY_CXT; STRLEN len = opset_len; opset = sv_2mortal(new_opset(aTHX_ opset)); /* verify and clone opset */ @@ -374,10 +368,10 @@ opset_to_ops(opset, desc = 0) PPCODE: { STRLEN len; - int i, j, myopcode; + STRLEN i; + int j, myopcode; const char * const bitmap = SvPV(opset, len); - char **names = (desc) ? get_op_descs() : get_op_names(); - dMY_CXT; + const char *const *names = (desc) ? PL_op_desc : PL_op_name; verify_opset(aTHX_ opset,1); for (myopcode=0, i=0; i < opset_len; i++) { @@ -467,8 +461,7 @@ PPCODE: int i; STRLEN len; SV **args; - char **op_desc = get_op_descs(); - dMY_CXT; + const char *const *op_desc = PL_op_desc; /* copy args to a scratch area since we may push output values onto */ /* the stack faster than we read values off it if masks are used. */ @@ -483,8 +476,9 @@ PPCODE: XPUSHs(newSVpvn_flags(op_desc[myopcode], strlen(op_desc[myopcode]), SVs_TEMP)); } - else if (SvPOK(bitspec) && SvCUR(bitspec) == (STRLEN)opset_len) { - int b, j; + else if (SvPOK(bitspec) && SvCUR(bitspec) == opset_len) { + STRLEN b; + int j; const char * const bitmap = SvPV_nolen_const(bitspec); int myopcode = 0; for (b=0; b < opset_len; b++) { diff --git a/gnu/usr.bin/perl/ext/POSIX/Makefile.PL b/gnu/usr.bin/perl/ext/POSIX/Makefile.PL index 462b8ede017..cc6011d7b86 100644 --- a/gnu/usr.bin/perl/ext/POSIX/Makefile.PL +++ b/gnu/usr.bin/perl/ext/POSIX/Makefile.PL @@ -51,7 +51,7 @@ my @names = EUSERS EWOULDBLOCK EXDEV FILENAME_MAX F_OK HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR INLCR INPCK INT_MAX INT_MIN ISIG ISTRIP IXOFF IXON LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT - LC_MESSAGES LC_MONETARY LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME + LC_MESSAGES LC_MONETARY LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_NAME LINK_MAX LONG_MAX LONG_MIN L_ctermid L_cuserid MAX_CANON MAX_INPUT MB_LEN_MAX MSG_CTRUNC MSG_DONTROUTE MSG_EOR MSG_OOB MSG_PEEK MSG_TRUNC MSG_WAITALL NAME_MAX NCCS NGROUPS_MAX NOFLSH OPEN_MAX OPOST diff --git a/gnu/usr.bin/perl/ext/POSIX/POSIX.xs b/gnu/usr.bin/perl/ext/POSIX/POSIX.xs index 0f004cbbcfd..90c8fcf50d4 100644 --- a/gnu/usr.bin/perl/ext/POSIX/POSIX.xs +++ b/gnu/usr.bin/perl/ext/POSIX/POSIX.xs @@ -1,6 +1,9 @@ #define PERL_EXT_POSIX #define PERL_EXT +#if defined(_WIN32) && defined(__GNUC__) /* mingw compiler */ +#define _POSIX_ +#endif #define PERL_NO_GET_CONTEXT #include "EXTERN.h" @@ -1018,7 +1021,7 @@ static NV my_log2(NV x) /* XXX nexttoward */ /* GCC's FLT_ROUNDS is (wrongly) hardcoded to 1 (at least up to 11.x) */ -#if defined(PERL_IS_GCC) /* && __GNUC__ < XXX */ +#if defined(PERL_IS_GCC) /* && __GNUC__ < XXX */ || (defined(__clang__) && defined(__s390x__)) # define BROKEN_FLT_ROUNDS #endif @@ -1341,9 +1344,6 @@ static NV_PAYLOAD_TYPE S_getpayload(NV nv) #include <termios.h> #endif #include <stdlib.h> -#ifndef __ultrix__ -#include <string.h> -#endif #include <sys/stat.h> #include <sys/types.h> #include <time.h> @@ -1560,77 +1560,6 @@ END_EXTERN_C #endif #endif -#if ! defined(HAS_LOCALECONV) && ! defined(HAS_LOCALECONV_L) -# define localeconv() not_here("localeconv") -#else -struct lconv_offset { - const char *name; - size_t offset; -}; - -static const struct lconv_offset lconv_strings[] = { -#ifdef USE_LOCALE_NUMERIC - {"decimal_point", STRUCT_OFFSET(struct lconv, decimal_point)}, - {"thousands_sep", STRUCT_OFFSET(struct lconv, thousands_sep)}, -# ifndef NO_LOCALECONV_GROUPING - {"grouping", STRUCT_OFFSET(struct lconv, grouping)}, -# endif -#endif -#ifdef USE_LOCALE_MONETARY - {"int_curr_symbol", STRUCT_OFFSET(struct lconv, int_curr_symbol)}, - {"currency_symbol", STRUCT_OFFSET(struct lconv, currency_symbol)}, - {"mon_decimal_point", STRUCT_OFFSET(struct lconv, mon_decimal_point)}, -# ifndef NO_LOCALECONV_MON_THOUSANDS_SEP - {"mon_thousands_sep", STRUCT_OFFSET(struct lconv, mon_thousands_sep)}, -# endif -# ifndef NO_LOCALECONV_MON_GROUPING - {"mon_grouping", STRUCT_OFFSET(struct lconv, mon_grouping)}, -# endif - {"positive_sign", STRUCT_OFFSET(struct lconv, positive_sign)}, - {"negative_sign", STRUCT_OFFSET(struct lconv, negative_sign)}, -#endif - {NULL, 0} -}; - -#ifdef USE_LOCALE_NUMERIC - -/* The Linux man pages say these are the field names for the structure - * components that are LC_NUMERIC; the rest being LC_MONETARY */ -# define isLC_NUMERIC_STRING(name) ( strEQ(name, "decimal_point") \ - || strEQ(name, "thousands_sep") \ - \ - /* There should be no harm done \ - * checking for this, even if \ - * NO_LOCALECONV_GROUPING */ \ - || strEQ(name, "grouping")) -#else -# define isLC_NUMERIC_STRING(name) (0) -#endif - -static const struct lconv_offset lconv_integers[] = { -#ifdef USE_LOCALE_MONETARY - {"int_frac_digits", STRUCT_OFFSET(struct lconv, int_frac_digits)}, - {"frac_digits", STRUCT_OFFSET(struct lconv, frac_digits)}, - {"p_cs_precedes", STRUCT_OFFSET(struct lconv, p_cs_precedes)}, - {"p_sep_by_space", STRUCT_OFFSET(struct lconv, p_sep_by_space)}, - {"n_cs_precedes", STRUCT_OFFSET(struct lconv, n_cs_precedes)}, - {"n_sep_by_space", STRUCT_OFFSET(struct lconv, n_sep_by_space)}, - {"p_sign_posn", STRUCT_OFFSET(struct lconv, p_sign_posn)}, - {"n_sign_posn", STRUCT_OFFSET(struct lconv, n_sign_posn)}, -#ifdef HAS_LC_MONETARY_2008 - {"int_p_cs_precedes", STRUCT_OFFSET(struct lconv, int_p_cs_precedes)}, - {"int_p_sep_by_space", STRUCT_OFFSET(struct lconv, int_p_sep_by_space)}, - {"int_n_cs_precedes", STRUCT_OFFSET(struct lconv, int_n_cs_precedes)}, - {"int_n_sep_by_space", STRUCT_OFFSET(struct lconv, int_n_sep_by_space)}, - {"int_p_sign_posn", STRUCT_OFFSET(struct lconv, int_p_sign_posn)}, - {"int_n_sign_posn", STRUCT_OFFSET(struct lconv, int_n_sign_posn)}, -#endif -#endif - {NULL, 0} -}; - -#endif /* HAS_LOCALECONV */ - #ifdef HAS_LONG_DOUBLE # if LONG_DOUBLESIZE > NVSIZE # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */ @@ -1819,7 +1748,12 @@ my_tzset(pTHX) #endif fix_win32_tzenv(); #endif + TZSET_LOCK; tzset(); + TZSET_UNLOCK; + /* After the unlock, another thread could change things, but this is a + * problem with the Posix API generally, not Perl; and the result will be + * self-consistent */ } MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig @@ -2124,138 +2058,10 @@ HV * localeconv() CODE: #ifndef HAS_LOCALECONV - localeconv(); /* A stub to call not_here(). */ -#else - struct lconv *lcbuf; -# if defined(USE_ITHREADS) \ - && defined(HAS_POSIX_2008_LOCALE) \ - && defined(HAS_LOCALECONV_L) /* Prefer this thread-safe version */ - bool do_free = FALSE; - locale_t cur = NULL; -# elif defined(TS_W32_BROKEN_LOCALECONV) - const char * save_global; - const char * save_thread; -# endif - DECLARATION_FOR_LC_NUMERIC_MANIPULATION; - - /* localeconv() deals with both LC_NUMERIC and LC_MONETARY, but - * LC_MONETARY is already in the correct locale */ -# ifdef USE_LOCALE_MONETARY - - const bool is_monetary_utf8 = _is_cur_LC_category_utf8(LC_MONETARY); -# endif -# ifdef USE_LOCALE_NUMERIC - - bool is_numeric_utf8; - - STORE_LC_NUMERIC_FORCE_TO_UNDERLYING(); - - is_numeric_utf8 = _is_cur_LC_category_utf8(LC_NUMERIC); -# endif - - RETVAL = newHV(); - sv_2mortal((SV*)RETVAL); -# if defined(USE_ITHREADS) \ - && defined(HAS_POSIX_2008_LOCALE) \ - && defined(HAS_LOCALECONV_L) - - cur = uselocale((locale_t) 0); - if (cur == LC_GLOBAL_LOCALE) { - cur = duplocale(LC_GLOBAL_LOCALE); - do_free = TRUE; - } - - lcbuf = localeconv_l(cur); -# else - LOCALECONV_LOCK; /* Prevent interference with other threads using - localeconv() */ -# ifdef TS_W32_BROKEN_LOCALECONV - /* This is a workaround for a Windows bug prior to VS 15, in which - * localeconv only looks at the global locale. We toggle to the global - * locale; populate the return; then toggle back. We have to use - * LC_ALL instead of the individual ones because of another bug in - * Windows */ - - save_thread = savepv(Perl_setlocale(LC_NUMERIC, NULL)); - - _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); - - save_global = savepv(Perl_setlocale(LC_ALL, NULL)); - - Perl_setlocale(LC_ALL, save_thread); -# endif - lcbuf = localeconv(); -# endif - if (lcbuf) { - const struct lconv_offset *strings = lconv_strings; - const struct lconv_offset *integers = lconv_integers; - const char *ptr = (const char *) lcbuf; - - while (strings->name) { - /* This string may be controlled by either LC_NUMERIC, or - * LC_MONETARY */ - const bool is_utf8_locale = -# if defined(USE_LOCALE_NUMERIC) && defined(USE_LOCALE_MONETARY) - (isLC_NUMERIC_STRING(strings->name)) - ? is_numeric_utf8 - : is_monetary_utf8; -# elif defined(USE_LOCALE_NUMERIC) - is_numeric_utf8; -# elif defined(USE_LOCALE_MONETARY) - is_monetary_utf8; -# else - FALSE; -# endif - - const char *value = *((const char **)(ptr + strings->offset)); - - if (value && *value) { - const STRLEN value_len = strlen(value); - - /* We mark it as UTF-8 if a utf8 locale and is valid and - * variant under UTF-8 */ - const bool is_utf8 = is_utf8_locale - && is_utf8_non_invariant_string( - (U8*) value, - value_len); - (void) hv_store(RETVAL, - strings->name, - strlen(strings->name), - newSVpvn_utf8(value, value_len, is_utf8), - 0); - } - strings++; - } - - while (integers->name) { - const char value = *((const char *)(ptr + integers->offset)); - - if (value != CHAR_MAX) - (void) hv_store(RETVAL, integers->name, - strlen(integers->name), newSViv(value), 0); - integers++; - } - } -# if defined(USE_ITHREADS) \ - && defined(HAS_POSIX_2008_LOCALE) \ - && defined(HAS_LOCALECONV_L) - if (do_free) { - freelocale(cur); - } -# else -# ifdef TS_W32_BROKEN_LOCALECONV - Perl_setlocale(LC_ALL, save_global); - - _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); - - Perl_setlocale(LC_ALL, save_thread); - - Safefree(save_global); - Safefree(save_thread); -# endif - LOCALECONV_UNLOCK; -# endif - RESTORE_LC_NUMERIC(); + RETVAL = NULL; + not_here("localeconv"); +#else + RETVAL = Perl_localeconv(aTHX); #endif /* HAS_LOCALECONV */ OUTPUT: RETVAL @@ -3383,9 +3189,9 @@ mblen(s, n = ~0) memzero(&PL_mbrlen_ps, sizeof(PL_mbrlen_ps)); RETVAL = 0; #else - MBLEN_LOCK; + MBLEN_LOCK_; RETVAL = mblen(NULL, 0); - MBLEN_UNLOCK; + MBLEN_UNLOCK_; #endif } else { /* Not resetting state */ @@ -3396,51 +3202,45 @@ mblen(s, n = ~0) } else { size_t len; - char * string = SvPV(byte_s, len); + char * string = SvPVbyte(byte_s, len); if (n < len) len = n; #ifdef USE_MBRLEN + MBRLEN_LOCK_; RETVAL = (SSize_t) mbrlen(string, len, &PL_mbrlen_ps); + MBRLEN_UNLOCK_; if (RETVAL < 0) RETVAL = -1; /* Use mblen() ret code for transparency */ #else /* Locking prevents races, but locales can be switched out * without locking, so this isn't a cure all */ - MBLEN_LOCK; + MBLEN_LOCK_; RETVAL = mblen(string, len); - MBLEN_UNLOCK; + MBLEN_UNLOCK_; #endif } } OUTPUT: RETVAL -#if defined(HAS_MBRTOWC) && (defined(USE_ITHREADS) || ! defined(HAS_MBTOWC)) -# define USE_MBRTOWC -#else -# undef USE_MBRTOWC -#endif - int mbtowc(pwc, s, n = ~0) SV * pwc SV * s size_t n CODE: + RETVAL = -1; +#if ! defined(HAS_MBTOWC) && ! defined(HAS_MBRTOWC) + PERL_UNUSED_ARG(pwc); + PERL_UNUSED_ARG(s); + PERL_UNUSED_ARG(n); +#else errno = 0; SvGETMAGIC(s); if (! SvOK(s)) { /* Initialize state */ -#ifdef USE_MBRTOWC - /* Initialize the shift state to all zeros in PL_mbrtowc_ps. */ - memzero(&PL_mbrtowc_ps, sizeof(PL_mbrtowc_ps)); - RETVAL = 0; -#else - MBTOWC_LOCK; - RETVAL = mbtowc(NULL, NULL, 0); - MBTOWC_UNLOCK; -#endif + mbtowc_(NULL, NULL, 0); } else { /* Not resetting state */ - wchar_t wc; + wchar_t wc = 0; SV * byte_s = sv_2mortal(newSVsv_nomg(s)); if (! sv_utf8_downgrade_nomg(byte_s, TRUE)) { SETERRNO(EINVAL, LIB_INVARG); @@ -3448,17 +3248,9 @@ mbtowc(pwc, s, n = ~0) } else { size_t len; - char * string = SvPV(byte_s, len); + char * string = SvPVbyte(byte_s, len); if (n < len) len = n; -#ifdef USE_MBRTOWC - RETVAL = (SSize_t) mbrtowc(&wc, string, len, &PL_mbrtowc_ps); -#else - /* Locking prevents races, but locales can be switched out - * without locking, so this isn't a cure all */ - MBTOWC_LOCK; - RETVAL = mbtowc(&wc, string, len); - MBTOWC_UNLOCK; -#endif + RETVAL = mbtowc_(&wc, string, len); if (RETVAL >= 0) { sv_setiv_mg(pwc, wc); } @@ -3467,6 +3259,7 @@ mbtowc(pwc, s, n = ~0) } } } +#endif OUTPUT: RETVAL @@ -3487,23 +3280,27 @@ wctomb(s, wchar) #ifdef USE_WCRTOMB /* The man pages khw looked at are in agreement that this works. * But probably memzero would too */ + WCRTOMB_LOCK_; RETVAL = wcrtomb(NULL, L'\0', &PL_wcrtomb_ps); + WCRTOMB_UNLOCK_; #else - WCTOMB_LOCK; + WCTOMB_LOCK_; RETVAL = wctomb(NULL, L'\0'); - WCTOMB_UNLOCK; + WCTOMB_UNLOCK_; #endif } else { /* Not resetting state */ char buffer[MB_LEN_MAX]; #ifdef USE_WCRTOMB + WCRTOMB_LOCK_; RETVAL = wcrtomb(buffer, wchar, &PL_wcrtomb_ps); + WCRTOMB_UNLOCK_; #else /* Locking prevents races, but locales can be switched out without * locking, so this isn't a cure all */ - WCTOMB_LOCK; + WCTOMB_LOCK_; RETVAL = wctomb(buffer, wchar); - WCTOMB_UNLOCK; + WCTOMB_UNLOCK_; #endif if (RETVAL >= 0) { sv_setpvn_mg(s, buffer, RETVAL); @@ -3516,6 +3313,12 @@ int strcoll(s1, s2) char * s1 char * s2 + CODE: + LC_COLLATE_LOCK; + RETVAL = strcoll(s1, s2); + LC_COLLATE_UNLOCK; + OUTPUT: + RETVAL void strtod(str) @@ -3631,24 +3434,11 @@ void strxfrm(src) SV * src CODE: - { - STRLEN srclen; - STRLEN dstlen; - STRLEN buflen; - char *p = SvPV(src,srclen); - srclen++; - buflen = srclen * 4 + 1; - ST(0) = sv_2mortal(newSV(buflen)); - dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)buflen); - if (dstlen >= buflen) { - dstlen++; - SvGROW(ST(0), dstlen); - strxfrm(SvPVX(ST(0)), p, (size_t)dstlen); - dstlen--; - } - SvCUR_set(ST(0), dstlen); - SvPOK_only(ST(0)); - } +#ifdef USE_LOCALE_COLLATE + ST(0) = Perl_strxfrm(aTHX_ src); +#else + ST(0) = src; +#endif SysRet mkfifo(filename, mode) @@ -3730,7 +3520,10 @@ asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1) mytm.tm_yday = yday; mytm.tm_isdst = isdst; if (ix) { - const time_t result = mktime(&mytm); + time_t result; + MKTIME_LOCK; + result = mktime(&mytm); + MKTIME_UNLOCK; if (result == (time_t)-1) SvOK_off(TARG); else if (result == 0) @@ -3738,7 +3531,9 @@ asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1) else sv_setiv(TARG, (IV)result); } else { + ASCTIME_LOCK; sv_setpv(TARG, asctime(&mytm)); + ASCTIME_UNLOCK; } ST(0) = TARG; XSRETURN(1); @@ -3788,29 +3583,19 @@ strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) { char *buf; SV *sv; + utf8ness_t is_utf8; /* allowing user-supplied (rather than literal) formats * is normally frowned upon as a potential security risk; * but this is part of the API so we have to allow it */ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); - buf = my_strftime(SvPV_nolen(fmt), sec, min, hour, mday, mon, year, wday, yday, isdst); + buf = my_strftime8_temp(SvPV_nolen(fmt), sec, min, hour, mday, mon, year, wday, yday, isdst, &is_utf8); GCC_DIAG_RESTORE_STMT; sv = sv_newmortal(); if (buf) { STRLEN len = strlen(buf); sv_usepvn_flags(sv, buf, len, SV_HAS_TRAILING_NUL); - if ( SvUTF8(fmt) - || ( is_utf8_non_invariant_string((U8*) buf, len) -#ifdef USE_LOCALE_TIME - && _is_cur_LC_category_utf8(LC_TIME) -#else /* If can't check directly, at least can see if script is consistent, - under UTF-8, which gives us an extra measure of confidence. */ - - && isSCRIPT_RUN((const U8 *) buf, - (const U8 *) buf + len, - TRUE) /* Means assume UTF-8 */ -#endif - )) { + if (SvUTF8(fmt) || is_utf8 == UTF8NESS_YES) { SvUTF8_on(sv); } } @@ -3835,8 +3620,12 @@ void tzname() PPCODE: EXTEND(SP,2); + /* It is undefined behavior if another thread is changing this while + * its being read */ + ENVr_LOCALEr_LOCK; PUSHs(newSVpvn_flags(tzname[0], strlen(tzname[0]), SVs_TEMP)); PUSHs(newSVpvn_flags(tzname[1], strlen(tzname[1]), SVs_TEMP)); + ENVr_LOCALEr_UNLOCK; char * ctermid(s = 0) diff --git a/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pm b/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pm index b8a6257944f..48b224a36ec 100644 --- a/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pm +++ b/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pm @@ -4,7 +4,7 @@ use warnings; our ($AUTOLOAD, %SIGRT); -our $VERSION = '2.03'; +our $VERSION = '2.13'; require XSLoader; @@ -12,7 +12,7 @@ use Fcntl qw(FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_RDLCK F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC O_WRONLY SEEK_CUR SEEK_END SEEK_SET - S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG + S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISLNK S_ISREG S_ISSOCK S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR); @@ -278,7 +278,7 @@ my %default_export_tags = ( # cf. exports policy below creat SEEK_CUR SEEK_END SEEK_SET S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU - S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG S_ISUID + S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISLNK S_ISREG S_ISSOCK S_ISUID S_IWGRP S_IWOTH S_IWUSR)], float_h => [qw(DBL_DIG DBL_EPSILON DBL_MANT_DIG @@ -307,7 +307,7 @@ my %default_export_tags = ( # cf. exports policy below locale_h => [qw(LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LC_IDENTIFICATION - LC_MEASUREMENT LC_PAPER LC_TELEPHONE LC_ADDRESS + LC_MEASUREMENT LC_PAPER LC_TELEPHONE LC_ADDRESS LC_NAME LC_SYNTAX LC_TOD NULL localeconv setlocale)], @@ -357,7 +357,7 @@ my %default_export_tags = ( # cf. exports policy below strtok strxfrm)], sys_stat_h => [qw(S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU - S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG + S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISLNK S_ISREG S_ISSOCK S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR fstat mkfifo)], diff --git a/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pod b/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pod index 75113b1e47b..d3720da9b50 100644 --- a/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pod +++ b/gnu/usr.bin/perl/ext/POSIX/lib/POSIX.pod @@ -10,9 +10,9 @@ POSIX - Perl interface to IEEE Std 1003.1 printf "EINTR is %d\n", EINTR; - $sess_id = POSIX::setsid(); + my $sess_id = POSIX::setsid(); - $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644); + my $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644); # note: that's a filedescriptor, *NOT* a filehandle =head1 DESCRIPTION @@ -501,7 +501,7 @@ than the explicit two operations [C99]. Added in Perl v5.22. Maximum of C<x> and C<y>, except when either is C<NaN>, returns the other [C99]. Added in Perl v5.22. - my $min = POSIX::fmax($x, $y); + my $max = POSIX::fmax($x, $y); =item C<fmin> @@ -1015,6 +1015,18 @@ Here is how to query the database for the B<de> (Deutsch or German) locale. The members whose names begin with C<int_p_> and C<int_n_> were added by POSIX.1-2008 and are only available on systems that support them. +A value of -1 returned for numeric entries indicates that the field is +not applicable to the locale. This is rare except in the C and related +locales, which don't have most monetary values defined. It can also +happen, quirkily, in fields that are otherwise boolean to indicate that +the value is kind of neither true nor false. This happens in C<p_cs_precedes> +and C<int_p_cs_precedes> when the currency symbol neither precedes nor +succeeds a positive value but is infixed, by replacing the radix +character. + +Prior to Perl v5.37.7, empty string fields and numeric fields with value +-1 were omittted from the returned hash. + =item C<localtime> This is identical to Perl's builtin C<localtime()> function for @@ -1134,9 +1146,10 @@ parameter is stored. The optional third parameter is ignored if it is larger than the actual length of the second parameter string. Use C<undef> as the second parameter to this function to get the effect -of passing NULL as the second parameter to C<mbtowc>. This resets any -shift state to its initial value. The return value is undefined if -C<mbrtowc> was substituted, so you should never rely on it. +of passing NULL as the second parameter to C<mbtowc>. This ignores the +first parameter, and resets any shift state to its initial value. The +return value is undefined if C<mbrtowc> was substituted, so you should +never rely on it. When the second parameter is a scalar containing a value that either is a PV string or can be forced into one, the return value is the number of @@ -1827,7 +1840,7 @@ about these and the other arguments. If you want your code to be portable, your format (C<fmt>) argument should use only the conversion specifiers defined by the ANSI C -standard (C89, to play safe). These are C<aAbBcdHIjmMpSUwWxXyYZ%>. +standard (C99, to play safe). These are C<aAbBcdHIjmMpSUwWxXyYZ%>. But even then, the B<results> of some of the conversion specifiers are non-portable. For example, the specifiers C<aAbBcpZ> change according to the locale settings of the user, and both how to set locales (the @@ -1972,9 +1985,14 @@ Used with C<eq> or C<cmp> as an alternative to C<L</strcoll>>. Not really needed since Perl can do this transparently, see L<perllocale>. -Beware that in a UTF-8 locale, anything you pass to this function must -be in UTF-8; and when not in a UTF-8 locale, anything passed must not be -UTF-8 encoded. +Unlike the libc C<strxfrm>, this allows NUL characters in the input +C<$src>. + +It doesn't make sense for a string to be encoded in one locale (say, +ISO-8859-6, Arabic) and to collate it based on another (like ISO-8859-7, +Greek). Perl assumes that the current C<LC_CTYPE> locale correctly +represents the encoding of C<$src>, and ignores the value of +C<LC_COLLATE>. =item C<sysconf> @@ -2197,9 +2215,10 @@ L</mblen> and L</mbtowc> may be used to roll your own decoding/encoding of other types of multi-byte locales. Use C<undef> as the first parameter to this function to get the effect -of passing NULL as the first parameter to C<wctomb>. This resets any -shift state to its initial value. The return value is undefined if -C<wcrtomb> was substituted, so you should never rely on it. +of passing NULL as the first parameter to C<wctomb>. This ignores the +second parameter, and resets any shift state to its initial value. The +return value is undefined if C<wcrtomb> was substituted, so you should +never rely on it. When the first parameter is a scalar, the code point contained in the scalar second parameter is converted into a multi-byte string and stored @@ -2740,7 +2759,7 @@ C<S_IWUSR> C<S_IXGRP> C<S_IXOTH> C<S_IXUSR> =item Macros -C<S_ISBLK> C<S_ISCHR> C<S_ISDIR> C<S_ISFIFO> C<S_ISREG> +C<S_ISBLK> C<S_ISCHR> C<S_ISDIR> C<S_ISFIFO> C<S_ISLNK> C<S_ISREG> C<S_ISSOCK> =back diff --git a/gnu/usr.bin/perl/ext/POSIX/t/export.t b/gnu/usr.bin/perl/ext/POSIX/t/export.t index 12eac2d2113..1f9ff7b0421 100644 --- a/gnu/usr.bin/perl/ext/POSIX/t/export.t +++ b/gnu/usr.bin/perl/ext/POSIX/t/export.t @@ -48,7 +48,7 @@ my %expect = ( INT_MAX INT_MIN ISIG ISTRIP IXOFF IXON LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NUMERIC LC_PAPER - LC_TELEPHONE LC_TIME LC_SYNTAX LC_TOD LDBL_DIG + LC_TELEPHONE LC_TIME LC_NAME LC_SYNTAX LC_TOD LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP LINK_MAX LONG_MAX LONG_MIN L_ctermid L_cuserid MAX_CANON @@ -66,7 +66,7 @@ my %expect = ( SIG_IGN SIG_SETMASK SIG_UNBLOCK SSIZE_MAX STDERR_FILENO STDIN_FILENO STDOUT_FILENO STREAM_MAX S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISBLK S_ISCHR S_ISDIR S_ISFIFO - S_ISGID S_ISREG S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP + S_ISGID S_ISLNK S_ISREG S_ISSOCK S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR TCIFLUSH TCIOFF TCIOFLUSH TCION TCOFLUSH TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW TMP_MAX TOSTOP TZNAME_MAX UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX VEOF VEOL diff --git a/gnu/usr.bin/perl/ext/POSIX/t/posix.t b/gnu/usr.bin/perl/ext/POSIX/t/posix.t index f200a895bde..117fa5e138d 100644 --- a/gnu/usr.bin/perl/ext/POSIX/t/posix.t +++ b/gnu/usr.bin/perl/ext/POSIX/t/posix.t @@ -373,10 +373,9 @@ SKIP: { currency_symbol mon_decimal_point mon_thousands_sep mon_grouping positive_sign negative_sign)) { SKIP: { - skip("localeconv has no result for $_", 1) - unless exists $conv->{$_}; - unlike(delete $conv->{$_}, qr/\A\z/, - "localeconv returned a non-empty string for $_"); + my $value = delete $conv->{$_}; + skip("localeconv '$_' may be empty", 1) if $_ ne 'decimal_point'; + isnt($value, "", "localeconv returned a non-empty string for $_"); } } @@ -399,8 +398,6 @@ SKIP: { foreach (@lconv) { SKIP: { - skip("localeconv has no result for $_", 1) - unless exists $conv->{$_}; like(delete $conv->{$_}, qr/\A-?\d+\z/, "localeconv returned an integer for $_"); } diff --git a/gnu/usr.bin/perl/ext/Pod-Functions/t/Functions.t b/gnu/usr.bin/perl/ext/Pod-Functions/t/Functions.t index 959bff45a74..089569d44bf 100644 --- a/gnu/usr.bin/perl/ext/Pod-Functions/t/Functions.t +++ b/gnu/usr.bin/perl/ext/Pod-Functions/t/Functions.t @@ -115,10 +115,11 @@ Functions for filehandles, files, or directories: Keywords related to the control flow of your Perl program: __FILE__, __LINE__, __PACKAGE__, __SUB__, break, caller, continue, die, do, dump, eval, evalbytes, exit, goto, - last, next, redo, return, sub, wantarray + last, method, next, redo, return, sub, wantarray Keywords related to scoping: - caller, import, local, my, our, package, state, use + caller, class, field, import, local, my, our, package, + state, use Miscellaneous functions: defined, formline, lock, prototype, reset, scalar, undef @@ -132,8 +133,8 @@ Keywords related to Perl modules: do, import, no, package, require, use Keywords related to classes and object-orientation: - bless, dbmclose, dbmopen, package, ref, tie, tied, untie, - use + bless, class, dbmclose, dbmopen, field, method, package, + ref, tie, tied, untie, use Low-level socket functions: accept, bind, connect, getpeername, getsockname, diff --git a/gnu/usr.bin/perl/ext/Pod-Html/bin/pod2html b/gnu/usr.bin/perl/ext/Pod-Html/bin/pod2html index 7d1d23268b9..e93b102e2af 100644 --- a/gnu/usr.bin/perl/ext/Pod-Html/bin/pod2html +++ b/gnu/usr.bin/perl/ext/Pod-Html/bin/pod2html @@ -25,6 +25,43 @@ pod2html takes the following arguments: =over 4 +=item backlink + + --backlink + --nobacklink + +Turn =head1 directives into links pointing to the top of the HTML file. +--nobacklink (which is the default behavior) does not create these backlinks. + +=item cachedir + + --cachedir=name + +Specify which directory is used for storing cache. Default directory is the +current working directory. + +=item css + + --css=URL + +Specify the URL of cascading style sheet to link from resulting HTML file. +Default is none style sheet. + +=item flush + + --flush + +Flush the cache. + +=item header + + --header + --noheader + +Create header and footer blocks containing the text of the "NAME" section. +--noheader -- which is the default behavior -- does not create header or footer +blocks. + =item help --help @@ -53,6 +90,22 @@ Do not use this if relative links are desired: use --htmldir instead. Do not pass both this and --htmldir to pod2html; they are mutually exclusive. +=item index + + --index + +Generate an index at the top of the HTML file (default behaviour). + +=over 4 + +=item noindex + + --noindex + +Do not generate an index at the top of the HTML file. + +=back + =item infile --infile=name @@ -67,11 +120,14 @@ infile is specified. Specify the HTML file to create. Output goes to STDOUT if no outfile is specified. -=item podroot +=item poderrors - --podroot=name + --poderrors + --nopoderrors -Specify the base directory for finding library pods. +Include a "POD ERRORS" section in the outfile if there were any POD errors in +the infile (default behaviour). --nopoderrors does not create this "POD +ERRORS" section. =item podpath @@ -80,90 +136,28 @@ Specify the base directory for finding library pods. Specify which subdirectories of the podroot contain pod files whose HTML converted forms can be linked-to in cross-references. -=item cachedir - - --cachedir=name - -Specify which directory is used for storing cache. Default directory is the -current working directory. - -=item flush - - --flush - -Flush the cache. - -=item backlink - - --backlink - -Turn =head1 directives into links pointing to the top of the HTML file. - -=item nobacklink - - --nobacklink - -Do not turn =head1 directives into links pointing to the top of the HTML file -(default behaviour). - -=item header - - --header - -Create header and footer blocks containing the text of the "NAME" section. - -=item noheader - - --noheader - -Do not create header and footer blocks containing the text of the "NAME" -section (default behaviour). - -=item poderrors - - --poderrors - -Include a "POD ERRORS" section in the outfile if there were any POD errors in -the infile (default behaviour). - -=item nopoderrors - - --nopoderrors - -Do not include a "POD ERRORS" section in the outfile if there were any POD -errors in the infile. - -=item index - - --index +=item podroot -Generate an index at the top of the HTML file (default behaviour). + --podroot=name -=item noindex +Specify the base directory for finding library pods. - --noindex +=item quiet -Do not generate an index at the top of the HTML file. + --quiet + --noquiet +Don't display mostly harmless warning messages. --noquiet -- which is the +default behavior -- I<does> display these mostly harmless warning messages (but +this is not the same as "verbose" mode). =item recurse --recurse - -Recurse into subdirectories specified in podpath (default behaviour). - -=item norecurse - --norecurse -Do not recurse into subdirectories specified in podpath. - -=item css - - --css=URL - -Specify the URL of cascading style sheet to link from resulting HTML file. -Default is none style sheet. +Recurse into subdirectories specified in podpath (default behaviour). +--norecurse does not recurse into these subdirectories. =item title @@ -171,30 +165,13 @@ Default is none style sheet. Specify the title of the resulting HTML file. -=item quiet - - --quiet - -Don't display mostly harmless warning messages. - -=item noquiet - - --noquiet - -Display mostly harmless warning messages (default behaviour). But this is not -the same as "verbose" mode. - =item verbose --verbose - -Display progress messages. - -=item noverbose - --noverbose -Do not display progress messages (default behaviour). +Display progress messages. --noverbose -- which is the default behavior -- +does not display these progress messages. =back diff --git a/gnu/usr.bin/perl/ext/Pod-Html/lib/Pod/Html.pm b/gnu/usr.bin/perl/ext/Pod-Html/lib/Pod/Html.pm index a9b0d5e77c3..7c568f9e913 100644 --- a/gnu/usr.bin/perl/ext/Pod-Html/lib/Pod/Html.pm +++ b/gnu/usr.bin/perl/ext/Pod-Html/lib/Pod/Html.pm @@ -2,10 +2,9 @@ package Pod::Html; use strict; use Exporter 'import'; -our $VERSION = 1.33; +our $VERSION = 1.34; $VERSION = eval $VERSION; -our @EXPORT = qw(pod2html htmlify); -our @EXPORT_OK = qw(anchorify relativize_url); +our @EXPORT = qw(pod2html); use Config; use Cwd; @@ -195,7 +194,7 @@ Display progress messages. By default, they won't be displayed. =back -=head2 Auxiliary Functions +=head2 Formerly Exported Auxiliary Functions Prior to perl-5.36, the following three functions were exported by F<Pod::Html>, either by default or on request: @@ -213,10 +212,8 @@ F<Pod::Html>, either by default or on request: The definition and documentation of these functions have been moved to F<Pod::Html::Util>, viewable via C<perldoc Pod::Html::Util>. -In perl-5.36, these functions will be importable from either F<Pod::Html> or -F<Pod::Html::Util>. However, beginning with perl-5.38 they will only be -importable, upon request, from F<Pod::Html::Util>. Please modify your code as -needed. +Beginning with perl-5.38 these functions must be explicitly imported from +F<Pod::Html::Util>. Please modify your code as needed. =head1 ENVIRONMENT diff --git a/gnu/usr.bin/perl/ext/Pod-Html/t/anchorify-536.t b/gnu/usr.bin/perl/ext/Pod-Html/t/anchorify-536.t deleted file mode 100644 index e8e01ea9c54..00000000000 --- a/gnu/usr.bin/perl/ext/Pod-Html/t/anchorify-536.t +++ /dev/null @@ -1,114 +0,0 @@ -use strict; -use warnings; -use Pod::Html qw( anchorify relativize_url ); -my ($revision,$version,$subversion) = split /\./, sprintf("%vd",$^V); -use Test::More; -unless ($version == 35 or $version == 36) { - plan skip_all => "Needed only during 5.36"; -} - -my @filedata; -{ - local $/ = ''; - @filedata = <DATA>; -} - -my (@poddata, $i, $j); -for ($i = 0, $j = -1; $i <= $#filedata; $i++) { - $j++ if ($filedata[$i] =~ /^\s*=head[1-6]/); - if ($j >= 0) { - $poddata[$j] = "" unless defined $poddata[$j]; - $poddata[$j] .= "\n$filedata[$i]" if $j >= 0; - } -} - -my %heads = (); -foreach $i (0..$#poddata) { - $heads{anchorify($1)} = 1 if $poddata[$i] =~ /=head[1-6]\s+(.*)/; -} -my %expected = map { $_ => 1 } qw( - NAME - DESCRIPTION - Subroutine - Error - Method - Has_A_Wordspace - HasTrailingWordspace - HasLeadingWordspace - Has_Extra_InternalWordspace - Has_Quotes - Has_QuestionMark - Has_Hyphen_And_Space -); -is_deeply( - \%heads, - \%expected, - "Got expected POD heads" -); - -{ - # adapted from 'installhtml' - my $file = '/home/username/tmp/installhtml/pod/perlipc'; - my $capture = 'NAME'; - my $expected_url = '/home/username/tmp/installhtml/pod/perlipc/NAME.html'; - my $expected_relativized_url = 'perlipc/NAME.html'; - my $url = "$file/@{[anchorify(qq($capture))]}.html" ; - is($url, $expected_url, "anchorify() returned expected value"); - my $relativized_url = relativize_url( $url, "$file.html" ); - is($relativized_url, $expected_relativized_url, "relativize_url() returned expected value"); -} - -done_testing; - -__DATA__ -=head1 NAME - -anchorify - Test C<Pod::Html::Util::anchorify()> - -=head1 DESCRIPTION - -alpha - -=head2 Subroutine - -beta - -=head3 Error - -gamma - -=head4 Method - -delta - -=head4 Has A Wordspace - -delta - -=head4 HasTrailingWordspace - -epsilon - -=head4 HasLeadingWordspace - -zeta - -=head4 Has Extra InternalWordspace - -eta - -=head4 Has"Quotes" - -theta - -=head4 Has?QuestionMark - -iota - -=head4 Has-Hyphen And Space - -kappa - -=cut - -__END__ diff --git a/gnu/usr.bin/perl/ext/SDBM_File/SDBM_File.pm b/gnu/usr.bin/perl/ext/SDBM_File/SDBM_File.pm index 30e380a6bb8..6ba1ab8aadf 100644 --- a/gnu/usr.bin/perl/ext/SDBM_File/SDBM_File.pm +++ b/gnu/usr.bin/perl/ext/SDBM_File/SDBM_File.pm @@ -7,7 +7,7 @@ require Tie::Hash; require XSLoader; our @ISA = qw(Tie::Hash); -our $VERSION = "1.15"; +our $VERSION = "1.17"; our @EXPORT_OK = qw(PAGFEXT DIRFEXT PAIRMAX); use Exporter "import"; diff --git a/gnu/usr.bin/perl/ext/SDBM_File/dbu.c b/gnu/usr.bin/perl/ext/SDBM_File/dbu.c index 9cf48fa3977..9962e0cc9af 100644 --- a/gnu/usr.bin/perl/ext/SDBM_File/dbu.c +++ b/gnu/usr.bin/perl/ext/SDBM_File/dbu.c @@ -20,7 +20,7 @@ static char *usage = "%s [-R] cat | look |... dbmname"; #define DLOOK 1 #define DINSERT 2 #define DDELETE 3 -#define DCAT 4 +#define DCAT 4 #define DBUILD 5 #define DPRESS 6 #define DCREAT 7 diff --git a/gnu/usr.bin/perl/ext/SDBM_File/sdbm.c b/gnu/usr.bin/perl/ext/SDBM_File/sdbm.c index 7cf07d7599c..c27c535da0c 100644 --- a/gnu/usr.bin/perl/ext/SDBM_File/sdbm.c +++ b/gnu/usr.bin/perl/ext/SDBM_File/sdbm.c @@ -43,6 +43,11 @@ extern Free_t free(Malloc_t); const datum nullitem = {0, 0}; +#ifdef WIN32 +# undef lseek +# define lseek _lseeki64 +#endif + /* * forward */ @@ -59,8 +64,8 @@ static int makroom(DBM *, long, int); #define exhash(item) sdbm_hash((item).dptr, (item).dsize) #define ioerr(db) ((db)->flags |= DBM_IOERR) -#define OFF_PAG(off) (long) (off) * PBLKSIZ -#define OFF_DIR(off) (long) (off) * DBLKSIZ +#define OFF_PAG(off) (Off_t) (off) * PBLKSIZ +#define OFF_DIR(off) (Off_t) (off) * DBLKSIZ static const long masks[] = { 000000000000, 000000000001, 000000000003, 000000000007, @@ -291,7 +296,7 @@ makroom(DBM *db, long int hash, int need) char twin[PBLKSIZ]; #if defined(DOSISH) || defined(WIN32) char zer[PBLKSIZ]; - long oldtail; + Off_t oldtail; #endif char *pag = db->pagbuf; char *New = twin; diff --git a/gnu/usr.bin/perl/ext/Sys-Hostname/Hostname.pm b/gnu/usr.bin/perl/ext/Sys-Hostname/Hostname.pm index ffecefd59fd..8e4f41f72f2 100644 --- a/gnu/usr.bin/perl/ext/Sys-Hostname/Hostname.pm +++ b/gnu/usr.bin/perl/ext/Sys-Hostname/Hostname.pm @@ -15,7 +15,7 @@ use warnings (); our $host; BEGIN { - $VERSION = '1.24'; + $VERSION = '1.25'; { local $SIG{__DIE__}; eval { @@ -131,7 +131,7 @@ Sys::Hostname - Try every conceivable way to get hostname =head1 SYNOPSIS use Sys::Hostname; - $host = hostname; + my $host = hostname; =head1 DESCRIPTION diff --git a/gnu/usr.bin/perl/ext/XS-APItest/APItest.pm b/gnu/usr.bin/perl/ext/XS-APItest/APItest.pm index 85787d1c949..fb0aa471ca4 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/APItest.pm +++ b/gnu/usr.bin/perl/ext/XS-APItest/APItest.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp; -our $VERSION = '1.22'; +our $VERSION = '1.32'; require XSLoader; diff --git a/gnu/usr.bin/perl/ext/XS-APItest/APItest.xs b/gnu/usr.bin/perl/ext/XS-APItest/APItest.xs index 4cdcc2abc78..bb6eaa12acd 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/APItest.xs +++ b/gnu/usr.bin/perl/ext/XS-APItest/APItest.xs @@ -23,6 +23,16 @@ typedef PerlIO * OutputStream; #define croak_fail_nep(h, w) croak("fail %p!=%p at " __FILE__ " line %d", (h), (w), __LINE__) #define croak_fail_nei(h, w) croak("fail %d!=%d at " __FILE__ " line %d", (int)(h), (int)(w), __LINE__) +/* assumes that there is a 'failed' variable in scope */ +#define TEST_EXPR(s) STMT_START { \ + if (s) { \ + printf("# ok: %s\n", #s); \ + } else { \ + printf("# not ok: %s\n", #s); \ + failed++; \ + } \ +} STMT_END + #if IVSIZE == 8 # define TEST_64BIT 1 #else @@ -115,8 +125,19 @@ S_myset_set(pTHX_ SV* sv, MAGIC* mg) return 0; } +static int +S_myset_set_dies(pTHX_ SV* sv, MAGIC* mg) +{ + PERL_UNUSED_ARG(sv); + PERL_UNUSED_ARG(mg); + croak("in S_myset_set_dies"); + return 0; +} + + static MGVTBL vtbl_foo, vtbl_bar; static MGVTBL vtbl_myset = { 0, S_myset_set, 0, 0, 0, 0, 0, 0 }; +static MGVTBL vtbl_myset_dies = { 0, S_myset_set_dies, 0, 0, 0, 0, 0, 0 }; static int S_mycopy_copy(pTHX_ SV *sv, MAGIC* mg, SV *nsv, const char *name, I32 namlen) { @@ -1443,8 +1464,62 @@ my_ck_rv2cv(pTHX_ OP *o) return old_ck_rv2cv(aTHX_ o); } +#define test_bool_internals_macro(true_sv, false_sv) \ + test_bool_internals_func(true_sv, false_sv,\ + #true_sv " and " #false_sv) + +U32 +test_bool_internals_func(SV *true_sv, SV *false_sv, const char *msg) { + U32 failed = 0; + printf("# Testing '%s'\n", msg); + TEST_EXPR(SvCUR(true_sv) == 1); + TEST_EXPR(SvCUR(false_sv) == 0); + TEST_EXPR(SvLEN(true_sv) == 0); + TEST_EXPR(SvLEN(false_sv) == 0); + TEST_EXPR(SvIV(true_sv) == 1); + TEST_EXPR(SvIV(false_sv) == 0); + TEST_EXPR(SvIsCOW(true_sv)); + TEST_EXPR(SvIsCOW(false_sv)); + TEST_EXPR(strEQ(SvPV_nolen(true_sv),"1")); + TEST_EXPR(strEQ(SvPV_nolen(false_sv),"")); + TEST_EXPR(SvIOK(true_sv)); + TEST_EXPR(SvIOK(false_sv)); + TEST_EXPR(SvPOK(true_sv)); + TEST_EXPR(SvPOK(false_sv)); + TEST_EXPR(SvBoolFlagsOK(true_sv)); + TEST_EXPR(SvBoolFlagsOK(false_sv)); + TEST_EXPR(SvTYPE(true_sv) >= SVt_PVNV); + TEST_EXPR(SvTYPE(false_sv) >= SVt_PVNV); + TEST_EXPR(SvBoolFlagsOK(true_sv) && BOOL_INTERNALS_sv_isbool(true_sv)); + TEST_EXPR(SvBoolFlagsOK(false_sv) && BOOL_INTERNALS_sv_isbool(false_sv)); + TEST_EXPR(SvBoolFlagsOK(true_sv) && BOOL_INTERNALS_sv_isbool_true(true_sv)); + TEST_EXPR(SvBoolFlagsOK(false_sv) && BOOL_INTERNALS_sv_isbool_false(false_sv)); + TEST_EXPR(SvBoolFlagsOK(true_sv) && !BOOL_INTERNALS_sv_isbool_false(true_sv)); + TEST_EXPR(SvBoolFlagsOK(false_sv) && !BOOL_INTERNALS_sv_isbool_true(false_sv)); + TEST_EXPR(SvTRUE(true_sv)); + TEST_EXPR(!SvTRUE(false_sv)); + if (failed) { + PerlIO_printf(Perl_debug_log, "# '%s' the tested true_sv:\n", msg); + sv_dump(true_sv); + PerlIO_printf(Perl_debug_log, "# PL_sv_yes:\n"); + sv_dump(&PL_sv_yes); + PerlIO_printf(Perl_debug_log, "# '%s' tested false_sv:\n",msg); + sv_dump(false_sv); + PerlIO_printf(Perl_debug_log, "# PL_sv_no:\n"); + sv_dump(&PL_sv_no); + } + fflush(stdout); + SvREFCNT_dec(true_sv); + SvREFCNT_dec(false_sv); + return failed; +} #include "const-c.inc" +void +destruct_test(pTHX_ void *p) { + warn("In destruct_test: %" SVf "\n", (SV*)p); +} + MODULE = XS::APItest PACKAGE = XS::APItest INCLUDE: const-xs.inc @@ -1658,6 +1733,18 @@ test_uvchr_to_utf8_flags_msgs(uv, flags) MODULE = XS::APItest:Overload PACKAGE = XS::APItest::Overload void +does_amagic_apply(sv, method, flags) + SV *sv + int method + int flags + PPCODE: + if(Perl_amagic_applies(aTHX_ sv, method, flags)) + XSRETURN_YES; + else + XSRETURN_NO; + + +void amagic_deref_call(sv, what) SV *sv int what @@ -2404,7 +2491,7 @@ mpushp() EXTEND(SP, 3); mPUSHp("one", 3); mPUSHp("two", 3); - mPUSHp("three", 5); + mPUSHpvs("three"); XSRETURN(3); void @@ -2439,7 +2526,7 @@ mxpushp() PPCODE: mXPUSHp("one", 3); mXPUSHp("two", 3); - mXPUSHp("three", 5); + mXPUSHpvs("three"); XSRETURN(3); void @@ -2484,19 +2571,27 @@ test_EXTEND(max_offset, nsv, use_ss) SV *nsv; bool use_ss; PREINIT: - SV **sp = PL_stack_max + max_offset; + SV **new_sp = PL_stack_max + max_offset; + SSize_t new_offset = new_sp - PL_stack_base; PPCODE: if (use_ss) { SSize_t n = (SSize_t)SvIV(nsv); - EXTEND(sp, n); - *(sp + n) = NULL; + EXTEND(new_sp, n); + new_sp = PL_stack_base + new_offset; + assert(new_sp + n <= PL_stack_max); + if ((new_sp + n) > PL_stack_sp) + *(new_sp + n) = NULL; } else { IV n = SvIV(nsv); - EXTEND(sp, n); - *(sp + n) = NULL; + EXTEND(new_sp, n); + new_sp = PL_stack_base + new_offset; + assert(new_sp + n <= PL_stack_max); + if ((new_sp + n) > PL_stack_sp) + *(new_sp + n) = NULL; } - *PL_stack_max = NULL; + if (PL_stack_max > PL_stack_sp) + *PL_stack_max = NULL; void @@ -4251,7 +4346,7 @@ CODE: SV * HvENAME(HV *hv) CODE: - RETVAL = hv && HvENAME(hv) + RETVAL = hv && HvHasENAME(hv) ? newSVpvn_flags( HvENAME(hv),HvENAMELEN(hv), (HvENAMEUTF8(hv) ? SVf_UTF8 : 0) @@ -4281,30 +4376,44 @@ OUTPUT: RETVAL char * -SvPVbyte(SV *sv) +SvPVbyte(SV *sv, OUT STRLEN len) +CODE: + RETVAL = SvPVbyte(sv, len); +OUTPUT: + RETVAL + +char * +SvPVbyte_nolen(SV *sv) CODE: RETVAL = SvPVbyte_nolen(sv); OUTPUT: RETVAL char * -SvPVbyte_nomg(SV *sv) +SvPVbyte_nomg(SV *sv, OUT STRLEN len) +CODE: + RETVAL = SvPVbyte_nomg(sv, len); +OUTPUT: + RETVAL + +char * +SvPVutf8(SV *sv, OUT STRLEN len) CODE: - RETVAL = SvPVbyte_nomg(sv, PL_na); + RETVAL = SvPVutf8(sv, len); OUTPUT: RETVAL char * -SvPVutf8(SV *sv) +SvPVutf8_nolen(SV *sv) CODE: RETVAL = SvPVutf8_nolen(sv); OUTPUT: RETVAL char * -SvPVutf8_nomg(SV *sv) +SvPVutf8_nomg(SV *sv, OUT STRLEN len) CODE: - RETVAL = SvPVutf8_nomg(sv, PL_na); + RETVAL = SvPVutf8_nomg(sv, len); OUTPUT: RETVAL @@ -4418,6 +4527,20 @@ sv_mortalcopy(SV *sv) SV * newRV(SV *sv) +SV * +newAVav(AV *av) + CODE: + RETVAL = newRV_noinc((SV *)newAVav(av)); + OUTPUT: + RETVAL + +SV * +newAVhv(HV *hv) + CODE: + RETVAL = newRV_noinc((SV *)newAVhv(hv)); + OUTPUT: + RETVAL + void alias_av(AV *av, IV ix, SV *sv) CODE: @@ -4577,6 +4700,27 @@ test_MAX_types() OUTPUT: RETVAL +SV * +test_HvNAMEf(sv) + SV *sv + CODE: + if (!sv_isobject(sv)) XSRETURN_UNDEF; + HV *pkg = SvSTASH(SvRV(sv)); + RETVAL = newSVpvf("class='%" HvNAMEf "'", pkg); + OUTPUT: + RETVAL + +SV * +test_HvNAMEf_QUOTEDPREFIX(sv) + SV *sv + CODE: + if (!sv_isobject(sv)) XSRETURN_UNDEF; + HV *pkg = SvSTASH(SvRV(sv)); + RETVAL = newSVpvf("class=%" HvNAMEf_QUOTEDPREFIX, pkg); + OUTPUT: + RETVAL + + bool sv_numeq(SV *sv1, SV *sv2) CODE: @@ -4637,16 +4781,22 @@ void sv_magic_foo(SV *sv, SV *thingy) ALIAS: sv_magic_bar = 1 + sv_magic_baz = 2 CODE: - sv_magicext(SvRV(sv), NULL, PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo, (const char *)thingy, 0); + sv_magicext(sv, NULL, ix == 2 ? PERL_MAGIC_extvalue : PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo, (const char *)thingy, 0); SV * mg_find_foo(SV *sv) ALIAS: mg_find_bar = 1 + mg_find_baz = 2 CODE: - MAGIC *mg = mg_findext(SvRV(sv), PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo); - RETVAL = mg ? SvREFCNT_inc((SV *)mg->mg_ptr) : &PL_sv_undef; + RETVAL = &PL_sv_undef; + if (SvTYPE(sv) >= SVt_PVMG) { + MAGIC *mg = mg_findext(sv, ix == 2 ? PERL_MAGIC_extvalue : PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo); + if (mg) + RETVAL = SvREFCNT_inc((SV *)mg->mg_ptr); + } OUTPUT: RETVAL @@ -4654,13 +4804,14 @@ void sv_unmagic_foo(SV *sv) ALIAS: sv_unmagic_bar = 1 + sv_unmagic_baz = 2 CODE: - sv_unmagicext(SvRV(sv), PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo); + sv_unmagicext(sv, ix == 2 ? PERL_MAGIC_extvalue : PERL_MAGIC_ext, ix ? &vtbl_bar : &vtbl_foo); void sv_magic(SV *sv, SV *thingy) CODE: - sv_magic(SvRV(sv), NULL, PERL_MAGIC_ext, (const char *)thingy, 0); + sv_magic(sv, NULL, PERL_MAGIC_ext, (const char *)thingy, 0); UV test_get_vtbl() @@ -4712,6 +4863,13 @@ test_get_vtbl() # where that magic's job is to increment thingy void +sv_magic_myset_dies(SV *rsv, SV *thingy) +CODE: + sv_magicext(SvRV(rsv), NULL, PERL_MAGIC_ext, &vtbl_myset_dies, + (const char *)thingy, 0); + + +void sv_magic_myset(SV *rsv, SV *thingy) CODE: sv_magicext(SvRV(rsv), NULL, PERL_MAGIC_ext, &vtbl_myset, @@ -4736,6 +4894,43 @@ sv_magic_mycopy_count(SV *rsv) OUTPUT: RETVAL +int +my_av_store(SV *rsv, IV i, SV *sv) + CODE: + if (av_store((AV*)SvRV(rsv), i, sv)) { + SvREFCNT_inc(sv); + RETVAL = 1; + } else { + RETVAL = 0; + } + OUTPUT: + RETVAL + +STRLEN +sv_refcnt(SV *sv) + CODE: + RETVAL = SvREFCNT(sv); + OUTPUT: + RETVAL + +void +test_mortal_destructor_sv(SV *coderef, SV *args) + CODE: + MORTALDESTRUCTOR_SV(coderef,args); + +void +test_mortal_destructor_av(SV *coderef, AV *args) + CODE: + /* passing in an AV cast to SV is different from a SV ref to an AV */ + MORTALDESTRUCTOR_SV(coderef, (SV *)args); + +void +test_mortal_svfunc_x(SV *args) + CODE: + MORTALSVFUNC_X(&destruct_test,args); + + + MODULE = XS::APItest PACKAGE = XS::APItest @@ -6553,14 +6748,14 @@ test_is_utf8_fixed_width_buf_loclen_flags(char *s, STRLEN len, U32 flags) RETVAL IV -test_utf8_hop_safe(SV *s_sv, STRLEN s_off, IV off) +test_utf8_hop_safe(SV *s_sv, STRLEN s_off, IV hop) PREINIT: STRLEN len; U8 *p; U8 *r; CODE: p = (U8 *)SvPV(s_sv, len); - r = utf8_hop_safe(p + s_off, off, p, p + len); + r = utf8_hop_safe(p + s_off, hop, p, p + len); RETVAL = r - p; OUTPUT: RETVAL @@ -6992,6 +7187,19 @@ test_Perl_langinfo(SV * item) OUTPUT: RETVAL +SV * +gimme() + CODE: + /* facilitate tests that GIMME_V gives the right result + * in XS calls */ + int gimme = GIMME_V; + SV* sv = get_sv("XS::APItest::GIMME_V", GV_ADD); + sv_setiv_mg(sv, (IV)gimme); + RETVAL = &PL_sv_undef; + OUTPUT: + RETVAL + + MODULE = XS::APItest PACKAGE = XS::APItest::Backrefs void @@ -7432,9 +7640,9 @@ test_siphash24() if (hash32 != vectors_32[i]) { failed++; printf( "Error in 32 bit result on test vector of length %d for siphash24\n" - " have: 0x%08x\n" - " want: 0x%08x\n", - i, hash32, vectors_32[i]); + " have: 0x%08" UVxf "\n" + " want: 0x%08" UVxf "\n", + i, (UV)hash32, (UV)vectors_32[i]); } } RETVAL= failed; @@ -7653,9 +7861,9 @@ test_siphash13() if (hash32 != vectors_32[i]) { failed++; printf( "Error in 32 bit result on test vector of length %d for siphash13\n" - " have: 0x%08x\n" - " want: 0x%08x\n", - i, hash32, vectors_32[i]); + " have: 0x%08" UVxf"\n" + " want: 0x%08" UVxf"\n", + i, (UV)hash32, (UV)vectors_32[i]); } } RETVAL= failed; @@ -7663,4 +7871,103 @@ test_siphash13() OUTPUT: RETVAL -#endif +#endif /* END 64 BIT SIPHASH TESTS */ + +MODULE = XS::APItest PACKAGE = XS::APItest::BoolInternals + +UV +test_bool_internals() + CODE: + { + U32 failed = 0; + SV *true_sv_setsv = newSV(0); + SV *false_sv_setsv = newSV(0); + SV *true_sv_set_true = newSV(0); + SV *false_sv_set_false = newSV(0); + SV *true_sv_set_bool = newSV(0); + SV *false_sv_set_bool = newSV(0); + SV *sviv = newSViv(1); + SV *svpv = newSVpvs("whatever"); + TEST_EXPR(SvIOK(sviv) && !SvIandPOK(sviv)); + TEST_EXPR(SvPOK(svpv) && !SvIandPOK(svpv)); + TEST_EXPR(SvIOK(sviv) && !SvBoolFlagsOK(sviv)); + TEST_EXPR(SvPOK(svpv) && !SvBoolFlagsOK(svpv)); + sv_setsv(true_sv_setsv, &PL_sv_yes); + sv_setsv(false_sv_setsv, &PL_sv_no); + sv_set_true(true_sv_set_true); + sv_set_false(false_sv_set_false); + sv_set_bool(true_sv_set_bool, true); + sv_set_bool(false_sv_set_bool, false); + /* note that test_bool_internals_macro() SvREFCNT_dec's its arguments + * after the tests */ + failed += test_bool_internals_macro(newSVsv(&PL_sv_yes), newSVsv(&PL_sv_no)); + failed += test_bool_internals_macro(newSV_true(), newSV_false()); + failed += test_bool_internals_macro(newSVbool(1), newSVbool(0)); + failed += test_bool_internals_macro(true_sv_setsv, false_sv_setsv); + failed += test_bool_internals_macro(true_sv_set_true, false_sv_set_false); + failed += test_bool_internals_macro(true_sv_set_bool, false_sv_set_bool); + SvREFCNT_dec(sviv); + SvREFCNT_dec(svpv); + RETVAL = failed; + } + OUTPUT: + RETVAL + +MODULE = XS::APItest PACKAGE = XS::APItest::CvREFCOUNTED_ANYSV + +UV +test_CvREFCOUNTED_ANYSV() + CODE: + { + U32 failed = 0; + + /* Doesn't matter what actual function we wrap because we're never + * actually going to call it. */ + CV *cv = newXS("XS::APItest::(test-cv-1)", XS_XS__APItest__XSUB_XS_VERSION_undef, __FILE__); + SV *sv = newSV(0); + CvXSUBANY(cv).any_sv = SvREFCNT_inc(sv); + CvREFCOUNTED_ANYSV_on(cv); + TEST_EXPR(SvREFCNT(sv) == 2); + + SvREFCNT_dec((SV *)cv); + TEST_EXPR(SvREFCNT(sv) == 1); + + SvREFCNT_dec(sv); + + RETVAL = failed; + } + OUTPUT: + RETVAL + +MODULE = XS::APItest PACKAGE = XS::APItest::global_locale + +char * +switch_to_global_and_setlocale(int category, const char * locale) + CODE: + switch_to_global_locale(); + RETVAL = setlocale(category, locale); + OUTPUT: + RETVAL + +bool +sync_locale() + CODE: + RETVAL = sync_locale(); + OUTPUT: + RETVAL + +NV +newSvNV(const char * string) + CODE: + RETVAL = SvNV(newSVpv(string, 0)); + OUTPUT: + RETVAL + +MODULE = XS::APItest PACKAGE = XS::APItest::savestack + +IV +get_savestack_ix() + CODE: + RETVAL = PL_savestack_ix; + OUTPUT: + RETVAL diff --git a/gnu/usr.bin/perl/ext/XS-APItest/core_or_not.inc b/gnu/usr.bin/perl/ext/XS-APItest/core_or_not.inc index 074fe60d310..d942f90598a 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/core_or_not.inc +++ b/gnu/usr.bin/perl/ext/XS-APItest/core_or_not.inc @@ -24,7 +24,7 @@ CAT2(sv_setsv_cow_hashkey_, SUFFIX) () { sv_setsv(destination, source); - result = !!SvIsCOW(destination); + result = cBOOL(SvIsCOW(destination)); SvREFCNT_dec(source); SvREFCNT_dec(destination); diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/call.t b/gnu/usr.bin/perl/ext/XS-APItest/t/call.t index 390ed8de938..1116f286fb2 100755 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/call.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/call.t @@ -14,7 +14,7 @@ BEGIN { plan(538); use_ok('XS::APItest') }; - +use Config; ######################### # f(): general test sub to be called by call_sv() etc. @@ -343,8 +343,11 @@ for my $fn_type (qw(eval_pv eval_sv call_sv)) { # DAPM 9-Aug-04. A taint test in eval_sv() could die after setting up # a new jump level but before pushing an eval context, leading to # stack corruption +SKIP: { + skip("Your perl was built without taint support", 1) + unless $Config{taint_support}; -fresh_perl_is(<<'EOF', "x=2", { switches => ['-T', '-I../../lib'] }, 'eval_sv() taint'); + fresh_perl_is(<<'EOF', "x=2", { switches => ['-T', '-I../../lib'] }, 'eval_sv() taint'); use XS::APItest; my $x = 0; @@ -357,4 +360,4 @@ sub f { eval { my @a = sort f 2, 1; $x++}; print "x=$x\n"; EOF - +} diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/locale.t b/gnu/usr.bin/perl/ext/XS-APItest/t/locale.t index 2827b3602ae..c727df12982 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/locale.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/locale.t @@ -6,30 +6,61 @@ BEGIN { use XS::APItest; use Config; -skip_all("locales not available") unless locales_enabled('LC_NUMERIC'); +skip_all("locales not available") unless locales_enabled(); my @locales = eval { find_locales( &LC_NUMERIC ) }; -skip_all("no LC_NUMERIC locales available") unless @locales; - -my $non_dot_locale; -for (@locales) { +my $comma_locale; +for my $locale (@locales) { + use POSIX; use locale; - setlocale(LC_NUMERIC, $_) or next; + setlocale(LC_NUMERIC, $locale) or next; my $in = 4.2; # avoid any constant folding bugs - if (sprintf("%g", $in) ne "4.2") { - $non_dot_locale = $_; + my $s = sprintf("%g", $in); + if ($s eq "4,2") { + $comma_locale = $locale; last; } } - SKIP: { - if ($Config{usequadmath}) { - skip "no gconvert with usequadmath", 2; + if ($Config{usequadmath}) { + skip "no gconvert with usequadmath", 2; + } + is(test_Gconvert(4.179, 2), "4.2", "Gconvert doesn't recognize underlying locale outside 'use locale'"); + use locale; + is(test_Gconvert(4.179, 2), "4.2", "Gconvert doesn't recognize underlying locale inside 'use locale'"); } - is(test_Gconvert(4.179, 2), "4.2", "Gconvert doesn't recognize underlying locale outside 'use locale'"); - use locale; - is(test_Gconvert(4.179, 2), "4.2", "Gconvert doesn't recognize underlying locale inside 'use locale'"); + +sub check_in_bounds($$$) { + my ($value, $lower, $upper) = @_; + + $value >= $lower && $value <= $upper +} + +SKIP: { + # This checks that when switching to the global locale, the service that + # Perl provides of transparently dealing with locales that have a non-dot + # radix is turned off, but gets turned on again after a sync_locale(); + + skip "no locale with a comma radix available", 5 unless $comma_locale; + + my $global_locale = switch_to_global_and_setlocale(LC_NUMERIC, + $comma_locale); + # Can't do a compare of $global_locale and $comma_locale because what the + # system returns may be an alias. ALl we can do is test for + # success/failure + ok($global_locale, "Successfully switched to $comma_locale"); + is(newSvNV("4.888"), 4, "dot not recognized in global comma locale for SvNV"); + + no warnings 'numeric'; # Otherwise get "Argument isn't numeric in + # subroutine entry" + + is(check_in_bounds(newSvNV("4,888"), 4.88, 4.89), 1, + "comma recognized in global comma locale for SvNV"); + isnt(sync_locale, 0, "sync_locale() returns that was in the global locale"); + + is(check_in_bounds(newSvNV("4.888"), 4.88, 4.89), 1, + "dot recognized in perl-controlled comma locale for SvNV"); } my %correct_C_responses = ( @@ -98,7 +129,7 @@ open my $fh, "<", $hdr; $|=1; SKIP: { - skip "No LC_ALL", 1 unless find_locales( &LC_ALL ); + skip "No LC_ALL", 1 unless locales_enabled('LC_ALL'); use POSIX; setlocale(LC_ALL, "C"); @@ -118,7 +149,7 @@ SKIP: { chomp; next unless / - \d+ $ /x; s/ ^ \# \s* define \s*//x; - m/ (.*) \ (.*) /x; + m/ (\S+) \s+ (.*) /x; $items{$1} = ($has_nl_langinfo) ? $1 # Yields 'YESSTR' : $2; # Yields -54 @@ -148,4 +179,25 @@ SKIP: { } } +@locales = eval { find_locales( &LC_TIME ) }; + +SKIP: { + skip("no LC_TIME locales available") unless @locales; + + for my $locale (@locales) { + use POSIX 'strftime'; + use locale; + setlocale(LC_TIME, $locale) or next; + + # This isn't guaranteed to find failing locales, as it is impractical + # to test all possible dates. But it is much better than no test at + # all + if (strftime('%c', 0, 0, , 12, 18, 11, 87) eq "") { + fail('strftime() built-in expansion factor works for all locales'); + diag("Failed for locale $locale"); + last; + } + } +} + done_testing(); diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/magic.t b/gnu/usr.bin/perl/ext/XS-APItest/t/magic.t index 46feb7ab074..18e0d3e6266 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/magic.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/magic.t @@ -4,7 +4,7 @@ use Test::More; use XS::APItest; -my $sv = bless {}, 'Moo'; +our $sv = 'Moo'; my $foo = 'affe'; my $bar = 'tiger'; @@ -15,6 +15,13 @@ sv_magic_foo($sv, $foo); is mg_find_foo($sv), $foo, 'foo magic attached'; ok !mg_find_bar($sv), '... but still no bar magic'; +{ + local $sv = 'Emu'; + sv_magic_foo($sv, $foo); + is mg_find_foo($sv), $foo, 'foo magic attached to localized value'; + ok !mg_find_bar($sv), '... but still no bar magic to localized value'; +} + sv_magic_bar($sv, $bar); is mg_find_foo($sv), $foo, 'foo magic still attached'; is mg_find_bar($sv), $bar, '... and bar magic is there too'; @@ -27,6 +34,14 @@ sv_unmagic_bar($sv); ok !mg_find_foo($sv), 'foo magic still removed'; ok !mg_find_bar($sv), '... and bar magic is removed too'; +sv_magic_baz($sv, $bar); +is mg_find_baz($sv), $bar, 'baz magic attached'; +ok !mg_find_bar($sv), ''; +{ + local $sv = 'Emu'; + ok !mg_find_baz($sv), ''; +} + is(test_get_vtbl(), 0, 'get_vtbl(-1) returns NULL'); eval { sv_magic(\!0, $foo) }; @@ -61,4 +76,59 @@ is $@, "", 'PERL_MAGIC_ext is permitted on read-only things'; is($i, 0, "hash () with set magic"); } +{ + # check if set magic triggered by av_store() via aassign results in + # unreferenced scalars being freed. IOW, results in a double store + # without a corresponding refcount bump. If things work properly this + # should not warn. If there is an issue it will. + my @warn; + local $SIG{__WARN__}= sub { push @warn, $_[0] }; + { + my (@a, $i); + sv_magic_myset_dies(\@a, $i); + eval { + $i = 0; + @a = (1); + }; + } + is(0+@warn, 0, + "If AV set magic dies via aassign it should not warn about double free"); + @warn = (); + { + my (@a, $i, $j); + sv_magic_myset_dies(\@a, $i); + eval { + $j = "blorp"; + my_av_store(\@a,0,$j); + }; + + # Evaluate this boolean as a separate statement, so the two + # temporary \ refs are freed before we start comparing reference + # counts + my $is_same_SV = \$a[0] == \$j; + + if ($is_same_SV) { + # in this case we expect to have 2 refcounts, + # one from $a[0] and one from $j itself. + is( sv_refcnt($j), 2, + "\$a[0] is \$j, so refcount(\$j) should be 2"); + } else { + # Note this branch isn't exercised. Whether by design + # or not. I leave it here because it is a possible valid + # outcome. It is marked TODO so if we start going down + # this path we do so knowingly. + diag "av_store has changed behavior - please review this test"; + TODO:{ + local $TODO = "av_store bug stores even if it dies during magic"; + # in this case we expect to have only 1 refcount, + # from $j itself. + is( sv_refcnt($j), 1, + "\$a[0] is not \$j, so refcount(\$j) should be 1"); + } + } + } + is(0+@warn, 0, + "AV set magic that dies via av_store should not warn about double free"); +} + done_testing; diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/svcatpvf.t b/gnu/usr.bin/perl/ext/XS-APItest/t/svcatpvf.t index 865020da301..b6cce124155 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/svcatpvf.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/svcatpvf.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; use XS::APItest; @@ -19,3 +19,13 @@ for my $case (@cases) { like($exn, qr/\b\QCannot yet reorder sv_vcatpvfn() arguments from va_list\E\b/, "explicit $what index forbidden in va_list arguments"); } + +# these actually test newSVpvf() but it is the same underlying logic. +is(test_HvNAMEf(bless {}, "Whatever::You::Like"), + "class='Whatever::You::Like'"); +is(test_HvNAMEf_QUOTEDPREFIX(bless {}, "x" x 1000), + 'class="xxxxxxxxxxxxxxxxxxxxxxxxxx'. + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..."xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. + 'xxxxxxxxxxxxxxxxxxxxx"'); diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/svpv_magic.t b/gnu/usr.bin/perl/ext/XS-APItest/t/svpv_magic.t index 00edb91504b..ed109b9a8bd 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/svpv_magic.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/svpv_magic.t @@ -33,7 +33,7 @@ is(eval { XS::APItest::first_byte($1) } || $@, 0303, sub TIESCALAR { bless [], shift } sub FETCH { ++$f; *{chr utf8::unicode_to_native(255)} } tie $t, "main"; -is SvPVutf8($t), "*main::" . byte_utf8a_to_utf8n("\xc3\xbf"), +is SvPVutf8_nolen($t), "*main::" . byte_utf8a_to_utf8n("\xc3\xbf"), 'SvPVutf8 works with get-magic changing the SV type'; is $f, 1, 'SvPVutf8 calls get-magic once'; @@ -44,7 +44,7 @@ package t { } tie $t, "t"; undef $f; -is SvPVutf8($t), byte_utf8a_to_utf8n("\xc3\xbf"), +is SvPVutf8_nolen($t), byte_utf8a_to_utf8n("\xc3\xbf"), 'SvPVutf8 works with get-magic downgrading the SV'; is $f, 1, 'SvPVutf8 calls get-magic once'; ()="$t"; diff --git a/gnu/usr.bin/perl/ext/XS-APItest/t/utf8.t b/gnu/usr.bin/perl/ext/XS-APItest/t/utf8.t index 50d1a4e0fd6..f4af4c42983 100644 --- a/gnu/usr.bin/perl/ext/XS-APItest/t/utf8.t +++ b/gnu/usr.bin/perl/ext/XS-APItest/t/utf8.t @@ -1183,10 +1183,9 @@ for my $restriction (sort keys %restriction_types) { SKIP: { - isASCII - or skip "These tests probably break on non-ASCII", 1; my $simple = join "", "A" .. "J"; - my $utf_ch = "\x{7fffffff}"; + my $utf_ch = "\x{3f_ffff}"; # Highest code point that is same number + # of bytes on ASCII and EBCDIC: 5 utf8::encode($utf_ch); my $utf_ch_len = length $utf_ch; note "utf_ch_len $utf_ch_len"; @@ -1195,10 +1194,9 @@ SKIP: # $bad_end ends with a start byte and a single continuation my $bad_end = substr($utf, 0, length($utf)-$utf_ch_len+2); - # WARNING: all offsets are *byte* offsets my @hop_tests = - ( - # string s off expected name + ( # start byte chars + # string in 'string' to hop expected name [ $simple, 0, 5, 5, "simple in range, forward" ], [ $simple, 10, -5, 5, "simple in range, backward" ], [ $simple, 5, 10, 10, "simple out of range, forward" ], @@ -1209,9 +1207,10 @@ SKIP: [ $utf, $utf_ch_len * 5, -4, $utf_ch_len, "utf in range b, backward" ], [ $utf, $utf_ch_len * 5, 6, length($utf), "utf out of range, forward" ], [ $utf, $utf_ch_len * 5, -6, 0, "utf out of range, backward" ], - [ $bad_start, 0, 1, 1, "bad start, forward 1 from 0" ], - [ $bad_start, 0, $utf_ch_len-1, $utf_ch_len-1, "bad start, forward ch_len-1 from 0" ], - [ $bad_start, 0, $utf_ch_len, $utf_ch_len*2-1, "bad start, forward ch_len from 0" ], + [ $bad_start, 0, 1, $utf_ch_len-1, "bad start, forward 1 from 0" ], + [ $bad_start, 0, 5, 5 * $utf_ch_len-1, "bad start, forward 5 chars from 0" ], + [ $bad_start, 0, 9, length($bad_start)-$utf_ch_len, "bad start, forward 9 chars from 0" ], + [ $bad_start, 0, 10, length $bad_start, "bad start, forward 10 chars from 0" ], [ $bad_start, $utf_ch_len-1, -1, 0, "bad start, back 1 from first start byte" ], [ $bad_start, $utf_ch_len-2, -1, 0, "bad start, back 1 from before first start byte" ], [ $bad_start, 0, -1, 0, "bad start, back 1 from 0" ], @@ -1221,8 +1220,8 @@ SKIP: ); for my $test (@hop_tests) { - my ($str, $s_off, $off, $want, $name) = @$test; - my $result = test_utf8_hop_safe($str, $s_off, $off); + my ($str, $s_off, $hop, $want, $name) = @$test; + my $result = test_utf8_hop_safe($str, $s_off, $hop); is($result, $want, "utf8_hop_safe: $name"); } } diff --git a/gnu/usr.bin/perl/ext/attributes/attributes.pm b/gnu/usr.bin/perl/ext/attributes/attributes.pm index 4f613f40847..313763c6acd 100644 --- a/gnu/usr.bin/perl/ext/attributes/attributes.pm +++ b/gnu/usr.bin/perl/ext/attributes/attributes.pm @@ -1,6 +1,6 @@ package attributes; -our $VERSION = 0.34; +our $VERSION = 0.35; @EXPORT_OK = qw(get reftype); @EXPORT = (); diff --git a/gnu/usr.bin/perl/ext/attributes/attributes.xs b/gnu/usr.bin/perl/ext/attributes/attributes.xs index f2f28df9380..e7d4ee4c7e6 100644 --- a/gnu/usr.bin/perl/ext/attributes/attributes.xs +++ b/gnu/usr.bin/perl/ext/attributes/attributes.xs @@ -78,9 +78,9 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs) case 'h': if (memEQs(name, 6, "method")) { if (negated) - CvFLAGS(MUTABLE_CV(sv)) &= ~CVf_METHOD; + CvFLAGS(MUTABLE_CV(sv)) &= ~CVf_NOWARN_AMBIGUOUS; else - CvFLAGS(MUTABLE_CV(sv)) |= CVf_METHOD; + CvFLAGS(MUTABLE_CV(sv)) |= CVf_NOWARN_AMBIGUOUS; continue; } break; @@ -173,7 +173,7 @@ usage: cvflags = CvFLAGS((const CV *)sv); if (cvflags & CVf_LVALUE) XPUSHs(newSVpvs_flags("lvalue", SVs_TEMP)); - if (cvflags & CVf_METHOD) + if (cvflags & CVf_NOWARN_AMBIGUOUS) XPUSHs(newSVpvs_flags("method", SVs_TEMP)); break; default: diff --git a/gnu/usr.bin/perl/ext/mro/mro.pm b/gnu/usr.bin/perl/ext/mro/mro.pm index 39ade22efe8..6637ea8eb7e 100644 --- a/gnu/usr.bin/perl/ext/mro/mro.pm +++ b/gnu/usr.bin/perl/ext/mro/mro.pm @@ -12,7 +12,7 @@ use warnings; # mro.pm versions < 1.00 reserved for MRO::Compat # for partial back-compat to 5.[68].x -our $VERSION = '1.26'; +our $VERSION = '1.28'; require XSLoader; XSLoader::load('mro'); diff --git a/gnu/usr.bin/perl/ext/mro/mro.xs b/gnu/usr.bin/perl/ext/mro/mro.xs index 6bedd039a13..ba9921f4697 100644 --- a/gnu/usr.bin/perl/ext/mro/mro.xs +++ b/gnu/usr.bin/perl/ext/mro/mro.xs @@ -14,7 +14,8 @@ static const struct mro_alg c3_alg = =for apidoc mro_get_linear_isa_c3 Returns the C3 linearization of C<@ISA> -the given stash. The return value is a read-only AV*. +the given stash. The return value is a read-only AV* +whose values are string SVs giving class names. C<level> should be 0 (it is used internally in this function's recursion). @@ -504,7 +505,6 @@ mro__nextcan(...) cxix = __dopoptosub_at(ccstack, cxix); for (;;) { GV* cvgv; - STRLEN fq_subname_len; /* we may be in a higher stacklevel, so dig down deeper */ while (cxix < 0) { @@ -545,19 +545,14 @@ mro__nextcan(...) if(SvPOK(sv)) { fq_subname = SvPVX(sv); - fq_subname_len = SvCUR(sv); - - subname_utf8 = SvUTF8(sv) ? 1 : 0; subname = strrchr(fq_subname, ':'); - } else { - subname = NULL; - } - + } if(!subname) Perl_croak(aTHX_ "next::method/next::can/maybe::next::method cannot find enclosing method"); + subname_utf8 = SvUTF8(sv) ? 1 : 0; subname++; - subname_len = fq_subname_len - (subname - fq_subname); + subname_len = SvCUR(sv) - (subname - fq_subname); if(memEQs(subname, subname_len, "__ANON__")) { cxix = __dopoptosub_at(ccstack, cxix - 1); continue; diff --git a/gnu/usr.bin/perl/ext/re/Makefile.PL b/gnu/usr.bin/perl/ext/re/Makefile.PL index f3bdcfdc69f..8d4a576e4c8 100644 --- a/gnu/usr.bin/perl/ext/re/Makefile.PL +++ b/gnu/usr.bin/perl/ext/re/Makefile.PL @@ -1,8 +1,31 @@ +use strict; +use warnings; use ExtUtils::MakeMaker; use File::Spec; use Config; +# [ src => @deps ] +our @files = ( + # compiler files ######################################## + ['regcomp.c' => 'dquote.c', 'invlist_inline.h' ], + ['regcomp_invlist.c' => 'invlist_inline.h' ], + ['regcomp_study.c' ], + ['regcomp_trie.c' ], + ['regcomp_debug.c' ], + # execution engine files ################################ + ['regexec.c' => 'invlist_inline.h' ], + # misc files ############################################ + ['dquote.c' ], + ['invlist_inline.h' ], + ######################################################### +); -my $object = 're_exec$(OBJ_EXT) re_comp$(OBJ_EXT) re$(OBJ_EXT)'; +my @objects = 're$(OBJ_EXT)'; +foreach my $tuple (@files) { + my $src_file = $tuple->[0]; + if ($src_file=~s/reg/re_/ and $src_file=~s/\.c/\$(OBJ_EXT)/) { + push @objects, $src_file; + } +} my $defines = '-DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT'; @@ -15,45 +38,41 @@ WriteMakefile( @libs ? ( 'LIBS' => [ join(" ", map { "-l$_" } @libs) ] ) : (), VERSION_FROM => 're.pm', XSPROTOARG => '-noprototypes', - OBJECT => $object, + OBJECT => "@objects", DEFINE => $defines, clean => { FILES => '*$(OBJ_EXT) invlist_inline.h *.c ../../lib/re.pm' }, ); package MY; - sub upupfile { File::Spec->catfile(File::Spec->updir, File::Spec->updir, $_[0]); } sub postamble { - my $regcomp_c = upupfile('regcomp.c'); - my $regexec_c = upupfile('regexec.c'); - my $dquote_c = upupfile('dquote.c'); - my $invlist_inline_h = upupfile('invlist_inline.h'); + my $postamble = ""; + foreach my $tuple (@::files) { + my ($file, @deps) = @$tuple; + my $src_file = upupfile($file); + my $target = $file; + $target =~ s/^reg/re_/; + $postamble .= <<EOF; -re_comp.c : $regcomp_c - - \$(RM_F) re_comp.c - \$(CP) $regcomp_c re_comp.c - -re_comp\$(OBJ_EXT) : re_comp.c dquote.c invlist_inline.h +$target : $src_file + - \$(RM_F) $target + \$(CP) $src_file $target -re_exec.c : $regexec_c - - \$(RM_F) re_exec.c - \$(CP) $regexec_c re_exec.c - -re_exec\$(OBJ_EXT) : re_exec.c invlist_inline.h - -dquote.c : $dquote_c - - \$(RM_F) dquote.c - \$(CP) $dquote_c dquote.c - -invlist_inline.h : $invlist_inline_h - - \$(RM_F) invlist_inline.h - \$(CP) $invlist_inline_h invlist_inline.h +EOF + next if $target eq $file; + my $base_name = $target; + if ($base_name=~s/\.c\z//) { + $postamble .= <<EOF +$base_name\$(OBJ_EXT) : $target @deps EOF + } + } + return $postamble } sub MY::c_o { diff --git a/gnu/usr.bin/perl/ext/re/re.pm b/gnu/usr.bin/perl/ext/re/re.pm index cf1f7421a2c..6da4e02f324 100644 --- a/gnu/usr.bin/perl/ext/re/re.pm +++ b/gnu/usr.bin/perl/ext/re/re.pm @@ -4,7 +4,7 @@ package re; use strict; use warnings; -our $VERSION = "0.43"; +our $VERSION = "0.44"; our @ISA = qw(Exporter); our @EXPORT_OK = qw{ is_regexp regexp_pattern diff --git a/gnu/usr.bin/perl/ext/re/t/lexical_debug.t b/gnu/usr.bin/perl/ext/re/t/lexical_debug.t index b2570f0e2da..4c8b47d54f1 100644 --- a/gnu/usr.bin/perl/ext/re/t/lexical_debug.t +++ b/gnu/usr.bin/perl/ext/re/t/lexical_debug.t @@ -11,7 +11,7 @@ BEGIN { use strict; # must use a BEGIN or the prototypes wont be respected meaning - # tests could pass that shouldn't +# tests could pass that shouldn't BEGIN { require "../../t/test.pl"; } my $out = runperl(progfile => "t/lexical_debug.pl", stderr => 1 ); |