From: Adrian M. Enache <enache@rdslink.ro>
Date: Fri, 7 Mar 2003 23:28:37 +0000 (+0200)
Subject: Re: [perl #21498] printf behaviour changes 5.6.1(and earlier) -> 5.8
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58e33a9028ebaa2c94f6b7cf202a415b19dab366;p=p5sagit%2Fp5-mst-13.2.git

Re: [perl #21498] printf behaviour changes 5.6.1(and earlier) -> 5.8
Message-ID: <20030307212837.GB765@ratsnest.hole>

(and few more test cases from the thread)

p4raw-id: //depot/perl@18861
---

diff --git a/sv.c b/sv.c
index effecb7..cc6f6c2 100644
--- a/sv.c
+++ b/sv.c
@@ -8358,6 +8358,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
 	STRLEN zeros = 0;
 	bool has_precis = FALSE;
 	STRLEN precis = 0;
+	I32 osvix = svix;
 	bool is_utf8 = FALSE;  /* is this item utf8?   */
 #ifdef HAS_LDBL_SPRINTF_BUG
 	/* This is to try to fix a bug with irix/nonstop-ux/powerux and
@@ -9109,7 +9110,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
 
 	default:
       unknown:
-	    vectorize = FALSE;
 	    if (!args && ckWARN(WARN_PRINTF) &&
 		  (PL_op->op_type == OP_PRTF || PL_op->op_type == OP_SPRINTF)) {
 		SV *msg = sv_newmortal();
@@ -9141,6 +9141,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
 	    p += elen;
 	    *p = '\0';
 	    SvCUR(sv) = p - SvPVX(sv);
+	    svix = osvix;
 	    continue;	/* not "break" */
 	}
 
diff --git a/t/op/sprintf.t b/t/op/sprintf.t
index e498c65..5a046ec 100755
--- a/t/op/sprintf.t
+++ b/t/op/sprintf.t
@@ -359,7 +359,7 @@ __END__
 >%2$d %d %d<	>[12, 34]<	>34 12 34<
 >%3$d %d %d<	>[12, 34, 56]<	>56 12 34<
 >%2$*3$d %d<	>[12, 34, 3]<	> 34 12<
->%*3$2$d %d<	>[12, 34, 3]<	>%*3$2$d 34 INVALID<
+>%*3$2$d %d<	>[12, 34, 3]<	>%*3$2$d 12 INVALID<
 >%2$d<		>12<	>0 UNINIT<
 >%0$d<		>12<	>%0$d INVALID<
 >%1$$d<		>12<	>%1$$d INVALID<
@@ -374,4 +374,9 @@ __END__
 >%vs,%d<	>[1, 2, 3]<	>1,2<
 >%v_<	>''<	>%v_ INVALID<
 >%v#x<	>''<	>%v#x INVALID<
->%v02x<	>"foo\n"<	>66.6f.6f.0a< 
+>%v02x<	>"foo\n"<	>66.6f.6f.0a<
+>%V-%s<		>["Hello"]<	>%V-Hello INVALID<
+>%K %d %d<	>[13, 29]<	>%K 13 29 INVALID<
+>%*.*K %d<	>[13, 29, 76]<	>%*.*K 13 INVALID<
+>%4$K %d<	>[45, 67]<	>%4$K 45 INVALID<
+>%d %K %d<	>[23, 45]<	>23 %K 45 INVALID<