zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Ryan Wilson <ryan@enosys.org>,
	"zsh-workers@zsh.org " <zsh-workers@zsh.org>
Subject: Re: [bug] Incorrect output from printf '{%-5.s}' 123456789
Date: Thu, 21 Apr 2016 18:16:03 -0700	[thread overview]
Message-ID: <160421181604.ZM32062@torch.brasslantern.com> (raw)
In-Reply-To: <1543ae755d4.11b1ff5d018786.3657412396897406270@enosys.org>

On Apr 21,  5:21pm, Ryan Wilson wrote:
} Subject: [bug] Incorrect output from printf '{%-5.s}' 123456789
}
} It appears that zsh doesn't handle the precision specifier for %s
} correctly in the printf builtin:
} 
} % builtin printf '{%-5.s}' 123456789
} {123456789}

Well, hrm.

diff --git a/Src/builtin.c b/Src/builtin.c
index 4c8fbcd..ad01ad4 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4736,7 +4736,8 @@ bin_print(char *name, char **args, Options ops, int func)
 		} else if (idigit(*c)) {
 		    prec = strtoul(c, &endptr, 0);
 		    c = endptr;
-		}
+		} else
+		    prec = 0;
 		if (prec >= 0) *d++ = '.', *d++ = '*';
 	    }
 


      reply	other threads:[~2016-04-22  1:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 22:21 Ryan Wilson
2016-04-22  1:16 ` Bart Schaefer [this message]

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=160421181604.ZM32062@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=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).