From: Ryan Wilson <ryan@enosys.org>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: [bug] Incorrect output from printf '{%-5.s}' 123456789
Date: Thu, 21 Apr 2016 17:21:41 -0500 [thread overview]
Message-ID: <1543ae755d4.11b1ff5d018786.3657412396897406270@enosys.org> (raw)
It appears that zsh doesn't handle the precision specifier for %s correctly in
the printf builtin:
% builtin printf '{%-5.s}' 123456789
{123456789}
% command printf '{%-5.s}' 123456789
{ }
% bash -c "builtin printf '{%-5.s}' 123456789"
{ }
% dash -c "printf '{%-5.s}' 123456789"
{ }
man 3 printf says that for %s "if the precision is given as just '.', the
precision is taken to be zero.". Since the precision specifier for %s gives the
maximum number of characters to print, with a precision of zero the effect of
%-5.s should be to right-pad the empty string with 5 spaces. But instead zsh
ignores this and prints the full string.
next reply other threads:[~2016-04-21 22:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 22:21 Ryan Wilson [this message]
2016-04-22 1:16 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1543ae755d4.11b1ff5d018786.3657412396897406270@enosys.org \
--to=ryan@enosys.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).