Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sprintf of version objects #8243

Closed
p5pRT opened this issue Dec 12, 2005 · 35 comments
Closed

sprintf of version objects #8243

p5pRT opened this issue Dec 12, 2005 · 35 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 12, 2005

Migrated from rt.perl.org#37897 (status was 'resolved')

Searchable as RT37897$

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

From @gisle

Created by @gisle

Version objects are special cased in perl's sprintf() code, but the result
is not quite right if anything but "%vd" is used​:

  $ perl -e 'printf "%vd\n", $^V'
  v5.9.3
  $ perl -e 'printf "%v3d\n", $^V'
  v5.9.3
  $ perl -e 'printf "%v.3d\n", $^V'
  118.053.046.057.046.051
  $ perl -e 'printf "%vx\n", $^V'
  76.35.2e.39.2e.33
 

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl v5.9.3:

Configured by gisle at Fri Dec  2 10:27:35 CET 2005.

Summary of my perl5 (revision 5 version 9 subversion 3 patch 26241) configuration:
  Platform:
    osname=linux, osvers=2.6.12-gentoo-r4, archname=i686-linux
    uname='linux ask.g.aas.no 2.6.12-gentoo-r4 #3 smp mon jul 11 19:30:39 cest 2005 i686 intel(r) pentium(r) 4 cpu 2.80ghz genuineintel gnulinux '
    config_args='-Dprefix=/opt/perl/26241 -Dusedevel -Uversiononly -Doptimize=-g -ders'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -pipe'
    ccversion='', gccversion='3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    DEVEL24148


@INC for perl v5.9.3:
    /opt/perl/26241/lib/5.9.3/i686-linux
    /opt/perl/26241/lib/5.9.3
    /opt/perl/26241/lib/site_perl/5.9.3/i686-linux
    /opt/perl/26241/lib/site_perl/5.9.3
    /opt/perl/26241/lib/site_perl
    .


Environment for perl v5.9.3:
    HOME=/home/gisle
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/perl/bin:/usr/kde/3.4/bin:/home/gisle/bin:/local/ccache:/local/perl/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.4.4:/opt/ghc/bin:/usr/qt/3/bin:/usr/kde/3.4/bin:/usr/games/bin:/opt/insight/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

From @JohnPeacock

Gisle Aas (via RT) wrote​:

Version objects are special cased in perl's sprintf() code, but the result
is not quite right if anything but "%vd" is used​:

$ perl -e 'printf "%vd\n", $^V'
v5.9.3
$ perl -e 'printf "%v3d\n", $^V'
v5.9.3
$ perl -e 'printf "%v.3d\n", $^V'
118.053.046.057.046.051
$ perl -e 'printf "%vx\n", $^V'
76.35.2e.39.2e.33

sv_vcatpvfn() being a good example of overloaded operations gone
horribly awry, it will take me a while to suss out where/how to fix
this. Out of curiosity, are you just working your way through every
possible printf() combination, just to see what breaks? I cannot think
of a possible reason for utilizing the last two constructs above, but
that may just be a failure of imagination. Can we just make them syntax
errors? <ducks>

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

From @gisle

John Peacock <jpeacock@​rowman.com> writes​:

Gisle Aas (via RT) wrote​:

Version objects are special cased in perl's sprintf() code, but the result
is not quite right if anything but "%vd" is used​:
$ perl -e 'printf "%vd\n", $^V'
v5.9.3
$ perl -e 'printf "%v3d\n", $^V'
v5.9.3
$ perl -e 'printf "%v.3d\n", $^V'
118.053.046.057.046.051
$ perl -e 'printf "%vx\n", $^V'
76.35.2e.39.2e.33

sv_vcatpvfn() being a good example of overloaded operations gone
horribly awry, it will take me a while to suss out where/how to fix
this. Out of curiosity, are you just working your way through every
possible printf() combination, just to see what breaks?

I'm just looking at Perl_sv_vcatpvfn and was kind of surprised by the
special casing of version objects and how simple minded this was. The
behaviour exposed does not match how sprintf is documented at all.

I cannot think of a possible reason for utilizing the last two
constructs above, but that may just be a failure of imagination.
Can we just make them syntax errors?

There are some examples of how the vector flag can be useful in the
sprintf docs, but I can't think of any way it is usful for printing of
version objects. My suggestion would be just to remove this special
casing and let version objects be vectorized as strings by sprintf.

--Gisle

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

From @Tux

On 12 Dec 2005 09​:52​:37 -0800, Gisle Aas <gisle@​ActiveState.com> wrote​:

John Peacock <jpeacock@​rowman.com> writes​:

Gisle Aas (via RT) wrote​:

Version objects are special cased in perl's sprintf() code, but the
result is not quite right if anything but "%vd" is used​:
$ perl -e 'printf "%vd\n", $^V'
v5.9.3
$ perl -e 'printf "%v3d\n", $^V'
v5.9.3
$ perl -e 'printf "%v.3d\n", $^V'
118.053.046.057.046.051
$ perl -e 'printf "%vx\n", $^V'
76.35.2e.39.2e.33

sv_vcatpvfn() being a good example of overloaded operations gone
horribly awry, it will take me a while to suss out where/how to fix
this. Out of curiosity, are you just working your way through every
possible printf() combination, just to see what breaks?

