Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; 
  s=zoho; d=enosys.org; 
  h=date:from:to:message-id:subject:mime-version:content-type:user-agent; 
  b=joc+/JhXJkGL1/BAinKOQGtqBF0+B/vFofIrKyG/KHgm6Js24CttzeKKo+koQA0fHzvp5IZ7/dmw
    UAkEST4ecj3V9TP2QzHAdE6v5nJ3q9Or9IBLtvcvZOn+MLNmSTydJTJ5k+7NLXx11XhqHE1KGCr7
    VI8whQkW9G9W5n/fNNg=  
Date: Thu, 21 Apr 2016 17:21:41 -0500
From: Ryan Wilson <ryan@enosys.org>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Message-ID: <1543ae755d4.11b1ff5d018786.3657412396897406270@enosys.org>
Subject: [bug] Incorrect output from printf '{%-5.s}' 123456789
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Priority: Medium
User-Agent: Zoho Mail
X-Mailer: Zoho Mail
X-Seq: zsh-workers 38305

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.

