diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-28 00:26:01 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-28 00:26:01 -0600 |
| commit | a5a920383fe85f4dada0cb80418f7a935c12dc4a (patch) | |
| tree | 812c7372c1f25d6ed4ef2cfb7212ff3c84aadc89 /bench/git@git.abendless.com:/srv/git | |
| parent | ec1cd3eb8e1aa177329f25d134f372d3e999d4a4 (diff) | |
| download | zash-a5a920383fe85f4dada0cb80418f7a935c12dc4a.tar.gz | |
fix(printf): a negative '*' precision is no precision
`printf '%.*d' -5 1` built the conversion "%.-5jd" and printed it
literally: a width and precision taken with '*' were written with "%d"
of an (int) cast, so a negative precision produced ".-5" in the spec.
copy_number() now writes the value with "%jd" - no narrowing, which the
review asked for - and, for a precision, drops the '.' again when the
value is negative: C99 says a negative precision is as if it were
omitted. A negative width stays, where snprintf() reads the '-' as a
flag.
tests/posix/printf-ext.sh covers all four shapes; the expected output
is what dash and bash print.
Verified: make check, and the same test under ASan+UBSan on Linux.
Diffstat (limited to 'bench/git@git.abendless.com:/srv/git')
0 files changed, 0 insertions, 0 deletions