lt09​:/pro/3gl/CPAN/perl-current 117 > ./perl -e '($_=sprintf"%vx\n",$^V)=~s^\d\d.3\d.2^Just Anoth^;s$.3..2$r P$;s;.3.;rl Hacker,;;print'
Just Another Perl Hacker,
lt09​:/pro/3gl/CPAN/perl-current 118 >

I'm just looking at Perl_sv_vcatpvfn and was kind of surprised by the
special casing of version objects and how simple minded this was. The
behaviour exposed does not match how sprintf is documented at all.

I cannot think of a possible reason for utilizing the last two
constructs above, but that may just be a failure of imagination.
Can we just make them syntax errors?

There are some examples of how the vector flag can be useful in the
sprintf docs, but I can't think of any way it is usful for printing of
version objects. My suggestion would be just to remove this special
casing and let version objects be vectorized as strings by sprintf.

--Gisle

--
H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2 on HP-UX 10.20, 11.00 & 11.11,
AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http​://www.cmve.net/~merijn
Smoking perl​: http​://www.test-smoke.org, perl QA​: http​://qa.perl.org
reports to​: smokers-reports@​perl.org, perl-qa@​perl.org

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

From @JohnPeacock

Gisle Aas wrote​:

There are some examples of how the vector flag can be useful in the
sprintf docs, but I can't think of any way it is usful for printing of
version objects. My suggestion would be just to remove this special
casing and let version objects be vectorized as strings by sprintf.

Hysterical Raisins, and all that. $^V was documented as returning a
v-string until the version magic patch came in, so the minimal amount of
patching was done to preserve that. The problem is that

  printf("%vd", $^V);

exists in the wild so we have to carefully neuter that code path so that
"%vd" still works for v-strings and is equivalent to "%s" for version
objects.

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2005

From @petdance

On Mon, Dec 12, 2005 at 07​:17​:13PM +0100, H.Merijn Brand (h.m.brand@​xs4all.nl) wrote​:

lt09​:/pro/3gl/CPAN/perl-current 117 > ./perl -e '($_=sprintf"%vx\n",$^V)=~s^\d\d.3\d.2^Just Anoth^;s$.3..2$r P$;s;.3.;rl Hacker,;;print'
Just Another Perl Hacker,
lt09​:/pro/3gl/CPAN/perl-current 118 >

If that doesn't belong in t/op/sprintf.t, I don't know what does.

Are you going to patch it or should I?

--
Andy Lester => andy@​petdance.com => www.petdance.com => AIM​:petdance

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2005

From @JohnPeacock

John Peacock wrote​:

"%vd" still works for v-strings and is equivalent to "%s" for version
objects.

I realized last night what I need to do (but didn't have the brainpower
to do it yet)​:

IIF the term is a version object, then I'll convert that back to its
v-string equivalent and allow the existing 'v' format code (i.e. width,
precision, etc) do its damage. That should be much easier than figuring
out how to ignore all of the undesirable format flags (as the current
simplistic method does).

Thoughts? Complaints?

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2005

From @gisle

John Peacock <jpeacock@​rowman.com> writes​:

IIF the term is a version object, then I'll convert that back to its
v-string equivalent and allow the existing 'v' format code
(i.e. width, precision, etc) do its damage. That should be much
easier than figuring out how to ignore all of the undesirable format
flags (as the current simplistic method does).

Thoughts? Complaints?

Sounds good to me.

--Gisle

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2005

From @gisle

John Peacock <jpeacock@​rowman.com> writes​:

IIF the term is a version object, then I'll convert that back to its
v-string equivalent and allow the existing 'v' format code
(i.e. width, precision, etc) do its damage. That should be much
easier than figuring out how to ignore all of the undesirable format
flags (as the current simplistic method does).

How about something like the following patch? It allow any array
reference to be passed as the sprintf vector argument and then the
only special case for version objects is that its hash is dereferenced
one level to make it an array. Now I can do this​:

  $ perl -e 'printf "%vd\n", $^V'
  5.9.3
  $ perl -e 'printf "%v04d\n", $^V'
  0005.0009.0003
  $ perl -e 'printf "%vb\n", $^V'
  101.1001.11
  $ perl -e 'printf "%v04d\n", [1..5]'
  0001.0002.0003.0004.0005

I find this kind of cool, but I'm not sure if this is really useful
somehow. It just means that​:

  $str = sprintf "%vX", \@​array;

is short for​:

  $str = join(".", map sprintf("%X", $_), @​array);

--Gisle

==== //depot/perl/sv.c#1056 - /home/gisle/perl/blead/sv.c ====
@​@​ -7811,6 +7811,8 @​@​
  const char *eptr = Nullch;
  STRLEN elen = 0;
  SV *vecsv = Nullsv;
+ AV *vecav = Nullav;
+ I32 vecavix;
  const U8 *vecstr = Null(U8*);
  STRLEN veclen = 0;
  char c = 0;
