This patch is from Debian:
http://patch-tracking.debian.net/patch/nondebian/dl/perl/5.10.0-23
We are omitting a few Debian-specific bits here
--- perl-5.10.0.orig/perl.c
+++ perl-5.10.0/perl.c
@@ -1364,10 +1364,17 @@
*/
const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL");
if (!s || atoi(s) == 0) {
+ const U32 old_debug = PL_debug;
/* Emulate the PerlHost behaviour of free()ing all memory allocated in this
thread at thread exit. */
+ if (DEBUG_m_TEST) {
+ PerlIO_puts(Perl_debug_log, "Disabling memory debugging as we "
+ "free this thread's memory\n");
+ PL_debug &= ~ DEBUG_m_FLAG;
+ }
while(aTHXx->Imemory_debug_header.next != &(aTHXx->Imemory_debug_header))
safesysfree(sTHX + (char *)(aTHXx->Imemory_debug_header.next));
+ PL_debug = old_debug;
}
}
#endif
--- perl-5.10.0.orig/embed.fnc
+++ perl-5.10.0/embed.fnc
@@ -140,7 +140,7 @@
Afnp |OP* |die_nocontext |NN const char* pat|...
Afnp |void |deb_nocontext |NN const char* pat|...
Afnp |char* |form_nocontext |NN const char* pat|...
-Anp |void |load_module_nocontext|U32 flags|NN SV* name|NN SV* ver|...
+Anp |void |load_module_nocontext|U32 flags|NN SV* name|NULLOK SV* ver|...
Afnp |SV* |mess_nocontext |NN const char* pat|...
Afnp |void |warn_nocontext |NN const char* pat|...
Afnp |void |warner_nocontext|U32 err|NN const char* pat|...
@@ -296,7 +296,7 @@
Apd |HV* |gv_stashpvn |NN const char* name|U32 namelen|I32 flags
Apd |HV* |gv_stashsv |NULLOK SV* sv|I32 flags
Apd |void |hv_clear |NULLOK HV* tb
-poM |HV * |hv_copy_hints_hv|NN HV *const ohv
+poM |HV * |hv_copy_hints_hv|NULLOK HV *const ohv
Ap |void |hv_delayfree_ent|NN HV* hv|NULLOK HE* entry
Abmd |SV* |hv_delete |NULLOK HV* tb|NN const char* key|I32 klen \
|I32 flags
@@ -486,8 +486,8 @@
Afp |SV* |mess |NN const char* pat|...
Ap |SV* |vmess |NN const char* pat|NULLOK va_list* args
EXp |void |qerror |NN SV* err
-Apd |void |sortsv |NN SV** array|size_t num_elts|NN SVCOMPARE_t cmp
-Apd |void |sortsv_flags |NN SV** array|size_t num_elts|NN SVCOMPARE_t cmp|U32 flags
+Apd |void |sortsv |NULLOK SV** array|size_t num_elts|NN SVCOMPARE_t cmp
+Apd |void |sortsv_flags |NULLOK SV** array|size_t num_elts|NN SVCOMPARE_t cmp|U32 flags
Apd |int |mg_clear |NN SV* sv
Apd |int |mg_copy |NN SV* sv|NN SV* nsv|NULLOK const char* key|I32 klen
pd |void |mg_localize |NN SV* sv|NN SV* nsv
@@ -768,7 +768,7 @@
Ap |void |save_list |NN SV** sarg|I32 maxsarg
Ap |void |save_long |NN long* longp
Ap |void |save_mortalizesv|NN SV* sv
-Ap |void |save_nogv |NULLOK GV* gv
+Ap |void |save_nogv |NN GV* gv
p |void |save_op
Ap |SV* |save_scalar |NN GV* gv
Ap |void |save_pptr |NN char** pptr
@@ -842,8 +842,8 @@
pd |I32 |sv_clean_all
pd |void |sv_clean_objs
Apd |void |sv_clear |NN SV* sv
-Apd |I32 |sv_cmp |NN SV* sv1|NN SV* sv2
-Apd |I32 |sv_cmp_locale |NN SV* sv1|NN SV* sv2
+Apd |I32 |sv_cmp |NULLOK SV* sv1|NULLOK SV* sv2
+Apd |I32 |sv_cmp_locale |NULLOK SV* sv1|NULLOK SV* sv2
#if defined(USE_LOCALE_COLLATE)
Apd |char* |sv_collxfrm |NN SV* sv|NN STRLEN* nxp
#endif
@@ -1094,7 +1094,7 @@
Ap |yy_parser*|parser_dup |NN const yy_parser *proto|NN CLONE_PARAMS* param
#endif
Apa |PTR_TBL_t*|ptr_table_new
-ApR |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NN const void *sv
+ApR |void* |ptr_table_fetch|NN PTR_TBL_t *tbl|NULLOK const void *sv
Ap |void |ptr_table_store|NN PTR_TBL_t *tbl|NULLOK const void *oldsv|NN void *newsv
Ap |void |ptr_table_split|NN PTR_TBL_t *tbl
Ap |void |ptr_table_clear|NULLOK PTR_TBL_t *tbl
@@ -1352,7 +1352,7 @@
s |I32 |sortcv |NN SV *a|NN SV *b
s |I32 |sortcv_xsub |NN SV *a|NN SV *b
s |I32 |sortcv_stacked |NN SV *a|NN SV *b
-s |void |qsortsvu |NN SV** array|size_t num_elts|NN SVCOMPARE_t compare
+s |void |qsortsvu |NULLOK SV** array|size_t num_elts|NN SVCOMPARE_t compare
#endif
#if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT)
@@ -1623,7 +1623,8 @@
Ap |int |PerlIO_flush |NULLOK PerlIO *f
Ap |void |PerlIO_clearerr |NULLOK PerlIO *f
Ap |void |PerlIO_set_cnt |NULLOK PerlIO *f|int cnt
-Ap |void |PerlIO_set_ptrcnt |NULLOK PerlIO *f|NN STDCHAR *ptr|int cnt
+Ap |void |PerlIO_set_ptrcnt |NULLOK PerlIO *f|NULLOK STDCHAR *ptr \
+ |int cnt
Ap |void |PerlIO_setlinebuf |NULLOK PerlIO *f
Ap |SSize_t|PerlIO_read |NULLOK PerlIO *f|NN void *buf|Size_t count
Ap |SSize_t|PerlIO_write |NULLOK PerlIO *f|NN const void *buf|Size_t count
--- perl-5.10.0.orig/util.c
+++ perl-5.10.0/util.c
@@ -178,11 +178,11 @@
ptr = (Malloc_t)PerlMem_realloc(where,size);
PERL_ALLOC_CHECK(ptr);
- DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) rfree\n",PTR2UV(where),(long)PL_an++));
- DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) realloc %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)size));
-
- if (ptr != NULL) {
+ /* MUST do this fixup first, before doing ANYTHING else, as anything else
+ might allocate memory/free/move memory, and until we do the fixup, it
+ may well be chasing (and writing to) free memory. */
#ifdef PERL_TRACK_MEMPOOL
+ if (ptr != NULL) {
struct perl_memory_debug_header *const header
= (struct perl_memory_debug_header *)ptr;
@@ -198,7 +198,17 @@
header->prev->next = header;
ptr = (Malloc_t)((char*)ptr+sTHX);
+ }
#endif
+
+ /* In particular, must do that fixup above before logging anything via
+ *printf(), as it can reallocate memory, which can cause SEGVs. */
+
+ DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) rfree\n",PTR2UV(where),(long)PL_an++));
+ DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) realloc %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)size));
+
+
+ if (ptr != NULL) {
return ptr;
}
else if (PL_nomemok)
--- perl-5.10.0.orig/toke.c
+++ perl-5.10.0/toke.c
@@ -692,6 +692,7 @@
#else
parser->nexttoke = 0;
#endif
+ parser->error_count = oparser ? oparser->error_count : 0;
parser->copline = NOLINE;
parser->lex_state = LEX_NORMAL;
parser->expect = XSTATE;
--- perl-5.10.0.orig/MANIFEST
+++ perl-5.10.0/MANIFEST
@@ -3804,6 +3804,7 @@
t/op/reverse.t See if reverse operator works
t/op/runlevel.t See if die() works from perl_call_*()
t/op/rxcode.t See if /(?{ code })/ works
+t/op/setpgrpstack.t See if setpgrp works
t/op/sleep.t See if sleep works
t/op/smartmatch.t See if the ~~ operator works
t/op/sort.t See if sort works
--- perl-5.10.0.orig/pp_sort.c
+++ perl-5.10.0/pp_sort.c
@@ -1553,11 +1553,12 @@
max = AvFILL(av) + 1;
if (SvMAGICAL(av)) {
MEXTEND(SP, max);
- p2 = SP;
for (i=0; i < max; i++) {
SV **svp = av_fetch(av, i, FALSE);
*SP++ = (svp) ? *svp : NULL;
}
+ SP--;
+ p1 = p2 = SP - (max-1);
}
else {
if (SvREADONLY(av))
@@ -1713,7 +1714,7 @@
SvREADONLY_off(av);
else if (av && !sorting_av) {
/* simulate pp_aassign of tied AV */
- SV** const base = ORIGMARK+1;
+ SV** const base = MARK+1;
for (i=0; i < max; i++) {
base[i] = newSVsv(base[i]);
}
--- perl-5.10.0.orig/perliol.h
+++ perl-5.10.0/perliol.h
@@ -170,7 +170,7 @@
/* PerlIO_teardown doesn't need exporting, but the EXTERN_C is needed
* for compiling as C++. Must also match with what perl.h says. */
-EXTERN_C void PerlIO_teardown();
+EXTERN_C void PerlIO_teardown(void);
/*--------------------------------------------------------------------------------------*/
/* Generic, or stub layer functions */
--- perl-5.10.0.orig/hv.c
+++ perl-5.10.0/hv.c
@@ -1961,6 +1961,7 @@
if (av) {
HvAUX(hv)->xhv_backreferences = 0;
Perl_sv_kill_backrefs(aTHX_ (SV*) hv, av);
+ SvREFCNT_dec(av);
}
}
--- perl-5.10.0.orig/pp_sys.c
+++ perl-5.10.0/pp_sys.c
@@ -3002,7 +3002,7 @@
case OP_FTEEXEC:
#ifdef PERL_EFF_ACCESS
- access_mode = W_OK;
+ access_mode = X_OK;
#else
use_access = 0;
#endif
@@ -4289,6 +4289,7 @@
if (MAXARG < 2) {
pgrp = 0;
pid = 0;
+ XPUSHi(-1);
}
else {
pgrp = POPi;
--- perl-5.10.0.orig/perlio.c
+++ perl-5.10.0/perlio.c
@@ -2413,7 +2413,7 @@
}
}
-void PerlIO_teardown() /* Call only from PERL_SYS_TERM(). */
+void PerlIO_teardown(void) /* Call only from PERL_SYS_TERM(). */
{
dVAR;
#if 0
--- perl-5.10.0.orig/Makefile.SH
+++ perl-5.10.0/Makefile.SH
@@ -43,12 +43,7 @@
true)
# Prefix all runs of 'miniperl' and 'perl' with
# $ldlibpth so that ./perl finds *this* shared libperl.
- case "$LD_LIBRARY_PATH" in
- '')
- ldlibpth="LD_LIBRARY_PATH=`pwd`";;
- *)
- ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
- esac
+ ldlibpth=LD_LIBRARY_PATH=`pwd`'$${LD_LIBRARY_PATH:+:}$$LD_LIBRARY_PATH'
pldlflags="$cccdlflags"
static_target='static_pic'
@@ -101,7 +96,7 @@
;;
esac
case "$ldlibpthname" in
- '') ;;
+ ''|LD_LIBRARY_PATH) ;;
*)
case "$osname" in
os2)
--- perl-5.10.0.orig/pp_ctl.c
+++ perl-5.10.0/pp_ctl.c
@@ -218,7 +218,6 @@
if (!(cx->sb_rxtainted & 2) && SvTAINTED(TOPs))
cx->sb_rxtainted |= 2;
sv_catsv(dstr, POPs);
- FREETMPS; /* Prevent excess tmp stack */
/* Are we done */
if (cx->sb_once || !CALLREGEXEC(rx, s, cx->sb_strend, orig,
@@ -3076,14 +3075,6 @@
sv = POPs;
if ( (SvNIOKp(sv) || SvVOK(sv)) && PL_op->op_type != OP_DOFILE) {
- if ( SvVOK(sv) && ckWARN(WARN_PORTABLE) ) { /* require v5.6.1 */
- HV * hinthv = GvHV(PL_hintgv);
- SV ** ptr = NULL;
- if (hinthv) ptr = hv_fetchs(hinthv, "v_string", FALSE);
- if ( !(ptr && *ptr && SvIOK(*ptr) && SvIV(*ptr)) )
- Perl_warner(aTHX_ packWARN(WARN_PORTABLE),
- "v-string in use/require non-portable");
- }
sv = new_version(sv);
if (!sv_derived_from(PL_patchlevel, "version"))
upg_version(PL_patchlevel, TRUE);
@@ -3135,26 +3126,14 @@
/* We do this only with use, not require. */
if (PL_compcv &&
- /* If we request a version >= 5.6.0, then v-string are OK
- so set $^H{v_string} to suppress the v-string warning */
- vcmp(sv, sv_2mortal(upg_version(newSVnv(5.006), FALSE))) >= 0) {
- HV * hinthv = GvHV(PL_hintgv);
- if( hinthv ) {
- SV *hint = newSViv(1);
- (void)hv_stores(hinthv, "v_string", hint);
- /* This will call through to Perl_magic_sethint() which in turn
- sets PL_hints correctly. */
- SvSETMAGIC(hint);
- }
/* If we request a version >= 5.9.5, load feature.pm with the
* feature bundle that corresponds to the required version. */
- if (vcmp(sv, sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) {
+ vcmp(sv, sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) {
SV *const importsv = vnormal(sv);
*SvPVX_mutable(importsv) = ':';
ENTER;
Perl_load_module(aTHX_ 0, newSVpvs("feature"), NULL, importsv, NULL);
LEAVE;
- }
}
RETPUSHYES;
--- perl-5.10.0.orig/sv.c
+++ perl-5.10.0/sv.c
@@ -3557,8 +3557,10 @@
GvMULTI_on(dstr);
return;
}
- glob_assign_glob(dstr, sstr, dtype);
- return;
+ if (isGV_with_GP(sstr)) {
+ glob_assign_glob(dstr, sstr, dtype);
+ return;
+ }
}
if (dtype >= SVt_PV) {
@@ -10263,10 +10265,11 @@
daux->xhv_eiter = saux->xhv_eiter
? he_dup(saux->xhv_eiter,
(bool)!!HvSHAREKEYS(sstr), param) : 0;
+ /* backref array needs refcnt=2; see sv_add_backref */
daux->xhv_backreferences =
saux->xhv_backreferences
? (AV*) SvREFCNT_inc(
- sv_dup((SV*)saux->xhv_backreferences, param))
+ sv_dup_inc((SV*)saux->xhv_backreferences, param))
: 0;
daux->xhv_mro_meta = saux->xhv_mro_meta
--- perl-5.10.0.orig/av.c
+++ perl-5.10.0/av.c
@@ -433,7 +433,7 @@
/* Give any tie a chance to cleanup first */
if (SvRMAGICAL(av)) {
const MAGIC* const mg = SvMAGIC(av);
- if (PL_delaymagic && mg->mg_type == PERL_MAGIC_isa)
+ if (PL_delaymagic && mg && mg->mg_type == PERL_MAGIC_isa)
PL_delaymagic |= DM_ARRAY;
else
mg_clear((SV*)av);
--- perl-5.10.0.orig/mg.c
+++ perl-5.10.0/mg.c
@@ -1543,10 +1543,11 @@
stash = GvSTASH(
SvTYPE(mg->mg_obj) == SVt_PVGV
? (GV*)mg->mg_obj
- : (GV*)SvMAGIC(mg->mg_obj)->mg_obj
+ : (GV*)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj
);
- mro_isa_changed_in(stash);
+ if (stash)
+ mro_isa_changed_in(stash);
return 0;
}
--- perl-5.10.0.orig/proto.h
+++ perl-5.10.0/proto.h
@@ -260,8 +260,7 @@
__attribute__nonnull__(1);
PERL_CALLCONV void Perl_load_module_nocontext(U32 flags, SV* name, SV* ver, ...)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
+ __attribute__nonnull__(2);
PERL_CALLCONV SV* Perl_mess_nocontext(const char* pat, ...)
__attribute__format__(__printf__,1,2)
@@ -678,9 +677,7 @@
PERL_CALLCONV HV* Perl_gv_stashsv(pTHX_ SV* sv, I32 flags);
PERL_CALLCONV void Perl_hv_clear(pTHX_ HV* tb);
-PERL_CALLCONV HV * Perl_hv_copy_hints_hv(pTHX_ HV *const ohv)
- __attribute__nonnull__(pTHX_1);
-
+PERL_CALLCONV HV * Perl_hv_copy_hints_hv(pTHX_ HV *const ohv);
PERL_CALLCONV void Perl_hv_delayfree_ent(pTHX_ HV* hv, HE* entry)
__attribute__nonnull__(pTHX_1);
@@ -1303,11 +1300,9 @@
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV void Perl_sortsv(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t cmp)
- __attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
PERL_CALLCONV void Perl_sortsv_flags(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t cmp, U32 flags)
- __attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
PERL_CALLCONV int Perl_mg_clear(pTHX_ SV* sv)
@@ -2079,7 +2074,9 @@
PERL_CALLCONV void Perl_save_mortalizesv(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_save_nogv(pTHX_ GV* gv);
+PERL_CALLCONV void Perl_save_nogv(pTHX_ GV* gv)
+ __attribute__nonnull__(pTHX_1);
+
PERL_CALLCONV void Perl_save_op(pTHX);
PERL_CALLCONV SV* Perl_save_scalar(pTHX_ GV* gv)
__attribute__nonnull__(pTHX_1);
@@ -2263,14 +2260,8 @@
PERL_CALLCONV void Perl_sv_clear(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV I32 Perl_sv_cmp(pTHX_ SV* sv1, SV* sv2)
- __attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2);
-
-PERL_CALLCONV I32 Perl_sv_cmp_locale(pTHX_ SV* sv1, SV* sv2)
- __attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2);
-
+PERL_CALLCONV I32 Perl_sv_cmp(pTHX_ SV* sv1, SV* sv2);
+PERL_CALLCONV I32 Perl_sv_cmp_locale(pTHX_ SV* sv1, SV* sv2);
#if defined(USE_LOCALE_COLLATE)
PERL_CALLCONV char* Perl_sv_collxfrm(pTHX_ SV* sv, STRLEN* nxp)
__attribute__nonnull__(pTHX_1)
@@ -2936,8 +2927,7 @@
PERL_CALLCONV void* Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv)
__attribute__warn_unused_result__
- __attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2);
+ __attribute__nonnull__(pTHX_1);
PERL_CALLCONV void Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv)
__attribute__nonnull__(pTHX_1)
@@ -3625,7 +3615,6 @@
__attribute__nonnull__(pTHX_2);
STATIC void S_qsortsvu(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t compare)
- __attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
#endif
@@ -4245,9 +4234,7 @@
PERL_CALLCONV int Perl_PerlIO_flush(pTHX_ PerlIO *f);
PERL_CALLCONV void Perl_PerlIO_clearerr(pTHX_ PerlIO *f);
PERL_CALLCONV void Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, int cnt);
-PERL_CALLCONV void Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, int cnt)
- __attribute__nonnull__(pTHX_2);
-
+PERL_CALLCONV void Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, int cnt);
PERL_CALLCONV void Perl_PerlIO_setlinebuf(pTHX_ PerlIO *f);
PERL_CALLCONV SSize_t Perl_PerlIO_read(pTHX_ PerlIO *f, void *buf, Size_t count)
__attribute__nonnull__(pTHX_2);
--- perl-5.10.0.orig/regcomp.c
+++ perl-5.10.0/regcomp.c
@@ -8239,6 +8239,9 @@
*STRING(ret)= (char)value;
STR_LEN(ret)= 1;
RExC_emit += STR_SZ(1);
+ if (listsv) {
+ SvREFCNT_dec(listsv);
+ }
return ret;
}
/* optimize case-insensitive simple patterns (e.g. /[a-z]/i) */
--- perl-5.10.0.orig/doop.c
+++ perl-5.10.0/doop.c
@@ -1204,7 +1204,13 @@
if (sv != left || (optype != OP_BIT_AND && !SvOK(sv) && !SvGMAGICAL(sv)))
sv_setpvn(sv, "", 0); /* avoid undef warning on |= and ^= */
- lsave = lc = SvPV_nomg_const(left, leftlen);
+ if (sv == left) {
+ lsave = lc = SvPV_force_nomg(left, leftlen);
+ }
+ else {
+ lsave = lc = SvPV_nomg_const(left, leftlen);
+ SvPV_force_nomg_nolen(sv);
+ }
rsave = rc = SvPV_nomg_const(right, rightlen);
/* This need to come after SvPV to ensure that string overloading has
--- perl-5.10.0.orig/perl.h
+++ perl-5.10.0/perl.h
@@ -663,6 +663,11 @@
# include
#endif
+/* for WCOREDUMP */
+#ifdef I_SYS_WAIT
+# include
+#endif
+
#ifdef __SYMBIAN32__
# undef _SC_ARG_MAX /* Symbian has _SC_ARG_MAX but no sysconf() */
#endif
@@ -2652,6 +2657,25 @@
# define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp)
#endif
+/*
+=for apidoc Am|void|PERL_SYS_INIT|int argc|char** argv
+Provides system-specific tune up of the C runtime environment necessary to
+run Perl interpreters. This should be called only once, before creating
+any Perl interpreters.
+
+=for apidoc Am|void|PERL_SYS_INIT3|int argc|char** argv|char** env
+Provides system-specific tune up of the C runtime environment necessary to
+run Perl interpreters. This should be called only once, before creating
+any Perl interpreters.
+
+=for apidoc Am|void|PERL_SYS_TERM|
+Provides system-specific clean up of the C runtime environment after
+running Perl interpreters. This should be called only once, after
+freeing any remaining Perl interpreters.
+
+=cut
+ */
+
#define PERL_SYS_INIT(argc, argv) Perl_sys_init(argc, argv)
#define PERL_SYS_INIT3(argc, argv, env) Perl_sys_init3(argc, argv, env)
#define PERL_SYS_TERM() Perl_sys_term()
@@ -3966,7 +3990,7 @@
#endif
#ifdef USE_PERLIO
-EXTERN_C void PerlIO_teardown();
+EXTERN_C void PerlIO_teardown(void);
# ifdef USE_ITHREADS
# define PERLIO_INIT MUTEX_INIT(&PL_perlio_mutex)
# define PERLIO_TERM \
--- perl-5.10.0.orig/pp_hot.c
+++ perl-5.10.0/pp_hot.c
@@ -1028,8 +1028,14 @@
*(relem++) = sv;
didstore = av_store(ary,i++,sv);
if (magic) {
- if (SvSMAGICAL(sv))
+ if (SvSMAGICAL(sv)) {
+ /* More magic can happen in the mg_set callback, so we
+ * backup the delaymagic for now. */
+ U16 dmbak = PL_delaymagic;
+ PL_delaymagic = 0;
mg_set(sv);
+ PL_delaymagic = dmbak;
+ }
if (!didstore)
sv_2mortal(sv);
}
@@ -1059,8 +1065,12 @@
duplicates += 2;
didstore = hv_store_ent(hash,sv,tmpstr,0);
if (magic) {
- if (SvSMAGICAL(tmpstr))
+ if (SvSMAGICAL(tmpstr)) {
+ U16 dmbak = PL_delaymagic;
+ PL_delaymagic = 0;
mg_set(tmpstr);
+ PL_delaymagic = dmbak;
+ }
if (!didstore)
sv_2mortal(tmpstr);
}
@@ -1084,7 +1094,13 @@
}
else
sv_setsv(sv, &PL_sv_undef);
- SvSETMAGIC(sv);
+
+ if (SvSMAGICAL(sv)) {
+ U16 dmbak = PL_delaymagic;
+ PL_delaymagic = 0;
+ mg_set(sv);
+ PL_delaymagic = dmbak;
+ }
break;
}
}
@@ -1198,6 +1214,9 @@
if (rx->extflags & RXf_TAINTED)
SvTAINTED_on(rv);
sv_magic(sv,(SV*)ReREFCNT_inc(rx), PERL_MAGIC_qr,0,0);
+ if (pkg) {
+ SvREFCNT_dec(pkg);
+ }
XPUSHs(rv);
RETURN;
}
--- perl-5.10.0.orig/t/comp/require.t
+++ perl-5.10.0/t/comp/require.t
@@ -15,7 +15,7 @@
my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0;
my $Is_UTF8 = (${^OPEN} || "") =~ /:utf8/;
-my $total_tests = 49;
+my $total_tests = 50;
if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; }
print "1..$total_tests\n";
@@ -258,6 +258,20 @@
}
}
+# [perl #49472] Attributes + Unkown Error
+
+{
+ do_require
+ 'use strict;sub MODIFY_CODE_ATTRIBUTE{} sub f:Blah {$nosuchvar}';
+ my $err = $@;
+ $err .= "\n" unless $err =~ /\n$/;
+ unless ($err =~ /Global symbol "\$nosuchvar" requires /) {
+ $err =~ s/^/# /mg;
+ print "${err}not ";
+ }
+ print "ok ", ++$i, " [perl #49472]\n";
+}
+
##########################################
# What follows are UTF-8 specific tests. #
# Add generic tests before this point. #
--- perl-5.10.0.orig/t/op/fork.t
+++ perl-5.10.0/t/op/fork.t
@@ -445,16 +445,14 @@
my $pid = fork;
die "fork: $!" if !defined $pid;
if ($pid == 0) {
- my $rand_child = rand;
close RDR;
- print WTR $rand_child, "\n";
+ print WTR "STRING_FROM_CHILD\n";
close WTR;
} else {
- my $rand_parent = rand;
close WTR;
- chomp(my $rand_child = );
+ chomp(my $string_from_child = );
close RDR;
- print $rand_child ne $rand_parent, "\n";
+ print $string_from_child eq "STRING_FROM_CHILD", "\n";
}
EXPECT
1
--- perl-5.10.0.orig/t/op/setpgrpstack.t
+++ perl-5.10.0/t/op/setpgrpstack.t
@@ -0,0 +1,16 @@
+#!./perl -w
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require './test.pl';
+}
+
+use Config;
+plan tests => 2;
+
+SKIP: {
+ skip "setpgrp() is not available", 2 unless $Config{d_setpgrp};
+ ok(!eval { package A;sub foo { die("got here") }; package main; A->foo(setpgrp())});
+ ok($@ =~ /got here/, "setpgrp() should extend the stack before modifying it");
+}
--- perl-5.10.0.orig/t/op/bop.t
+++ perl-5.10.0/t/op/bop.t
@@ -15,7 +15,7 @@
# If you find tests are failing, please try adding names to tests to track
# down where the failure is, and supply your new names as a patch.
# (Just-in-time test naming)
-plan tests => 161;
+plan tests => 161 + (10*13*2) + 4;
# numerics
ok ((0xdead & 0xbeef) == 0x9ead);
@@ -428,3 +428,105 @@
my $ref = "\x{10000}\0";
is(~~$str, $ref);
}
+
+# ref tests
+
+my %res;
+
+for my $str ("x", "\x{100}") {
+ for my $chr (qw/S A H G X ( * F/) {
+ for my $op (qw/| & ^/) {
+ my $co = ord $chr;
+ my $so = ord $str;
+ $res{"$chr$op$str"} = eval qq/chr($co $op $so)/;
+ }
+ }
+ $res{"undef|$str"} = $str;
+ $res{"undef&$str"} = "";
+ $res{"undef^$str"} = $str;
+}
+
+sub PVBM () { "X" }
+index PVBM, "foo";
+
+my $warn = 0;
+local $^W = 1;
+local $SIG{__WARN__} = sub { $warn++ };
+
+sub is_first {
+ my ($got, $orig, $op, $str, $name) = @_;
+ is(substr($got, 0, 1), $res{"$orig$op$str"}, $name);
+}
+
+for (
+ # [object to test, first char of stringification, name]
+ [undef, "undef", "undef" ],
+ [\1, "S", "scalar ref" ],
+ [[], "A", "array ref" ],
+ [{}, "H", "hash ref" ],
+ [qr/x/, "(", "qr//" ],
+ [*foo, "*", "glob" ],
+ [\*foo, "G", "glob ref" ],
+ [PVBM, "X", "PVBM" ],
+ [\PVBM, "S", "PVBM ref" ],
+ [bless([], "Foo"), "F", "object" ],
+) {
+ my ($val, $orig, $type) = @$_;
+
+ for (["x", "string"], ["\x{100}", "utf8"]) {
+ my ($str, $desc) = @$_;
+
+ $warn = 0;
+
+ is_first($val | $str, $orig, "|", $str, "$type | $desc");
+ is_first($val & $str, $orig, "&", $str, "$type & $desc");
+ is_first($val ^ $str, $orig, "^", $str, "$type ^ $desc");
+
+ is_first($str | $val, $orig, "|", $str, "$desc | $type");
+ is_first($str & $val, $orig, "&", $str, "$desc & $type");
+ is_first($str ^ $val, $orig, "^", $str, "$desc ^ $type");
+
+ my $new;
+ ($new = $val) |= $str;
+ is_first($new, $orig, "|", $str, "$type |= $desc");
+ ($new = $val) &= $str;
+ is_first($new, $orig, "&", $str, "$type &= $desc");
+ ($new = $val) ^= $str;
+ is_first($new, $orig, "^", $str, "$type ^= $desc");
+
+ ($new = $str) |= $val;
+ is_first($new, $orig, "|", $str, "$desc |= $type");
+ ($new = $str) &= $val;
+ is_first($new, $orig, "&", $str, "$desc &= $type");
+ ($new = $str) ^= $val;
+ is_first($new, $orig, "^", $str, "$desc ^= $type");
+
+ if ($orig eq "undef") {
+ # undef |= and undef ^= don't warn
+ is($warn, 10, "no duplicate warnings");
+ }
+ else {
+ is($warn, 0, "no warnings");
+ }
+ }
+}
+
+my $strval;
+
+{
+ package Bar;
+ use overload q/""/ => sub { $strval };
+
+ package Baz;
+ use overload q/|/ => sub { "y" };
+}
+
+ok(!eval { bless([], "Bar") | "x"; 1 }, "string overload can't use |");
+like($@, qr/no method found/, "correct error");
+is(eval { bless([], "Baz") | "x" }, "y", "| overload works");
+
+my $obj = bless [], "Bar";
+$strval = "x";
+eval { $obj |= "Q" };
+$strval = "z";
+is("$obj", "z", "|= doesn't break string overload");
--- perl-5.10.0.orig/t/mro/pkg_gen.t
+++ perl-5.10.0/t/mro/pkg_gen.t
@@ -4,7 +4,7 @@
use warnings;
chdir 't' if -d 't';
-require q(./test.pl); plan(tests => 6);
+require q(./test.pl); plan(tests => 7);
{
package Foo;
@@ -34,3 +34,7 @@
delete $::{"Foo::"};
is(mro::get_pkg_gen('Foo'), 0, 'pkg_gen 0 for delete $::{Pkg::}');
+
+delete $::{"Quux::"};
+push @Quux::ISA, "Woot"; # should not segfault
+ok(1, "No segfault on modification of ISA in a deleted stash");
--- perl-5.10.0.orig/t/lib/h2ph.h
+++ perl-5.10.0/t/lib/h2ph.h
@@ -26,6 +26,10 @@
#undef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+/* Test #undef'ining an existing constant function */
+#define NOTTRUE 0
+#undef NOTTRUE
+
/* Test #ifdef */
#ifdef __SOME_UNIMPORTANT_PROPERTY
#define MIN(a,b) ((a) < (b) ? (a) : (b))
@@ -68,9 +72,11 @@
* with `use lib qw(/opt/perl5/lib/site_perl/i586-linux/linux);' or whatever
* your equivalent is...
*/
+#if 0
#include
#import "sys/ioctl.h"
#include_next
+#endif
/* typedefs should be ignored */
typedef struct a_struct {
--- perl-5.10.0.orig/t/lib/proxy_constant_subs.t
+++ perl-5.10.0/t/lib/proxy_constant_subs.t
@@ -7,20 +7,20 @@
print "1..0 # Skip -- Perl configured without B module\n";
exit 0;
}
- if ($Config::Config{'extensions'} !~ /\bPOSIX\b/) {
- print "1..0 # Skip -- Perl configured without POSIX\n";
+ if ($Config::Config{'extensions'} !~ /\bFcntl\b/) {
+ print "1..0 # Skip -- Perl configured without Fcntl\n";
exit 0;
}
- # errno is a real subroutine, and acts as control
+ # S_IFMT is a real subroutine, and acts as control
# SEEK_SET is a proxy constant subroutine.
- @symbols = qw(errno SEEK_SET);
+ @symbols = qw(S_IFMT SEEK_SET);
}
use strict;
use warnings;
use Test::More tests => 4 * @symbols;
use B qw(svref_2object GVf_IMPORTED_CV);
-use POSIX @symbols;
+use Fcntl @symbols;
# GVf_IMPORTED_CV should not be set on the original, but should be set on the
# imported GV.
@@ -29,7 +29,7 @@
my ($ps, $ms);
{
no strict 'refs';
- $ps = svref_2object(\*{"POSIX::$symbol"});
+ $ps = svref_2object(\*{"Fcntl::$symbol"});
$ms = svref_2object(\*{"::$symbol"});
}
isa_ok($ps, 'B::GV');
--- perl-5.10.0.orig/t/lib/h2ph.pht
+++ perl-5.10.0/t/lib/h2ph.pht
@@ -1,6 +1,6 @@
require '_h2ph_pre.ph';
-no warnings 'redefine';
+no warnings qw(redefine misc);
unless(defined(&SQUARE)) {
sub SQUARE {
@@ -22,6 +22,8 @@
my($a,$b) = @_;
eval q((($a) > ($b) ? ($a) : ($b)));
}' unless defined(&MAX);
+ eval 'sub NOTTRUE () {0;}' unless defined(&NOTTRUE);
+ undef(&NOTTRUE) if defined(&NOTTRUE);
if(defined(&__SOME_UNIMPORTANT_PROPERTY)) {
eval 'sub MIN {
my($a,$b) = @_;
@@ -47,15 +49,17 @@
} else {
eval 'sub WHATEVER () {1000;}' unless defined(&WHATEVER);
}
- require 'sys/socket.ph';
- require 'sys/ioctl.ph';
- eval {
- my(@REM);
- my(%INCD) = map { $INC{$_} => 1 } (grep { $_ eq "sys/fcntl.ph" } keys(%INC));
- @REM = map { "$_/sys/fcntl.ph" } (grep { not exists($INCD{"$_/sys/fcntl.ph"}) and -f "$_/sys/fcntl.ph" } @INC);
- require "$REM[0]" if @REM;
- };
- warn($@) if $@;
+ if(0) {
+ require 'sys/socket.ph';
+ require 'sys/ioctl.ph';
+ eval {
+ my(@REM);
+ my(%INCD) = map { $INC{$_} => 1 } (grep { $_ eq "sys/fcntl.ph" } keys(%INC));
+ @REM = map { "$_/sys/fcntl.ph" } (grep { not exists($INCD{"$_/sys/fcntl.ph"}) and -f "$_/sys/fcntl.ph" } @INC);
+ require "$REM[0]" if @REM;
+ };
+ warn($@) if $@;
+ }
eval("sub sun () { 0; }") unless defined(&sun);
eval("sub mon () { 1; }") unless defined(&mon);
eval("sub tue () { 2; }") unless defined(&tue);
--- perl-5.10.0.orig/t/lib/warnings/pp_ctl
+++ perl-5.10.0/t/lib/warnings/pp_ctl
@@ -222,18 +222,6 @@
Use of uninitialized value $foo in print at (eval 1) line 1.
########
# pp_ctl.c
-use warnings 'portable';
-eval 'use 5.6.1';
-EXPECT
-v-string in use/require non-portable at (eval 1) line 2.
-########
-# pp_ctl.c
-use warnings 'portable';
-eval 'use v5.6.1';
-EXPECT
-v-string in use/require non-portable at (eval 1) line 2.
-########
-# pp_ctl.c
use warnings;
{
no warnings;
@@ -245,15 +233,3 @@
use warnings;
eval 'use 5.006; use 5.10.0';
EXPECT
-########
-# pp_ctl.c
-use warnings;
-eval '{use 5.006;} use 5.10.0';
-EXPECT
-v-string in use/require non-portable at (eval 1) line 2.
-########
-# pp_ctl.c
-use warnings;
-eval 'use vars; use 5.10.0';
-EXPECT
-v-string in use/require non-portable at (eval 1) line 2.
--- perl-5.10.0.orig/lib/h2ph.t
+++ perl-5.10.0/lib/h2ph.t
@@ -15,7 +15,7 @@
exit 0;
}
-print "1..2\n";
+print "1..4\n";
# quickly compare two text files
sub txt_compare {
@@ -32,6 +32,14 @@
$ok = txt_compare("lib/h2ph.ph", "lib/h2ph.pht");
print(($ok == 0 ? "" : "not "), "ok 2\n");
+# does the output compile?
+$ok = system($^X, "-I../lib", "lib/h2ph.pht");
+print(($ok == 0 ? "" : "not "), "ok 3\n");
+
+# is the output warning free?
+$ok = system($^X, "-w", "-I../lib", "-e", '$SIG{__WARN__} = sub { die $_[0] }; require "lib/h2ph.pht"');
+print(($ok == 0 ? "" : "not "), "ok 4\n");
+
# cleanup - should this be in an END block?
unlink("lib/h2ph.ph");
unlink("_h2ph_pre.ph");
--- perl-5.10.0.orig/lib/CGI.pm
+++ perl-5.10.0/lib/CGI.pm
@@ -4032,7 +4032,7 @@
my $filename;
find_tempdir() unless -w $TMPDIRECTORY;
for (my $i = 0; $i < $MAXTRIES; $i++) {
- last if ! -f ($filename = sprintf("${TMPDIRECTORY}${SL}CGItemp%d",$sequence++));
+ last if ! -f ($filename = sprintf("\%s${SL}CGItemp%d",$TMPDIRECTORY,$sequence++));
}
# check that it is a more-or-less valid filename
return unless $filename =~ m!^([a-zA-Z0-9_ \'\":/.\$\\-]+)$!;
@@ -4109,6 +4109,8 @@
hr;
}
+ print end_html;
+
=head1 ABSTRACT
This perl library uses perl5 objects to make it easy to create Web
@@ -5388,7 +5390,7 @@
If Apache's mod_rewrite is turned on, then the script name and path
info probably won't match the request that the user sent. Set
-rewrite=>1 (default) to return URLs that match what the user sent
-(the original request URI). Set -rewrite->0 to return URLs that match
+(the original request URI). Set -rewrite=>0 to return URLs that match
the URL after mod_rewrite's rules have run. Because the additional
path information only makes sense in the context of the rewritten URL,
-rewrite is set to false when you request path info in the URL.
--- perl-5.10.0.orig/lib/Pod/Html.pm
+++ perl-5.10.0/lib/Pod/Html.pm
@@ -246,8 +246,8 @@
my $Doindex;
my $Backlink;
-my($Listlevel, @Listend);
-my $After_Lpar;
+my($Listlevel, @Listtype);
+my $ListNewTerm;
use vars qw($Ignore); # need to localize it later.
my(%Items_Named, @Items_Seen);
@@ -286,7 +286,7 @@
$Htmldir = ""; # The directory to which the html pages
# will (eventually) be written.
$Htmlfile = ""; # write to stdout by default
- $Htmlfileurl = "" ; # The url that other files would use to
+ $Htmlfileurl = ""; # The url that other files would use to
# refer to this file. This is only used
# to make relative urls that point to
# other files.
@@ -302,8 +302,9 @@
$Doindex = 1; # non-zero if we should generate an index
$Backlink = ''; # text for "back to top" links
$Listlevel = 0; # current list depth
- @Listend = (); # the text to use to end the list.
- $After_Lpar = 0; # set to true after a par in an =item
+ @Listtype = (); # list types for open lists
+ $ListNewTerm = 0; # indicates new term in definition list; used
+ # to correctly open/close tags
$Ignore = 1; # whether or not to format text. we don't
# format text until we hit our first pod
# directive.
@@ -519,7 +520,6 @@
# now convert this file
my $after_item; # set to true after an =item
- my $need_dd = 0;
warn "Converting input file $Podfile\n" if $Verbose;
foreach my $i (0..$#poddata){
$_ = $poddata[$i];
@@ -527,7 +527,6 @@
if (/^(=.*)/s) { # is it a pod directive?
$Ignore = 0;
$after_item = 0;
- $need_dd = 0;
$_ = $1;
if (/^=begin\s+(\S+)\s*(.*)/si) {# =begin
process_begin($1, $2);
@@ -543,12 +542,12 @@
if (/^=(head[1-6])\s+(.*\S)/s) { # =head[1-6] heading
process_head( $1, $2, $Doindex && $index );
} elsif (/^=item\s*(.*\S)?/sm) { # =item text
- $need_dd = process_item( $1 );
+ process_item( $1 );
$after_item = 1;
} elsif (/^=over\s*(.*)/) { # =over N
process_over();
} elsif (/^=back/) { # =back
- process_back($need_dd);
+ process_back();
} elsif (/^=for\s+(\S+)\s*(.*)/si) {# =for
process_for($1,$2);
} else {
@@ -563,8 +562,14 @@
next if $Ignore;
next if @Begin_Stack && $Begin_Stack[-1] ne 'html';
print HTML and next if @Begin_Stack && $Begin_Stack[-1] eq 'html';
- print HTML "\n" if $need_dd;
my $text = $_;
+
+ # Open tag for definition list as we have something to put in it
+ if( $ListNewTerm ){
+ print HTML "\n";
+ $ListNewTerm = 0;
+ }
+
if( $text =~ /\A\s+/ ){
process_pre( \$text );
print HTML "\n$text
\n";
@@ -594,12 +599,8 @@
}
## end of experimental
- if( $after_item ){
- $After_Lpar = 1;
- }
print HTML "$text
\n";
}
- print HTML "\n" if $need_dd;
$after_item = 0;
}
}
@@ -1074,12 +1075,12 @@
# figure out what kind of item it is.
# Build string for referencing this item.
- if ( $txt =~ /\A=item\s+\*\s*(.*)\Z/s ) { # bullet
+ if ( $txt =~ /\A=item\s+\*\s*(.*)\Z/s ) { # bulleted list
next unless $1;
$item = $1;
} elsif( $txt =~ /\A=item\s+(?>\d+\.?)\s*(.*)\Z/s ) { # numbered list
$item = $1;
- } elsif( $txt =~ /\A=item\s+(.*)\Z/s ) { # plain item
+ } elsif( $txt =~ /\A=item\s+(.*)\Z/s ) { # definition list
$item = $1;
} else {
next;
@@ -1099,12 +1100,7 @@
$tag =~ /head([1-6])/;
my $level = $1;
- if( $Listlevel ){
- warn "$0: $Podfile: unterminated list at =head in paragraph $Paragraph. ignoring.\n" unless $Quiet;
- while( $Listlevel ){
- process_back();
- }
- }
+ finish_list();
print HTML "\n";
if( $level == 1 && ! $Top ){
@@ -1143,19 +1139,32 @@
$name = anchorify($name);
print HTML qq{}, process_text( \$otext ), '';
}
- print HTML "\n";
+ print HTML "";
undef( $EmittedItem );
}
-sub emit_li {
+sub new_listitem {
my( $tag ) = @_;
+ # Open tag for definition list as we have something to put in it
+ if( ($tag ne 'dl') && ($ListNewTerm) ){
+ print HTML "
\n";
+ $ListNewTerm = 0;
+ }
+
if( $Items_Seen[$Listlevel]++ == 0 ){
- push( @Listend, "$tag>" );
+ # start of new list
+ push( @Listtype, "$tag" );
print HTML "<$tag>\n";
+ } else {
+ # if this is not the first item, close the previous one
+ if ( $tag eq 'dl' ){
+ print HTML "\n" unless $ListNewTerm;
+ } else {
+ print HTML "\n";
+ }
}
- my $emitted = $tag eq 'dl' ? 'dt' : 'li';
- print HTML "<$emitted>";
- return $emitted;
+ my $opentag = $tag eq 'dl' ? 'dt' : 'li';
+ print HTML "<$opentag>";
}
#
@@ -1163,7 +1172,6 @@
#
sub process_item {
my( $otext ) = @_;
- my $need_dd = 0; # set to 1 if we need a after an item
# lots of documents start a list without doing an =over. this is
# bad! but, the proper thing to do seems to be to just assume
@@ -1173,43 +1181,41 @@
process_over();
}
- # formatting: insert a paragraph if preceding item has >1 paragraph
- if( $After_Lpar ){
- print HTML $need_dd ? "\n" : "\n" if $After_Lpar;
- $After_Lpar = 0;
- }
-
# remove formatting instructions from the text
my $text = depod( $otext );
- my $emitted; # the tag actually emitted, used for closing
-
# all the list variants:
if( $text =~ /\A\*/ ){ # bullet
- $emitted = emit_li( 'ul' );
+ new_listitem( 'ul' );
if ($text =~ /\A\*\s+(\S.*)\Z/s ) { # with additional text
my $tag = $1;
$otext =~ s/\A\*\s+//;
emit_item_tag( $otext, $tag, 1 );
+ print HTML "\n";
}
} elsif( $text =~ /\A\d+/ ){ # numbered list
- $emitted = emit_li( 'ol' );
+ new_listitem( 'ol' );
if ($text =~ /\A(?>\d+\.?)\s*(\S.*)\Z/s ) { # with additional text
my $tag = $1;
$otext =~ s/\A\d+\.?\s*//;
emit_item_tag( $otext, $tag, 1 );
+ print HTML "\n";
}
} else { # definition list
- $emitted = emit_li( 'dl' );
+ # new_listitem takes care of opening the tag
+ new_listitem( 'dl' );
if ($text =~ /\A(.+)\Z/s ){ # should have text
emit_item_tag( $otext, $text, 1 );
+ # write the definition term and close tag
+ print HTML "\n";
}
- $need_dd = 1;
+ # trigger opening a tag for the actual definition; will not
+ # happen if next paragraph is also a definition term (=item)
+ $ListNewTerm = 1;
}
print HTML "\n";
- return $need_dd;
}
#
@@ -1219,30 +1225,31 @@
# start a new list
$Listlevel++;
push( @Items_Seen, 0 );
- $After_Lpar = 0;
}
#
# process_back - process a pod back tag and convert it to HTML format.
#
sub process_back {
- my $need_dd = shift;
if( $Listlevel == 0 ){
warn "$0: $Podfile: unexpected =back directive in paragraph $Paragraph. ignoring.\n" unless $Quiet;
return;
}
- # close off the list. note, I check to see if $Listend[$Listlevel] is
+ # close off the list. note, I check to see if $Listtype[$Listlevel] is
# defined because an =item directive may have never appeared and thus
- # $Listend[$Listlevel] may have never been initialized.
+ # $Listtype[$Listlevel] may have never been initialized.
$Listlevel--;
- if( defined $Listend[$Listlevel] ){
- print HTML $need_dd ? "\n" : "\n" if $After_Lpar;
- print HTML $Listend[$Listlevel];
- print HTML "\n";
- pop( @Listend );
+ if( defined $Listtype[$Listlevel] ){
+ if ( $Listtype[$Listlevel] eq 'dl' ){
+ print HTML "\n" unless $ListNewTerm;
+ } else {
+ print HTML "\n";
+ }
+ print HTML "$Listtype[$Listlevel]>\n";
+ pop( @Listtype );
+ $ListNewTerm = 0;
}
- $After_Lpar = 0;
# clean up item count
pop( @Items_Seen );
@@ -2025,9 +2032,11 @@
# after the entire pod file has been read and converted.
#
sub finish_list {
- while ($Listlevel > 0) {
- print HTML "\n";
- $Listlevel--;
+ if( $Listlevel ){
+ warn "$0: $Podfile: unterminated list(s) at =head in paragraph $Paragraph. ignoring.\n" unless $Quiet;
+ while( $Listlevel ){
+ process_back();
+ }
}
}
--- perl-5.10.0.orig/lib/Pod/Usage.pm
+++ perl-5.10.0/lib/Pod/Usage.pm
@@ -631,7 +631,7 @@
$$self{PENDING}[-1][1] = $_;
}
}
- if ($$self{USAGE_SKIPPING}) {
+ if ($$self{USAGE_SKIPPING} && $element !~ m/^over-/) {
pop @{ $$self{PENDING} };
} else {
$self->SUPER::_handle_element_end($element);
--- perl-5.10.0.orig/lib/Pod/Man.pm
+++ perl-5.10.0/lib/Pod/Man.pm
@@ -1,7 +1,6 @@
# Pod::Man -- Convert POD data to formatted *roff input.
-# $Id: Man.pm,v 2.16 2007-11-29 01:35:53 eagle Exp $
#
-# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Russ Allbery
# Substantial contributions by Sean Burke
#
@@ -37,10 +36,9 @@
@ISA = qw(Pod::Simple);
-# Don't use the CVS revision as the version, since this module is also in Perl
-# core and too many things could munge CVS magic revision strings. This
-# number should ideally be the same as the CVS revision in podlators, however.
-$VERSION = '2.16';
+# Custom Debian version, see http://bugs.debian.org/500210
+$VERSION = '2.18_01';
+$VERSION = eval $VERSION;
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
@@ -73,7 +71,9 @@
my $class = shift;
my $self = $class->SUPER::new;
- # Tell Pod::Simple to handle S<> by automatically inserting .
+ # Tell Pod::Simple not to handle S<> by automatically inserting .
+ # Note that this messes up Unicode output by embedding explicit ISO 8859-1
+ # non-breaking spaces that we have to clean up later.
$self->nbsp_for_S (1);
# Tell Pod::Simple to keep whitespace whenever possible.
@@ -348,23 +348,22 @@
my $convert = $$options{convert};
my $literal = $$options{literal};
- # Normally we do character translation, but we won't even do that in
- # blocks.
- if ($convert) {
- if (ASCII) {
- $text =~ s/(\\|[^\x00-\x7F])/$ESCAPES{ord ($1)} || "X"/eg;
- } else {
- $text =~ s/(\\)/$ESCAPES{ord ($1)} || "X"/eg;
- }
- }
-
# Cleanup just tidies up a few things, telling *roff that the hyphens are
- # hard and putting a bit of space between consecutive underscores.
+ # hard, putting a bit of space between consecutive underscores, and
+ # escaping backslashes. Be careful not to mangle our character
+ # translations by doing this before processing character translation.
if ($cleanup) {
+ $text =~ s/\\/\\e/g;
$text =~ s/-/\\-/g;
$text =~ s/_(?=_)/_\\|/g;
}
+ # Normally we do character translation, but we won't even do that in
+ # blocks or if UTF-8 output is desired.
+ if ($convert && !$$self{utf8} && ASCII) {
+ $text =~ s/([^\x00-\x7F])/$ESCAPES{ord ($1)} || "X"/eg;
+ }
+
# Ensure that *roff doesn't convert literal quotes to UTF-8 single quotes,
# but don't mess up our accept escapes.
if ($literal) {
@@ -641,10 +640,10 @@
# to Roman rather than the actual previous font when used in headings.
# troff output may still be broken, but at least we can fix nroff by
# just switching the font changes to the non-fixed versions.
- $nroff =~ s/\Q$$self{FONTS}{100}\E(.*)\\f[PR]/$1/g;
- $nroff =~ s/\Q$$self{FONTS}{101}\E(.*)\\f([PR])/\\fI$1\\f$2/g;
- $nroff =~ s/\Q$$self{FONTS}{110}\E(.*)\\f([PR])/\\fB$1\\f$2/g;
- $nroff =~ s/\Q$$self{FONTS}{111}\E(.*)\\f([PR])/\\f\(BI$1\\f$2/g;
+ $nroff =~ s/\Q$$self{FONTS}{100}\E(.*?)\\f[PR]/$1/g;
+ $nroff =~ s/\Q$$self{FONTS}{101}\E(.*?)\\f([PR])/\\fI$1\\f$2/g;
+ $nroff =~ s/\Q$$self{FONTS}{110}\E(.*?)\\f([PR])/\\fB$1\\f$2/g;
+ $nroff =~ s/\Q$$self{FONTS}{111}\E(.*?)\\f([PR])/\\f\(BI$1\\f$2/g;
# Now finally output the command. Bother with .ie only if the nroff
# and troff output aren't the same.
@@ -710,6 +709,7 @@
for (@output) {
my ($type, $entry) = @$_;
$entry =~ s/\"/\"\"/g;
+ $entry =~ s/\\/\\\\/g;
$self->output (".IX $type " . '"' . $entry . '"' . "\n");
}
}
@@ -734,6 +734,19 @@
return;
}
+ # If we were given the utf8 option, set an output encoding on our file
+ # handle. Wrap in an eval in case we're using a version of Perl too old
+ # to understand this.
+ #
+ # This is evil because it changes the global state of a file handle that
+ # we may not own. However, we can't just blindly encode all output, since
+ # there may be a pre-applied output encoding (such as from PERL_UNICODE)
+ # and then we would double-encode. This seems to be the least bad
+ # approach.
+ if ($$self{utf8}) {
+ eval { binmode ($$self{output_fh}, ':encoding(UTF-8)') };
+ }
+
# Determine information for the preamble and then output it.
my ($name, $section);
if (defined $$self{name}) {
@@ -851,7 +864,7 @@
# module, but this order is correct for both Solaris and Linux.
sub preamble {
my ($self, $name, $section, $date) = @_;
- my $preamble = $self->preamble_template;
+ my $preamble = $self->preamble_template (!$$self{utf8});
# Build the index line and make sure that it will be syntactically valid.
my $index = "$name $section";
@@ -1025,7 +1038,7 @@
sub cmd_head2 {
my ($self, $attrs, $text) = @_;
$text = $self->heading_common ($text, $$attrs{start_line});
- $self->output ($self->switchquotes ('.Sh', $self->mapfonts ($text)));
+ $self->output ($self->switchquotes ('.SS', $self->mapfonts ($text)));
$self->outindex ('Subsection', $text);
$$self{NEEDSPACE} = 0;
return '';
@@ -1273,7 +1286,7 @@
# results are pretty poor.
#
# This only works in an ASCII world. What to do in a non-ASCII world is very
-# unclear.
+# unclear -- hopefully we can assume UTF-8 and just leave well enough alone.
@ESCAPES{0xA0 .. 0xFF} = (
"\\ ", undef, undef, undef, undef, undef, undef, undef,
undef, undef, undef, undef, undef, "\\%", undef, undef,
@@ -1294,27 +1307,18 @@
"o\\*/" , "u\\*`", "u\\*'", "u\\*^", "u\\*:", "y\\*'", "\\*(th", "y\\*:",
) if ASCII;
-# Make sure that at least this works even outside of ASCII.
-$ESCAPES{ord("\\")} = "\\e";
-
##############################################################################
# Premable
##############################################################################
# The following is the static preamble which starts all *roff output we
-# generate. It's completely static except for the font to use as a
-# fixed-width font, which is designed by @CFONT@, and the left and right
-# quotes to use for C<> text, designated by @LQOUTE@ and @RQUOTE@.
+# generate. Most is static except for the font to use as a fixed-width font,
+# which is designed by @CFONT@, and the left and right quotes to use for C<>
+# text, designated by @LQOUTE@ and @RQUOTE@. However, the second part, which
+# defines the accent marks, is only used if $escapes is set to true.
sub preamble_template {
- return <<'----END OF PREAMBLE----';
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
+ my ($self, $accents) = @_;
+ my $preamble = <<'----END OF PREAMBLE----';
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
@@ -1358,7 +1362,7 @@
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
@@ -1372,6 +1376,10 @@
. de IX
..
.\}
+----END OF PREAMBLE----
+
+ if ($accents) {
+ $preamble .= <<'----END OF PREAMBLE----'
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
@@ -1436,6 +1444,8 @@
.rm #[ #] #H #V #F C
----END OF PREAMBLE----
#`# for cperl-mode
+ }
+ return $preamble;
}
##############################################################################
@@ -1582,6 +1592,28 @@
By default, section 1 will be used unless the file ends in .pm in which case
section 3 will be selected.
+=item utf8
+
+By default, Pod::Man produces the most conservative possible *roff output
+to try to ensure that it will work with as many different *roff
+implementations as possible. Many *roff implementations cannot handle
+non-ASCII characters, so this means all non-ASCII characters are converted
+either to a *roff escape sequence that tries to create a properly accented
+character (at least for troff output) or to C.
+
+If this option is set, Pod::Man will instead output UTF-8. If your *roff
+implementation can handle it, this is the best output format to use and
+avoids corruption of documents containing non-ASCII characters. However,
+be warned that *roff source with literal UTF-8 characters is not supported
+by many implementations and may even result in segfaults and other bad
+behavior.
+
+Be aware that, when using this option, the input encoding of your POD
+source must be properly declared unless it is US-ASCII or Latin-1. POD
+input without an C<=encoding> command will be assumed to be in Latin-1,
+and if it's actually in UTF-8, the output will be double-encoded. See
+L for more information on the C<=encoding> command.
+
=back
The standard Pod::Simple method parse_file() takes one argument naming the
@@ -1617,14 +1649,11 @@
=head1 BUGS
-Eight-bit input data isn't handled at all well at present. The correct
-approach would be to map EEE escapes to the appropriate UTF-8
-characters and then do a translation pass on the output according to the
-user-specified output character set. Unfortunately, we can't send eight-bit
-data directly to the output unless the user says this is okay, since some
-vendor *roff implementations can't handle eight-bit data. If the *roff
-implementation can, however, that's far superior to the current hacked
-characters that only work under troff.
+Encoding handling assumes that PerlIO is available and does not work
+properly if it isn't since encode and decode do not work well in
+combination with PerlIO encoding layers. It's very unclear how to
+correctly handle this without PerlIO encoding layers. The C option
+is therefore not supported unless Perl is built with PerlIO support.
There is currently no way to turn off the guesswork that tries to format
unmarked text appropriately, and sometimes it isn't wanted (particularly
@@ -1651,6 +1680,13 @@
=head1 CAVEATS
+If Pod::Man is given the C option, the encoding of its output file
+handle will be forced to UTF-8 if possible, overriding any existing
+encoding. This will be done even if the file handle is not created by
+Pod::Man and was passed in from outside. This seems to be the only way to
+consistently enforce UTF-8-encoded output regardless of PERL_UNICODE and
+other settings.
+
The handling of hyphens and em dashes is somewhat fragile, and one may get
the wrong one under some circumstances. This should only matter for
B output.
--- perl-5.10.0.orig/lib/Pod/t/htmlview.pod
+++ perl-5.10.0/lib/Pod/t/htmlview.pod
@@ -110,7 +110,7 @@
=head1 TESTING FOR AND BEGIN
-=for html
+=for html
blah blah
--- perl-5.10.0.orig/lib/Pod/t/htmlview.t
+++ perl-5.10.0/lib/Pod/t/htmlview.t
@@ -86,17 +86,15 @@
Constructor method. Accepts the following config options:
-- foo
+
- foo
-
The foo item.
-
-- bar
+
- bar
-
The bar item.
-
This is a list within a list
-
@@ -106,30 +104,36 @@
The waz item.
-- baz
+
+
- baz
-
The baz item.
-
Title on the same line as the =item + * bullets
Title on the same line as the =item + numerical bullets
- Cat
+
- Sat
+
- Mat
+
No bullets, no title
@@ -137,17 +141,14 @@
-
Cat
-
-
-
Sat
-
-
-
Mat
-
@@ -157,7 +158,7 @@
-
+
blah blah
intermediate text
--- perl-5.10.0.orig/lib/Pod/t/htmllink.t
+++ perl-5.10.0/lib/Pod/t/htmllink.t
@@ -108,24 +108,21 @@
This is section three.
-- item1
+
- item1
-
This is item one.
-
-- item 2
+
- item 2
-
This is item two.
-
-- item three
+
- item three
-
This is item three.
-