Summary
%vd formats an ordinary dotted numeric string as a version vector instead of
as the string's character code points.
Reproducer
printf "%vd\n", "1.22.333";
Expected behavior
Perl 5.42 prints:
Each character in the plain string is formatted as a decimal code point.
Actual behavior
Both the JVM and interpreter backends print:
Scope confirmed during investigation
This is specifically a plain string that happens to match a dotted-numeric
shape. A true v-string is correctly rendered as 1.22.333 by both Perl and
PerlOnJava, while adding a nonnumeric suffix makes PerlOnJava use the normal
character-vector path:
printf "%vd\n", v1.22.333; # expected and actual: 1.22.333
printf "%vd\n", "1.22.333x"; # expected and actual: 49.46.50.50.46.51.51.51.120
Likely cause
SprintfVectorFormatter currently treats every scalar whose string value
matches \\d+(\\.\\d+)* as a version vector. The formatter should use the
scalar's v-string/version representation, not infer version semantics from an
ordinary string's text.
Impact
Any code using %vd to serialize or inspect character data gets silently
incorrect output when the data is composed only of dot-separated digits. This
is particularly risky because the output is plausible-looking and no error is
raised.
Acceptance criteria
- An ordinary string
"1.22.333" formats as character code points with %vd.
- A real v-string continues to format as
1.22.333.
- Verify both JVM and interpreter backends.
Summary
%vdformats an ordinary dotted numeric string as a version vector instead ofas the string's character code points.
Reproducer
Expected behavior
Perl 5.42 prints:
Each character in the plain string is formatted as a decimal code point.
Actual behavior
Both the JVM and interpreter backends print:
Scope confirmed during investigation
This is specifically a plain string that happens to match a dotted-numeric
shape. A true v-string is correctly rendered as
1.22.333by both Perl andPerlOnJava, while adding a nonnumeric suffix makes PerlOnJava use the normal
character-vector path:
Likely cause
SprintfVectorFormattercurrently treats every scalar whose string valuematches
\\d+(\\.\\d+)*as a version vector. The formatter should use thescalar's v-string/version representation, not infer version semantics from an
ordinary string's text.
Impact
Any code using
%vdto serialize or inspect character data gets silentlyincorrect output when the data is composed only of dot-separated digits. This
is particularly risky because the output is plausible-looking and no error is
raised.
Acceptance criteria
"1.22.333"formats as character code points with%vd.1.22.333.