@​@​ -8005,23 +8007,17 @​@​
  }
  else if (efix ? (efix > 0 && efix <= svmax) : svix < svmax) {
  vecsv = svargs[efix ? efix-1 : svix++];
- vecstr = (U8*)SvPV_const(vecsv,veclen);
- vec_utf8 = DO_UTF8(vecsv);
- /* if this is a version object, we need to return the
- * stringified representation (which the SvPVX_const has
- * already done for us), but not vectorize the args
- */
- if ( *q == 'd' && sv_derived_from(vecsv,"version") )
- {
- q++; /* skip past the rest of the %vd format */
- eptr = (const char *) vecstr;
- elen = veclen;
- if (elen && *eptr == 'v') {
- eptr++;
- elen--;
- }
- vectorize=FALSE;
- goto string;
+ if (sv_derived_from(vecsv,"version")) {
+ vecsv = *hv_fetch((HV*)SvRV(vecsv), "version", 7, FALSE);
+ }
+ if (SvROK(vecsv) && SvTYPE(SvRV(vecsv)) == SVt_PVAV) {
+ vecav = (AV*)SvRV(vecsv);
+ vecavix = 0;
+ veclen = av_len(vecav) + 1;
+ }
+ else {
+ vecstr = (U8*)SvPV_const(vecsv,veclen);
+ vec_utf8 = DO_UTF8(vecsv);
  }
  }
  else {
@​@​ -8219,18 +8215,25 @​@​
  format_vd​:
#endif
  if (vectorize) {
- STRLEN ulen;
  if (!veclen)
  continue;
- if (vec_utf8)
- uv = utf8n_to_uvchr(vecstr, veclen, &ulen,
- UTF8_ALLOW_ANYUV);
+ if (vecav) {
+ uv = SvUV(*av_fetch(vecav, vecavix, 0));
+ vecavix++;
+ veclen--;
+ }
  else {
- uv = *vecstr;
- ulen = 1;
+ STRLEN ulen;
+ if (vec_utf8)
+ uv = utf8n_to_uvchr(vecstr, veclen, &ulen,
+ UTF8_ALLOW_ANYUV);
+ else {
+ uv = *vecstr;
+ ulen = 1;
+ }
+ vecstr += ulen;
+ veclen -= ulen;
  }
- vecstr += ulen;
- veclen -= ulen;
  if (plus)
  esignbuf[esignlen++] = plus;
  }
@​@​ -8304,19 +8307,26 @​@​

  uns_integer​:
  if (vectorize) {
- STRLEN ulen;
  vector​:
  if (!veclen)
  continue;
- if (vec_utf8)
- uv = utf8n_to_uvchr(vecstr, veclen, &ulen,
- UTF8_ALLOW_ANYUV);
+ if (vecav) {
+ uv = SvUV(*av_fetch(vecav, vecavix, 0));
+ vecavix++;
+ veclen--;
+ }
  else {
- uv = *vecstr;
- ulen = 1;
+ STRLEN ulen;
+ if (vec_utf8)
+ uv = utf8n_to_uvchr(vecstr, veclen, &ulen,
+ UTF8_ALLOW_ANYUV);
+ else {
+ uv = *vecstr;
+ ulen = 1;
+ }
+ vecstr += ulen;
+ veclen -= ulen;
  }
- vecstr += ulen;
- veclen -= ulen;
  }
  else if (args) {
  switch (intsize) {

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2005

From @JohnPeacock

Gisle Aas wrote​:

How about something like the following patch? It allow any array
reference to be passed as the sprintf vector argument and then the
only special case for version objects is that its hash is dereferenced
one level to make it an array. Now I can do this​:

I don't know if there is any utility to this more general patch, since
it doesn't really map very directly with the existing sprintf notation.
  It should be very straightforward to just iterate over the version
object's array and create the v-string equivalent (that's all I was
planning on doing. The only special case is $^V (not any generic
version object), so I'd think we want to keep the change to the absolute
minimum.

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2005

From @JohnPeacock

Gisle Aas wrote​:

John Peacock <jpeacock@​rowman.com> writes​:

IIF the term is a version object, then I'll convert that back to its
v-string equivalent and allow the existing 'v' format code
(i.e. width, precision, etc) do its damage. That should be much
easier than figuring out how to ignore all of the undesirable format
flags (as the current simplistic method does).

Thoughts? Complaints?

Sounds good to me.

OK, here's my alternate patch, along with tests. This simply recreates
a v-string from the version object and then lets the existing vector
handling work the same as it always did. The only thing I didn't do is
to decide what to do about the special cases of cpan-style versions or
alpha versions.

Since the only situation that should be in code in the wild refers to
$^V, we could actually make this even more specific by determining if
vecsv == PL_patchlevel.

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2005

From @JohnPeacock

sv.c.diff
=== sv.c
==================================================================
--- sv.c	(revision 18901)
+++ sv.c	(local)
@@ -8000,24 +8000,41 @@
 	    }
 	    else if (efix ? (efix > 0 && efix <= svmax) : svix < svmax) {
 		vecsv = svargs[efix ? efix-1 : svix++];
-		vecstr = (U8*)SvPV_const(vecsv,veclen);
-		vec_utf8 = DO_UTF8(vecsv);
-		/* if this is a version object, we need to return the
-		 * stringified representation (which the SvPVX_const has
-		 * already done for us), but not vectorize the args
+
+		/* if this is a version object, we need to convert
+		 * back into v-string notation and then let the
+		 * vectorize happen normally
 		 */
-		if ( *q == 'd' && sv_derived_from(vecsv,"version") )
+		if ( sv_derived_from(vecsv,"version") )
 		{
-			q++; /* skip past the rest of the %vd format */
-			eptr = (const char *) vecstr;
-			elen = veclen;
-			if (elen && *eptr == 'v') {
-			    eptr++;
-			    elen--;
-			}
-			vectorize=FALSE;
-			goto string;
+		    I32 i, len;
+		    UV digit;
+		    U8 tmpbuf[UTF8_MAXBYTES+1];
+		    U8 *tmpend;
+		    SV *sv = sv_newmortal();
+		    AV *av =
+			(AV *)SvRV(*hv_fetch((HV*)SvRV(vecsv),
+				"version", 7, FALSE));
+		    len = av_len(av);
+		    sv_setpvn(sv, "", 0);
+		    vecsv = sv_mortalcopy(vecsv);
+	    		    
+		    digit = (UV)SvIV(*av_fetch(av, 0, 0));
+		    tmpend = uvchr_to_utf8(tmpbuf, digit);
+		    sv_setpvn(vecsv, (const char*)tmpbuf, tmpend - tmpbuf);
+		    veclen = tmpend - tmpbuf;
+
+		    for ( i = 1 ; i <= len ; i++ ) {
+			digit = (UV)SvIV(*av_fetch(av, i, 0));
+			tmpend = uvchr_to_utf8(tmpbuf, digit);
+			sv_catpvn(vecsv, (const char*)tmpbuf, tmpend - tmpbuf);
+			veclen += tmpend - tmpbuf;
+			if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(digit)))
+			    SvUTF8_on(vecsv);
+		    }
 		}
+		vecstr = (U8*)SvPV_const(vecsv,veclen);
+		vec_utf8 = DO_UTF8(vecsv);
 	    }
 	    else {
 		vecstr = (U8*)"";
=== t/op/sprintf.t
==================================================================
--- t/op/sprintf.t	(revision 18901)
+++ t/op/sprintf.t	(local)
@@ -245,8 +245,10 @@
 >%vd<       >[version::qv("1.2.3")]< >1.2.3<
 >%v.3d<     >"\01\02\03"< >001.002.003<
 >%0v3d<     >"\01\02\03"< >001.002.003<
+>%v.3d<     >[version::qv("1.2.3")]< >001.002.003<
 >%-v3d<     >"\01\02\03"< >1  .2  .3  <
 >%+-v3d<    >"\01\02\03"< >+1 .2  .3  <
+>%+-v3d<    >[version::qv("1.2.3")]< >+1 .2  .3  <
 >%v4.3d<    >"\01\02\03"< > 001. 002. 003<
 >%0v4.3d<   >"\01\02\03"< >0001.0002.0003<
 >%0*v2d<    >['-', "\0\7\14"]< >00-07-12<
@@ -257,6 +259,7 @@
 >%v*.*d<    >["\01\02\03", 4, 3]< > 001. 002. 003<
 >%0v*.*d<   >["\01\02\03", 4, 3]< >0001.0002.0003<
 >%0*v*d<    >['-', "\0\7\13", 2]< >00-07-11<
+>%0*v*d<    >['-', version::qv("0.7.11"), 2]< >00-07-11<
 >%e<        >1234.875<    >1.234875e+03<
 >%e<        >0.000012345< >1.234500e-05<
 >%e<        >1234567E96<  >1.234567e+102<
@@ -391,6 +394,8 @@
 >%-010x<    >2**32-1<     >ffffffff  <
 >%0-10x<    >2**32-1<     >ffffffff  <
 >%0*x<      >[-10, ,2**32-1]< >ffffffff  <
+>%vx<       >[version::qv("1.2.3")]< >1.2.3<
+>%vx<       >[version::qv("1.20.300")]< >1.14.12c<
 >%y<        >''<          >%y INVALID<
 >%z<        >''<          >%z INVALID<
 >%2$d %1$d<	>[12, 34]<	>34 12<

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2005

From @JohnPeacock

John Peacock wrote​:

OK, here's my alternate patch, along with tests. This simply recreates
a v-string from the version object and then lets the existing vector
handling work the same as it always did. The only thing I didn't do is
to decide what to do about the special cases of cpan-style versions or
alpha versions.

Nah, ignore that; it encapsulates too much knowledge about how version objects
are constructed outside of where version objects are defined (util.c). The
attached is much better, in that it uses the complete toke.c​:scan_vstring logic
to create a new v-string. It is much safer and wouldn't need to change if I
made any alteration to the version object design
(<vassini>inconceivable</vassini>). It is also vastly smaller and easier to
understand...

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2005

From @JohnPeacock

=== sv.c

--- sv.c (revision 18901)
+++ sv.c (local)
@​@​ -8002,21 +8002,22 @​@​
  vecsv = svargs[efix ? efix-1 : svix++];
  vecstr = (U8*)SvPV_const(vecsv,veclen);
  vec_utf8 = DO_UTF8(vecsv);
- /* if this is a version object, we need to return the
- * stringified representation (which the SvPVX_const has
- * already done for us), but not vectorize the args
+
+ /* if this is a version object, we need to convert
+ * back into v-string notation and then let the
+ * vectorize happen normally
  */
- if ( *q == 'd' && sv_derived_from(vecsv,"version") )
+ if ( sv_derived_from(vecsv,"version") )
  {
- q++; /* skip past the rest of the %vd format */
- eptr = (const char *) vecstr;
- elen = veclen;
- if (elen && *eptr == 'v') {
- eptr++;
- elen--;
- }
- vectorize=FALSE;
- goto string;
+ char *tmpend;
+ char *version = savesvpv(vecsv);
+ vecsv = sv_newmortal();
+ PL_bufend = version + veclen;
+ tmpend = scan_vstring((const char *)version,vecsv);
+ veclen = tmpend - version;
+ vecstr = (U8*)SvPV_const(vecsv,veclen);
+ vec_utf8 = DO_UTF8(vecsv);
+ Safefree(version);
  }
  }
  else {
=== t/op/sprintf.t

--- t/op/sprintf.t (revision 18901)
+++ t/op/sprintf.t (local)
@​@​ -245,8 +245,10 @​@​

%vd< >[version​::qv("1.2.3")]< >1.2.3<
%v.3d< >"\01\02\03"< >001.002.003<
%0v3d< >"\01\02\03"< >001.002.003<
+>%v.3d< >[version​::qv("1.2.3")]< >001.002.003<
%-v3d< >"\01\02\03"< >1 .2 .3 <
%+-v3d< >"\01\02\03"< >+1 .2 .3 <
+>%+-v3d< >[version​::qv("1.2.3")]< >+1 .2 .3 <
%v4.3d< >"\01\02\03"< > 001. 002. 003<
%0v4.3d< >"\01\02\03"< >0001.0002.0003<
%0*v2d< >['-', "\0\7\14"]< >00-07-12<
@​@​ -257,6 +259,7 @​@​
%v*.*d< >["\01\02\03", 4, 3]< > 001. 002. 003<
%0v*.*d< >["\01\02\03", 4, 3]< >0001.0002.0003<
%0*v*d< >['-', "\0\7\13", 2]< >00-07-11<
+>%0*v*d< >['-', version​::qv("0.7.11"), 2]< >00-07-11<
%e< >1234.875< >1.234875e+03<
%e< >0.000012345< >1.234500e-05<
%e< >1234567E96< >1.234567e+102<
@​@​ -391,6 +394,8 @​@​
%-010x< >2**32-1< >ffffffff <
%0-10x< >2**32-1< >ffffffff <
%0*x< >[-10, ,2**32-1]< >ffffffff <
+>%vx< >[version​::qv("1.2.3")]< >1.2.3<
+>%vx< >[version​::qv("1.20.300")]< >1.14.12c<
%y< >''< >%y INVALID<
%z< >''< >%z INVALID<
%2$d %1$d< >[12, 34]< >34 12<

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2005

From @gisle

John Peacock <jpeacock@​rowman.com> writes​:

--- sv.c (revision 18901)
+++ sv.c (local)
@​@​ -8002,21 +8002,22 @​@​
vecsv = svargs[efix ? efix-1 : svix++];
vecstr = (U8*)SvPV_const(vecsv,veclen);
vec_utf8 = DO_UTF8(vecsv);
- /* if this is a version object, we need to return the
- * stringified representation (which the SvPVX_const has
- * already done for us), but not vectorize the args
+
+ /* if this is a version object, we need to convert
+ * back into v-string notation and then let the
+ * vectorize happen normally
*/
- if ( *q == 'd' && sv_derived_from(vecsv,"version") )
+ if ( sv_derived_from(vecsv,"version") )
{
- q++; /* skip past the rest of the %vd format */
- eptr = (const char *) vecstr;
- elen = veclen;
- if (elen && *eptr == 'v') {
- eptr++;
- elen--;
- }
- vectorize=FALSE;
- goto string;
+ char *tmpend;
+ char *version = savesvpv(vecsv);
+ vecsv = sv_newmortal();
+ PL_bufend = version + veclen;
+ tmpend = scan_vstring((const char *)version,vecsv);
+ veclen = tmpend - version;

This calculation is meaningless as it is overwritten in the next
statement, so you don't need tmpend at all.

+ vecstr = (U8*)SvPV_const(vecsv,veclen);
+ vec_utf8 = DO_UTF8(vecsv);
+ Safefree(version);
}
}
else {

I suggest you make it​:

==== //depot/perl/sv.c#1059 - /home/gisle/perl/blead/sv.c ====
@​@​ -7995,21 +7995,20 @​@​
  vecsv = svargs[efix ? efix-1 : svix++];
  vecstr = (U8*)SvPV_const(vecsv,veclen);
  vec_utf8 = DO_UTF8(vecsv);
- /* if this is a version object, we need to return the
- * stringified representation (which the SvPVX_const has
- * already done for us), but not vectorize the args
+
+ /* if this is a version object, we need to convert
+ * back into v-string notation and then let the
+ * vectorize happen normally
  */
- if ( *q == 'd' && sv_derived_from(vecsv,"version") )
+ if (sv_derived_from(vecsv, "version"))
  {
- q++; /* skip past the rest of the %vd format */
- eptr = (const char *) vecstr;
- elen = veclen;
- if (elen && *eptr == 'v') {
- eptr++;
- elen--;
- }
- vectorize=FALSE;
- goto string;
+ char *version = savesvpv(vecsv);
+ vecsv = sv_newmortal();
+ PL_bufend = version + veclen;
+ scan_vstring((const char *)version, vecsv);
+ vecstr = (U8*)SvPV_const(vecsv, veclen);
+ vec_utf8 = DO_UTF8(vecsv);
+ Safefree(version);
  }
  }
  else {

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2005

From @gisle

Gisle Aas <gisle@​ActiveState.com> writes​:

+ scan_vstring((const char *)version, vecsv);

This cast is also useless. A plain (char*) can always be passed to a
function taking (const char*). You might even declare "version" as a
"const char*" in the first place as its chars isn't modified.

--Gisle

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2005

From @JohnPeacock

Gisle Aas wrote​:

This calculation is meaningless as it is overwritten in the next
statement, so you don't need tmpend at all.

Duh! I misread that and thought that SvPV_const(vecsv,veclen) required
the length to work, not that it *filled* *in* the length. There are a
lot of those un[der]documented macros lurking around that don't make it
that easy to change things.

Attached is a new path with Gisle's suggested changes as well as
documenting why we need to set PL_bufend (that seems unnecessarily
obscure without comment, since not everyone has spent lots of time
wandering through the depths of toke.c).

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 14, 2005

From @JohnPeacock

=== sv.c

--- sv.c (revision 18901)
+++ sv.c (local)
@​@​ -8002,21 +8002,24 @​@​
  vecsv = svargs[efix ? efix-1 : svix++];
  vecstr = (U8*)SvPV_const(vecsv,veclen);
  vec_utf8 = DO_UTF8(vecsv);
- /* if this is a version object, we need to return the
- * stringified representation (which the SvPVX_const has
- * already done for us), but not vectorize the args
+
+ /* if this is a version object, we need to convert
+ * back into v-string notation and then let the
+ * vectorize happen normally
  */
- if ( *q == 'd' && sv_derived_from(vecsv,"version") )
+ if ( sv_derived_from(vecsv,"version") )
  {
- q++; /* skip past the rest of the %vd format */
- eptr = (const char *) vecstr;
- elen = veclen;
- if (elen && *eptr == 'v') {
- eptr++;
- elen--;
- }
- vectorize=FALSE;
- goto string;
+ char *version = savesvpv(vecsv);
+ vecsv = sv_newmortal();
+ /* scan_vstring is expected to be called during
+ * tokenization, so we need to fake up the end
+ * of the buffer for it
+ */
+ PL_bufend = version + veclen;
+ scan_vstring((const char *)version,vecsv);
+ vecstr = (U8*)SvPV_const(vecsv,veclen);
+ vec_utf8 = DO_UTF8(vecsv);
+ Safefree(version);
  }
  }
  else {
=== t/op/sprintf.t

--- t/op/sprintf.t (revision 18901)
+++ t/op/sprintf.t (local)
@​@​ -245,8 +245,10 @​@​

%vd< >[version​::qv("1.2.3")]< >1.2.3<
%v.3d< >"\01\02\03"< >001.002.003<
%0v3d< >"\01\02\03"< >001.002.003<
+>%v.3d< >[version​::qv("1.2.3")]< >001.002.003<
%-v3d< >"\01\02\03"< >1 .2 .3 <
%+-v3d< >"\01\02\03"< >+1 .2 .3 <
+>%+-v3d< >[version​::qv("1.2.3")]< >+1 .2 .3 <
%v4.3d< >"\01\02\03"< > 001. 002. 003<
%0v4.3d< >"\01\02\03"< >0001.0002.0003<
%0*v2d< >['-', "\0\7\14"]< >00-07-12<
@​@​ -257,6 +259,7 @​@​
%v*.*d< >["\01\02\03", 4, 3]< > 001. 002. 003<
%0v*.*d< >["\01\02\03", 4, 3]< >0001.0002.0003<
%0*v*d< >['-', "\0\7\13", 2]< >00-07-11<
+>%0*v*d< >['-', version​::qv("0.7.11"), 2]< >00-07-11<
%e< >1234.875< >1.234875e+03<
%e< >0.000012345< >1.234500e-05<
%e< >1234567E96< >1.234567e+102<
@​@​ -391,6 +394,8 @​@​
%-010x< >2**32-1< >ffffffff <
%0-10x< >2**32-1< >ffffffff <
%0*x< >[-10, ,2**32-1]< >ffffffff <
+>%vx< >[version​::qv("1.2.3")]< >1.2.3<
+>%vx< >[version​::qv("1.20.300")]< >1.14.12c<
%y< >''< >%y INVALID<
%z< >''< >%z INVALID<
%2$d %1$d< >[12, 34]< >34 12<

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2005

From @ysth

On Wed, Dec 14, 2005 at 10​:12​:56AM -0500, John Peacock wrote​:

Gisle Aas wrote​:

This calculation is meaningless as it is overwritten in the next
statement, so you don't need tmpend at all.

Duh! I misread that and thought that SvPV_const(vecsv,veclen) required
the length to work, not that it *filled* *in* the length. There are a
lot of those un[der]documented macros lurking around that don't make it
that easy to change things.

Patches welcome...

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2005

From @ysth

On Tue, Dec 13, 2005 at 12​:09​:39PM -0800, Gisle Aas wrote​:

John Peacock <jpeacock@​rowman.com> writes​:

IIF the term is a version object, then I'll convert that back to its
v-string equivalent and allow the existing 'v' format code
(i.e. width, precision, etc) do its damage. That should be much
easier than figuring out how to ignore all of the undesirable format
flags (as the current simplistic method does).

How about something like the following patch? It allow any array
reference to be passed as the sprintf vector argument and then the
only special case for version objects is that its hash is dereferenced
one level to make it an array. Now I can do this​:

$ perl \-e 'printf "%vd\\n"\, $^V'
5\.9\.3
$ perl \-e 'printf "%v04d\\n"\, $^V'
0005\.0009\.0003
$ perl \-e 'printf "%vb\\n"\, $^V'
101\.1001\.11
$ perl \-e 'printf "%v04d\\n"\, \[1\.\.5\]'
0001\.0002\.0003\.0004\.0005

I find this kind of cool, but I'm not sure if this is really useful
somehow. It just means that​:

$str = sprintf "%vX"\, \\@&#8203;array;

is short for​:

$str = join\("\."\, map sprintf\("%X"\, $\_\)\, @&#8203;array\);

I like this idea a lot.

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2005

From @gisle

John Peacock <jpeacock@​rowman.com> writes​:

Attached is a new path with Gisle's suggested changes as well as
documenting why we need to set PL_bufend

I applied this as change 26365 and added some extra test cases. I was
surprised by these​:

  >%vd< >[version​::qv("1.2")]< >1.2.0<
  >%vd< >[version​::qv("1.02")]< >1.2.0<
  >%vd< >[version​::qv("1.002")]< >1.2.0<
  >%vd< >[version​::qv("1.02_03")]< >1.23<
  >%vd< >[version​::qv("50")]< >50.0.0<
  >%vd< >[version​::qv("50_20")]< >50.200<
  >%vd< >[version​::qv("5.005_03")]< >5.53<

Please advice what the expected output of these should be?

--Gisle

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2005

From @JohnPeacock

Gisle Aas wrote​:

I applied this as change 26365 and added some extra test cases. I was
surprised by these​:

%vd< >[version​::qv("1.2")]< >1.2.0<
%vd< >[version​::qv("1.02")]< >1.2.0<
%vd< >[version​::qv("1.002")]< >1.2.0<
%vd< >[version​::qv("1.02_03")]< >1.23<
%vd< >[version​::qv("50")]< >50.0.0<
%vd< >[version​::qv("50_20")]< >50.200<
%vd< >[version​::qv("5.005_03")]< >5.53<

Please advice what the expected output of these should be?

!!!!! IMPORTANT NOTE​: qv() is *not* equivalent to new() !!!!!

qv() forces the input value to be interpreted as if it were an "Extended
version" (a version with 2 or more decimal points). It is intended to
be used to provide a cross-Perl-version way of initializing version
objects that does not rely on the v-string handling between 5.6.0 and 5.8.1.

If you replace 'version​::qv' with 'version->new' in all of those tests,
you will get much more obvious answers. However, you will still not get
what you might imagine when you are dealing with alpha versions, because
the v-string code ignores underscores. So this is what happens​:

  $v = version->new("1.02_03") => stringifies to 1.02_0300
  printf("%vd",$v) => displays 1.020300

I suppose we could simply error out if the version object was an alpha
version (and one of the vectorization formats was chosen), but I don't
have that exposed via an easy to call function. It is just​:

  hv_exists((HV*)SvRV(vecsv), "alpha", 5)

but that doesn't check to make sure that the vecsv is actually an RV,
but I don't see how that is possible when we just went through the

  sv_derived_from(vecsv,"version")

even to get into that block. Let me sync up to what you applied and see
what I can do that makes sense...

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Dec 15, 2005

From @JohnPeacock

Yitzchak Scott-Thoennes wrote​:

On Wed, Dec 14, 2005 at 10​:12​:56AM -0500, John Peacock wrote​:

There are a
lot of those un[der]documented macros lurking around that don't make it
that easy to change things.

Patches welcome...

This is a grey area, though​:

  Documented in perlapi == Public API

Do we want to document all of these macros, just because they are used
in the *Perl* source, or because they are useful to XS authors too? I
feel stupid because I should have just checked to see what that
unfamiliar function did. It took me a minute to find it once I realized
I was misunderstanding the signature. :(

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2006

From @rgs

Gisle Aas (via RT) wrote​:

Version objects are special cased in perl's sprintf() code, but the result
is not quite right if anything but "%vd" is used​:

$ perl -e 'printf "%vd\n", $^V'
v5.9.3
$ perl -e 'printf "%v3d\n", $^V'
v5.9.3
$ perl -e 'printf "%v.3d\n", $^V'
118.053.046.057.046.051
$ perl -e 'printf "%vx\n", $^V'
76.35.2e.39.2e.33

Currently we have :

  $ cat t.pl
  printf "%vd\n", $^V;
  printf "%v3d\n", $^V;
  printf "%v.3d\n", $^V;
  printf "%vx\n", $^V;

  $ bleadperl t.pl
  5.9.4
  5. 9. 4
  005.009.004
  5.9.4

Those results are satisfying to me, can we close this bug ?

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2006

From @JohnPeacock

Rafael Garcia-Suarez wrote​:

Currently we have :

$ cat t\.pl
printf "%vd\\n"\, $^V;
printf "%v3d\\n"\, $^V;
printf "%v\.3d\\n"\, $^V;
printf "%vx\\n"\, $^V;

$ bleadperl t\.pl
5\.9\.4
  5\.  9\.  4
005\.009\.004
5\.9\.4

Those results are satisfying to me, can we close this bug ?

Ay ay, captain!

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5748

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2006

@rgs - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Feb 3, 2006
@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2012

From @cpansprout

On Thu Dec 15 07​:35​:12 2005, jpeacock@​rowman.com wrote​:

I suppose we could simply error out if the version object was an alpha
version (and one of the vectorization formats was chosen), but I don't
have that exposed via an easy to call function. It is just​:

hv\_exists\(\(HV\*\)SvRV\(vecsv\)\, "alpha"\, 5\)

I see that this change was made, in commit 34ba632, but as a warning.

Unfortunately, in causes sprintf("[%vd]", new version v1.1_1) to return
"[%vd]", which means that the %-sequence is treated as invalid based on
its argument.

That doesn’t make sense to me. I think it should simply turn into the
empty string, the way it does with sprintf("[%vd]") (with no arguments).

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 14, 2012

From @JohnPeacock

On 09/13/2012 01​:26 PM, Father Chrysostomos via RT wrote​:

I see that this change was made, in commit 34ba632, but as a warning.

Unfortunately, in causes sprintf("[%vd]", new version v1.1_1) to return
"[%vd]", which means that the %-sequence is treated as invalid based on
its argument.

I don't understand this paragraph. Could you show us with code what you
see and what you would have expected to see? I see this​:

$ perl -e 'sprintf("[%vd]", new version v1.1_1)'
vector argument not supported with alpha versions at -e line 1.

which is precisely what was agreed to in the discussion.

I would also note that this ticket was marked as resolved 6 1/2 years
ago. I don't see any benefit in changing this extremely uncommon edge
case now...

John

@p5pRT
Copy link
Author

p5pRT commented Sep 14, 2012

From @cpansprout

On Thu Sep 13 18​:02​:14 2012, john.peacock@​havurah-software.org wrote​:

On 09/13/2012 01​:26 PM, Father Chrysostomos via RT wrote​:

I see that this change was made, in commit 34ba632, but as a
warning.

Unfortunately, in causes sprintf("[%vd]", new version v1.1_1) to return
"[%vd]", which means that the %-sequence is treated as invalid based on
its argument.

I don't understand this paragraph. Could you show us with code what you
see and what you would have expected to see? I see this​:

$ perl -e 'sprintf("[%vd]", new version v1.1_1)'
vector argument not supported with alpha versions at -e line 1.

which is precisely what was agreed to in the discussion.

Try it without the first s. :-)

$ perl5.16.0 -e 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
[%vd]

I expect to see anything but %vd.

Turn on -w and the extra warning is telling​:

$ perl5.16.0 -we 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
Invalid conversion in printf​: "%v" at -e line 1.
[%vd]

%vd is not invalid. It’s the argument that is invalid.

I think the vector warning and an empty string for output would be best.
After all, %vd produces the empty string for no argument at all.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2012

From @JohnPeacock

On 09/13/2012 11​:42 PM, Father Chrysostomos via RT wrote​:

I think the vector warning and an empty string for output would be best.
After all, %vd produces the empty string for no argument at all.

Like the attached?

LD_LIBRARY_PATH=. ./perl -we 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
[]

I haven't figured out how to patch t/op/sprintf.t to cope with the
warning yet...

John

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2012

From @JohnPeacock

vector_alpha.diff
diff -r d7334029637c sv.c
--- a/sv.c	Tue Sep 11 13:58:24 2012 -0700
+++ b/sv.c	Sat Sep 15 11:00:16 2012 -0400
@@ -10380,13 +10380,17 @@
 		    if ( hv_exists(MUTABLE_HV(SvRV(vecsv)), "alpha", 5 ) ) {
 			Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
 			"vector argument not supported with alpha versions");
-			goto unknown;
+			vecsv = sv_newmortal();
+			vecstr = (U8*)"";
+			veclen = 0;
 		    }
-		    vecsv = sv_newmortal();
-		    scan_vstring(version, version + veclen, vecsv);
-		    vecstr = (U8*)SvPV_const(vecsv, veclen);
-		    vec_utf8 = DO_UTF8(vecsv);
-		    Safefree(version);
+		    else {
+			vecsv = sv_newmortal();
+			scan_vstring(version, version + veclen, vecsv);
+			vecstr = (U8*)SvPV_const(vecsv, veclen);
+			vec_utf8 = DO_UTF8(vecsv);
+			Safefree(version);
+		    }
 		}
 	    }
 	    else {

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2012

From @cpansprout

On Sat Sep 15 08​:08​:19 2012, john.peacock@​havurah-software.org wrote​:

On 09/13/2012 11​:42 PM, Father Chrysostomos via RT wrote​:

I think the vector warning and an empty string for output would be best.
After all, %vd produces the empty string for no argument at all.

Like the attached?

LD_LIBRARY_PATH=. ./perl -we 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
[]

I haven't figured out how to patch t/op/sprintf.t to cope with the
warning yet...

Oops. Sorry.

I have already fixed this, but I forgot to say so. The commit id is
8b6051f.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2012

From @cpansprout

On Sat Sep 15 08​:08​:19 2012, john.peacock@​havurah-software.org wrote​:

On 09/13/2012 11​:42 PM, Father Chrysostomos via RT wrote​:

I think the vector warning and an empty string for output would be best.
After all, %vd produces the empty string for no argument at all.

Like the attached?

LD_LIBRARY_PATH=. ./perl -we 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
[]

I haven't figured out how to patch t/op/sprintf.t to cope with the
warning yet...

Oops. Sorry.

I have already fixed this, but I forgot to say so. The commit id is
8b6051f.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2012

From [Unknown Contact. See original ticket]

On Sat Sep 15 08​:08​:19 2012, john.peacock@​havurah-software.org wrote​:

On 09/13/2012 11​:42 PM, Father Chrysostomos via RT wrote​:

I think the vector warning and an empty string for output would be best.
After all, %vd produces the empty string for no argument at all.

Like the attached?

LD_LIBRARY_PATH=. ./perl -we 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
[]

I haven't figured out how to patch t/op/sprintf.t to cope with the
warning yet...

Oops. Sorry.

I have already fixed this, but I forgot to say so. The commit id is
8b6051f.

--

Father Chrysostomos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant